[LLGS] Avoid misrepresenting log lines as inferior output
Summary:
in case we are logging to stdout, any log lines from the forked child can be misconstrued to be
inferior output. To avoid this, we disable all logging immediately after forking.
I also fix the implementatoion of DisableAllLogChannels, which was a no-op before this commit.
Reviewers: clayborg, ovyalov
Subscribers: dean, lldb-commits
Differential Revision: http://reviews.llvm.org/D12083
llvm-svn: 245272
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index b4afe62..b237339 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -560,8 +560,11 @@
// Child process.
if (pid == 0)
{
+ // First, make sure we disable all logging. If we are logging to stdout, our logs can be
+ // mistaken for inferior output.
+ Log::DisableAllLogChannels(nullptr);
// FIXME consider opening a pipe between parent/child and have this forked child
- // send log info to parent re: launch status, in place of the log lines removed here.
+ // send log info to parent re: launch status.
// Start tracing this child that is about to exec.
error = PtraceWrapper(PTRACE_TRACEME, 0);