diff options
author | Pavel Labath <labath@google.com> | 2017-02-15 17:13:19 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-02-15 17:13:19 +0000 |
commit | f0713996b24bce73662ef3db15502376142a3254 (patch) | |
tree | d610b38b2efab256307c8184b27982e13a247bda /lldb/source/Commands/CommandObjectLog.cpp | |
parent | 94c8d4976cd2882277ed2311fa077d72a5265dd7 (diff) | |
download | llvm-f0713996b24bce73662ef3db15502376142a3254.zip llvm-f0713996b24bce73662ef3db15502376142a3254.tar.gz llvm-f0713996b24bce73662ef3db15502376142a3254.tar.bz2 |
Revert "Refactor log channel registration mechanism"
The change breaks on Windows and NetBSD bots. Revert while I
investigate.
llvm-svn: 295201
Diffstat (limited to 'lldb/source/Commands/CommandObjectLog.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectLog.cpp | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index c10f868..6fbab08 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -227,15 +227,25 @@ protected: return false; } + Log::Callbacks log_callbacks; + const std::string channel = args[0].ref; args.Shift(); // Shift off the channel - if (channel == "all") { - Log::DisableAllLogChannels(&result.GetErrorStream()); + if (Log::GetLogChannelCallbacks(ConstString(channel), log_callbacks)) { + log_callbacks.disable(args.GetConstArgumentVector(), + &result.GetErrorStream()); result.SetStatus(eReturnStatusSuccessFinishNoResult); + } else if (channel == "all") { + Log::DisableAllLogChannels(&result.GetErrorStream()); } else { - if (Log::DisableLogChannel(channel, args.GetConstArgumentVector(), - result.GetErrorStream())) + LogChannelSP log_channel_sp(LogChannel::FindPlugin(channel.data())); + if (log_channel_sp) { + log_channel_sp->Disable(args.GetConstArgumentVector(), + &result.GetErrorStream()); result.SetStatus(eReturnStatusSuccessFinishNoResult); + } else + result.AppendErrorWithFormat("Invalid log channel '%s'.\n", + channel.data()); } return result.Succeeded(); } @@ -274,12 +284,26 @@ protected: Log::ListAllLogChannels(&result.GetOutputStream()); result.SetStatus(eReturnStatusSuccessFinishResult); } else { - bool success = true; - for (const auto &entry : args.entries()) - success = success && Log::ListChannelCategories( - entry.ref, result.GetOutputStream()); - if (success) - result.SetStatus(eReturnStatusSuccessFinishResult); + for (auto &entry : args.entries()) { + Log::Callbacks log_callbacks; + + if (Log::GetLogChannelCallbacks(ConstString(entry.ref), + log_callbacks)) { + log_callbacks.list_categories(&result.GetOutputStream()); + result.SetStatus(eReturnStatusSuccessFinishResult); + } else if (entry.ref == "all") { + Log::ListAllLogChannels(&result.GetOutputStream()); + result.SetStatus(eReturnStatusSuccessFinishResult); + } else { + LogChannelSP log_channel_sp(LogChannel::FindPlugin(entry.c_str())); + if (log_channel_sp) { + log_channel_sp->ListCategories(&result.GetOutputStream()); + result.SetStatus(eReturnStatusSuccessFinishNoResult); + } else + result.AppendErrorWithFormat("Invalid log channel '%s'.\n", + entry.c_str()); + } + } } return result.Succeeded(); } |