diff options
| author | Caroline Tice <ctice@apple.com> | 2011-05-02 20:41:46 +0000 |
|---|---|---|
| committer | Caroline Tice <ctice@apple.com> | 2011-05-02 20:41:46 +0000 |
| commit | 969ed3d10f2bed3ef9c4d53114594827fefecf68 (patch) | |
| tree | b7055dc7c40247fe6accf64529b215cd455b6f30 /lldb/source/Interpreter | |
| parent | f897d3b88bf5b09b7aa142e2033146bdeda5316f (diff) | |
| download | bcm5719-llvm-969ed3d10f2bed3ef9c4d53114594827fefecf68.tar.gz bcm5719-llvm-969ed3d10f2bed3ef9c4d53114594827fefecf68.zip | |
This patch captures and serializes all output being written by the
command line driver, including the lldb prompt being output by
editline, the asynchronous process output & error messages, and
asynchronous messages written by target stop-hooks.
As part of this it introduces a new Stream class,
StreamAsynchronousIO. A StreamAsynchronousIO object is created with a
broadcaster, who will eventually broadcast the stream's data for a
listener to handle, and an event type indicating what type of event
the broadcaster will broadcast. When the Write method is called on a
StreamAsynchronousIO object, the data is appended to an internal
string. When the Flush method is called on a StreamAsynchronousIO
object, it broadcasts it's data string and clears the string.
Anything in lldb-core that needs to generate asynchronous output for
the end-user should use the StreamAsynchronousIO objects.
I have also added a new notification type for InputReaders, to let
them know that a asynchronous output has been written. This is to
allow the input readers to, for example, refresh their prompts and
lines, if desired. I added the case statements to all the input
readers to catch this notification, but I haven't added any code for
handling them yet (except to the IOChannel input reader).
llvm-svn: 130721
Diffstat (limited to 'lldb/source/Interpreter')
| -rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 11 | ||||
| -rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 6 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index a36d9c299e8..16e5f3b75af 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1226,7 +1226,10 @@ CommandInterpreter::GetConfirmationInputReaderCallback out_file.Flush (); } break; - + + case eInputReaderAsynchronousOutputWritten: + break; + case eInputReaderGotToken: if (bytes_len == 0) { @@ -1642,6 +1645,12 @@ CommandInterpreter::HandleCommands (const StringList &commands, } } + if (result.GetImmediateOutputStream()) + result.GetImmediateOutputStream()->Flush(); + + if (result.GetImmediateErrorStream()) + result.GetImmediateErrorStream()->Flush(); + // N.B. Can't depend on DidChangeProcessState, because the state coming into the command execution // could be running (for instance in Breakpoint Commands. // So we check the return value to see if it is has running in it. diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 10b9792f009..47302be0ee4 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -639,6 +639,9 @@ ScriptInterpreterPython::InputReaderCallback script_interpreter->EnterSession (); break; + case eInputReaderAsynchronousOutputWritten: + break; + case eInputReaderInterrupt: ::write (script_interpreter->m_embedded_python_pty.GetMasterFileDescriptor(), "raise KeyboardInterrupt\n", 24); break; @@ -1047,6 +1050,9 @@ ScriptInterpreterPython::GenerateBreakpointOptionsCommandCallback } break; + case eInputReaderAsynchronousOutputWritten: + break; + case eInputReaderGotToken: { std::string temp_string (bytes, bytes_len); |

