[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
This commit is contained in:
Pavel Labath 2015-08-18 08:23:35 +00:00
parent e1c08b0bfe
commit d2c4c9b132
2 changed files with 5 additions and 2 deletions

View File

@ -449,7 +449,7 @@ Log::DisableAllLogChannels (Stream *feedback_strm)
{
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);

View File

@ -560,8 +560,11 @@ NativeProcessLinux::Launch(LaunchArgs *args, Error &error)
// 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);