[Lldb-commits] [lldb] r245272 - [LLGS] Avoid misrepresenting log lines as inferior output
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 18 01:23:35 PDT 2015
Author: labath
Date: Tue Aug 18 03:23:35 2015
New Revision: 245272
URL: http://llvm.org/viewvc/llvm-project?rev=245272&view=rev
Log:
[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
Modified:
lldb/trunk/source/Core/Log.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
Modified: lldb/trunk/source/Core/Log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=245272&r1=245271&r2=245272&view=diff
==============================================================================
--- lldb/trunk/source/Core/Log.cpp (original)
+++ lldb/trunk/source/Core/Log.cpp Tue Aug 18 03:23:35 2015
@@ -449,7 +449,7 @@ Log::DisableAllLogChannels (Stream *feed
{
CallbackMap &callback_map = GetCallbackMap ();
CallbackMapIter pos, end = callback_map.end();
- const char *categories[1] = {NULL};
+ const char *categories[] = {"all", nullptr};
for (pos = callback_map.begin(); pos != end; ++pos)
pos->second.disable (categories, feedback_strm);
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=245272&r1=245271&r2=245272&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Tue Aug 18 03:23:35 2015
@@ -560,8 +560,11 @@ NativeProcessLinux::Launch(LaunchArgs *a
// 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);
More information about the lldb-commits
mailing list