summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandReturnObject.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2011-02-19 02:53:09 +0000
committerJim Ingham <jingham@apple.com>2011-02-19 02:53:09 +0000
commit85e8b8149243052c721c97ad97ebda82867071a4 (patch)
tree25a82ef1308098b9affee9a484358d849764580f /lldb/source/Interpreter/CommandReturnObject.cpp
parent21f347e7296e9aeda3a6880fb576cf01f85d8de7 (diff)
downloadbcm5719-llvm-85e8b8149243052c721c97ad97ebda82867071a4.tar.gz
bcm5719-llvm-85e8b8149243052c721c97ad97ebda82867071a4.zip
- Changed all the places where CommandObjectReturn was exporting a StreamString to just exporting
a Stream, and then added GetOutputData & GetErrorData to get the accumulated data. - Added a StreamTee that will tee output to two provided lldb::StreamSP's. - Made the CommandObjectReturn use this so you can Tee the results immediately to the debuggers output file, as well as saving up the results to return when the command is done executing. - HandleCommands now uses this so that if you have a set of commands that continue the target you will see the commands come out as they are processed. - The Driver now uses this to output the command results as you go, which makes the interface more reactive seeming. llvm-svn: 126015
Diffstat (limited to 'lldb/source/Interpreter/CommandReturnObject.cpp')
-rw-r--r--lldb/source/Interpreter/CommandReturnObject.cpp37
1 files changed, 14 insertions, 23 deletions
diff --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp
index f634e3c7df5..3faf912bd7d 100644
--- a/lldb/source/Interpreter/CommandReturnObject.cpp
+++ b/lldb/source/Interpreter/CommandReturnObject.cpp
@@ -19,6 +19,8 @@ using namespace lldb;
using namespace lldb_private;
CommandReturnObject::CommandReturnObject () :
+ m_error_stream_string_sp (),
+ m_output_stream_string_sp (),
m_output_stream (),
m_error_stream (),
m_status (eReturnStatusStarted),
@@ -30,18 +32,6 @@ CommandReturnObject::~CommandReturnObject ()
{
}
-StreamString &
-CommandReturnObject::GetOutputStream ()
-{
- return m_output_stream;
-}
-
-StreamString &
-CommandReturnObject::GetErrorStream ()
-{
- return m_error_stream;
-}
-
void
CommandReturnObject::AppendErrorWithFormat (const char *format, ...)
{
@@ -51,10 +41,9 @@ CommandReturnObject::AppendErrorWithFormat (const char *format, ...)
sstrm.PrintfVarArg(format, args);
va_end (args);
- m_error_stream.Printf("error: %s", sstrm.GetData());
+ GetErrorStream().Printf("error: %s", sstrm.GetData());
}
-
void
CommandReturnObject::AppendMessageWithFormat (const char *format, ...)
{
@@ -64,7 +53,7 @@ CommandReturnObject::AppendMessageWithFormat (const char *format, ...)
sstrm.PrintfVarArg(format, args);
va_end (args);
- m_output_stream.Printf("%s", sstrm.GetData());
+ GetOutputStream().Printf("%s", sstrm.GetData());
}
void
@@ -76,7 +65,7 @@ CommandReturnObject::AppendWarningWithFormat (const char *format, ...)
sstrm.PrintfVarArg(format, args);
va_end (args);
- m_error_stream.Printf("warning: %s", sstrm.GetData());
+ GetErrorStream().Printf("warning: %s", sstrm.GetData());
}
void
@@ -84,7 +73,7 @@ CommandReturnObject::AppendMessage (const char *in_string, int len)
{
if (len < 0)
len = ::strlen (in_string);
- m_output_stream.Printf("%*.*s\n", len, len, in_string);
+ GetOutputStream().Printf("%*.*s\n", len, len, in_string);
}
void
@@ -92,7 +81,7 @@ CommandReturnObject::AppendWarning (const char *in_string, int len)
{
if (len < 0)
len = ::strlen (in_string);
- m_error_stream.Printf("warning: %*.*s\n", len, len, in_string);
+ GetErrorStream().Printf("warning: %*.*s\n", len, len, in_string);
}
// Similar to AppendWarning, but do not prepend 'warning: ' to message, and
@@ -103,7 +92,7 @@ CommandReturnObject::AppendRawWarning (const char *in_string, int len)
{
if (len < 0)
len = ::strlen (in_string);
- m_error_stream.Printf("%*.*s", len, len, in_string);
+ GetErrorStream().Printf("%*.*s", len, len, in_string);
}
void
@@ -114,7 +103,7 @@ CommandReturnObject::AppendError (const char *in_string, int len)
if (len < 0)
len = ::strlen (in_string);
- m_error_stream.Printf ("error: %*.*s\n", len, len, in_string);
+ GetErrorStream().Printf ("error: %*.*s\n", len, len, in_string);
}
// Similar to AppendError, but do not prepend 'Error: ' to message, and
@@ -125,7 +114,7 @@ CommandReturnObject::AppendRawError (const char *in_string, int len)
{
if (len < 0)
len = ::strlen (in_string);
- m_error_stream.Printf ("%*.*s", len, len, in_string);
+ GetErrorStream().Printf ("%*.*s", len, len, in_string);
}
void
@@ -156,8 +145,10 @@ CommandReturnObject::HasResult ()
void
CommandReturnObject::Clear()
{
- m_output_stream.Clear();
- m_error_stream.Clear();
+ if (m_output_stream_string_sp)
+ static_cast<StreamString *>(m_output_stream_string_sp.get())->Clear();
+ if (m_error_stream_string_sp)
+ static_cast<StreamString *>(m_error_stream_string_sp.get())->Clear();
m_status = eReturnStatusStarted;
}
OpenPOWER on IntegriCloud