aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectLog.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-03-15 09:06:58 +0000
committerPavel Labath <labath@google.com>2017-03-15 09:06:58 +0000
commit775588c0c308705bafe0e2d8e974b244c779d73c (patch)
treeeadc023efafad72930b2c622519c349e2109edbf /lldb/source/Commands/CommandObjectLog.cpp
parent6de25ec61a10cdea5b49f91ae7163833c45aacb1 (diff)
downloadllvm-775588c0c308705bafe0e2d8e974b244c779d73c.zip
llvm-775588c0c308705bafe0e2d8e974b244c779d73c.tar.gz
llvm-775588c0c308705bafe0e2d8e974b244c779d73c.tar.bz2
Remove lldb streams from the Log class completely
Summary: previously we switched to llvm streams for log output, this completes the switch for the error streams. I also clean up the includes and remove the unused argument from DisableAllLogChannels(). This required adding a bit of boiler plate to convert the output in the command interpreter, but that should go away when we switch command results to use llvm streams as well. Reviewers: zturner, eugene Subscribers: lldb-commits, emaste Differential Revision: https://reviews.llvm.org/D30894 llvm-svn: 297812
Diffstat (limited to 'lldb/source/Commands/CommandObjectLog.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectLog.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp
index 0b6762f..0355a53 100644
--- a/lldb/source/Commands/CommandObjectLog.cpp
+++ b/lldb/source/Commands/CommandObjectLog.cpp
@@ -170,9 +170,14 @@ protected:
m_options.log_file.GetPath(log_file, sizeof(log_file));
else
log_file[0] = '\0';
+
+ std::string error;
+ llvm::raw_string_ostream error_stream(error);
bool success = m_interpreter.GetDebugger().EnableLog(
channel, args.GetArgumentArrayRef(), log_file, m_options.log_options,
- result.GetErrorStream());
+ error_stream);
+ result.GetErrorStream() << error_stream.str();
+
if (success)
result.SetStatus(eReturnStatusSuccessFinishNoResult);
else
@@ -229,12 +234,15 @@ protected:
const std::string channel = args[0].ref;
args.Shift(); // Shift off the channel
if (channel == "all") {
- Log::DisableAllLogChannels(&result.GetErrorStream());
+ Log::DisableAllLogChannels();
result.SetStatus(eReturnStatusSuccessFinishNoResult);
} else {
+ std::string error;
+ llvm::raw_string_ostream error_stream(error);
if (Log::DisableLogChannel(channel, args.GetArgumentArrayRef(),
- result.GetErrorStream()))
+ error_stream))
result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ result.GetErrorStream() << error_stream.str();
}
return result.Succeeded();
}
@@ -269,17 +277,20 @@ public:
protected:
bool DoExecute(Args &args, CommandReturnObject &result) override {
+ std::string output;
+ llvm::raw_string_ostream output_stream(output);
if (args.empty()) {
- Log::ListAllLogChannels(&result.GetOutputStream());
+ Log::ListAllLogChannels(output_stream);
result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
bool success = true;
for (const auto &entry : args.entries())
- success = success && Log::ListChannelCategories(
- entry.ref, result.GetOutputStream());
+ success =
+ success && Log::ListChannelCategories(entry.ref, output_stream);
if (success)
result.SetStatus(eReturnStatusSuccessFinishResult);
}
+ result.GetOutputStream() << output_stream.str();
return result.Succeeded();
}
};