aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2011-05-16 19:20:50 +0000
committerCaroline Tice <ctice@apple.com>2011-05-16 19:20:50 +0000
commitb5059acc5f9dc0fe7a7e607d59b7fd560cd87a0c (patch)
tree587af795166cd8cbb55ebe8fc5ea9b78fb988dc7
parent872a91167ebe2780f0b899c392bce491a0573bfa (diff)
downloadllvm-b5059acc5f9dc0fe7a7e607d59b7fd560cd87a0c.zip
llvm-b5059acc5f9dc0fe7a7e607d59b7fd560cd87a0c.tar.gz
llvm-b5059acc5f9dc0fe7a7e607d59b7fd560cd87a0c.tar.bz2
Fix places that were writing directly to the debugger's output
handles to go through the appropriate channels instead. llvm-svn: 131415
-rw-r--r--lldb/source/Commands/CommandObjectBreakpointCommand.cpp15
-rw-r--r--lldb/tools/driver/Driver.cpp11
2 files changed, 19 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index 1646648..de725a6 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -23,6 +23,7 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/State.h"
+#include "lldb/Core/StreamAsynchronousIO.h"
using namespace lldb;
using namespace lldb_private;
@@ -802,9 +803,13 @@ CommandObjectBreakpointCommand::BreakpointOptionsCallbackFunction
// Rig up the results secondary output stream to the debugger's, so the output will come out synchronously
// if the debugger is set up that way.
- result.SetImmediateOutputFile (debugger.GetOutputFile().GetStream());
- result.SetImmediateErrorFile (debugger.GetErrorFile().GetStream());
-
+ StreamSP output_stream (new StreamAsynchronousIO (debugger.GetCommandInterpreter(),
+ CommandInterpreter::eBroadcastBitAsynchronousOutputData));
+ StreamSP error_stream (new StreamAsynchronousIO (debugger.GetCommandInterpreter(),
+ CommandInterpreter::eBroadcastBitAsynchronousErrorData));
+ result.SetImmediateOutputStream (output_stream);
+ result.SetImmediateErrorStream (error_stream);
+
bool stop_on_continue = true;
bool echo_commands = false;
bool print_results = true;
@@ -816,7 +821,9 @@ CommandObjectBreakpointCommand::BreakpointOptionsCallbackFunction
echo_commands,
print_results,
result);
- }
+ result.GetImmediateOutputStream()->Flush();
+ result.GetImmediateErrorStream()->Flush();
+ }
}
return ret_value;
}
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index c3d4015..6c52890 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -851,12 +851,17 @@ Driver::HandleIOEvent (const SBEvent &event)
if (command_string == NULL)
command_string = "";
SBCommandReturnObject result;
- result.SetImmediateOutputFile (m_debugger.GetOutputFileHandle());
- result.SetImmediateErrorFile (m_debugger.GetErrorFileHandle());
- // We've set the result to dump immediately.
+ // We don't want the result to bypass the OutWrite function in IOChannel, as this can result in odd
+ // output orderings and problems with the prompt.
m_debugger.GetCommandInterpreter().HandleCommand (command_string, result, true);
+ if (result.GetOutputSize() > 0)
+ m_io_channel_ap->OutWrite (result.GetOutput(), result.GetOutputSize(), NO_ASYNC);
+
+ if (result.GetErrorSize() > 0)
+ m_io_channel_ap->OutWrite (result.GetError(), result.GetErrorSize(), NO_ASYNC);
+
// We are done getting and running our command, we can now clear the
// m_waiting_for_command so we can get another one.
m_waiting_for_command = false;