<div dir="ltr">Thanks guys. I tried our IDE against a sample multithreading program on Mac, it correctly switches selected thread to the worker thread that triggers breakpoint, while on Linux(CentOS release 6.7) it failed to do that. Repro code:<div><br></div><div><b>=========================Output</b><b>=========================</b><br></div><div><div>Launch result: success</div><div><Listener> Listening Thread ID: 139749072582400</div><div>running_signal wait</div><div>stopped_signal wait</div><div>Target event: ModulesLoaded</div><div>Target event: ModulesLoaded</div><div>Target event: ModulesLoaded</div><div>Target event: ModulesLoaded</div><div>Target event: ModulesLoaded</div><div>Target event: ModulesLoaded</div><div>Target event: ModulesLoaded</div><div>Target event: ModulesLoaded</div><div>Non stopping event: <lldb.SBEvent; proxy of <Swig Object of type 'lldb::SBEvent *' at 0x7f19e0975990> ></div><div>Process event: StateChanged, Running</div><div>Stop reason: 1</div><div>Process event: Stdout, Running</div><div>Stop reason: 1</div><div>Stdout:</div><div>main() : creating thread, 0</div><div>Process event: StateChanged, Stopped</div></div><div><div>after wait_for_process_run_then_stop</div><div>frame #0: 0x00007fcb7259ceb0 ld-linux-x86-64.so.2`__GI__dl_debug_state</div><div>frame #1: 0x00007fcb725a0c53 ld-linux-x86-64.so.2`dl_open_worker + 499</div><div>frame #2: 0x00007fcb7259c286 ld-linux-x86-64.so.2`_dl_catch_error + 102</div><div>frame #3: 0x00007fcb725a063a ld-linux-x86-64.so.2`_dl_open + 186</div><div>frame #4: 0x00007fcb71963c60 libc.so.6`do_dlopen + 64</div><div>frame #5: 0x00007fcb7259c286 ld-linux-x86-64.so.2`_dl_catch_error + 102</div><div>frame #6: 0x00007fcb71963db7 libc.so.6`__GI___libc_dlopen_mode + 71</div><div>frame #7: 0x00007fcb71be0eec libpthread.so.0`pthread_cancel_init + 76</div><div>frame #8: 0x00007fcb71be104c libpthread.so.0`_Unwind_ForcedUnwind + 60</div><div>frame #9: 0x00007fcb71bdef60 libpthread.so.0`__GI___pthread_unwind + 64</div><div>frame #10: 0x00007fcb71bd9175 libpthread.so.0`__pthread_exit + 37</div><div>frame #11: 0x0000000000400ac0 threads`main + 195 at threads.cpp:31</div><div>frame #12: 0x00007fcb7185bd5d libc.so.6`__libc_start_main + 253</div><div>frame #13: 0x00000000004008f9 threads</div><div><Listener> Exiting listener thread</div></div><div><br></div><div><b>=========================Inferior</b><b>=========================</b></div><div><div>#include <iostream></div><div>#include <cstdlib></div><div>#include <pthread.h></div><div><br></div><div>using namespace std;</div><div><br></div><div>#define NUM_THREADS 1</div><div><br></div><div>void *PrintHello(void *threadid)</div><div>{</div><div> long tid;</div><div> tid = (long)threadid;</div><div> cout << "Hello World! Thread ID, " << tid << endl;</div><div> pthread_exit(NULL);</div><div>}</div><div><br></div><div>int main ()</div><div>{</div><div> pthread_t threads[NUM_THREADS];</div><div> int rc;</div><div> int i;</div><div> for( i=0; i < NUM_THREADS; i++ ){</div><div> cout << "main() : creating thread, " << i << endl;</div><div> rc = pthread_create(&threads[i], NULL,</div><div> PrintHello, (void *)i);</div><div> if (rc){</div><div> cout << "Error:unable to create thread," << rc << endl;</div><div> exit(-1);</div><div> }</div><div> }</div><div> pthread_exit(NULL);</div><div>}</div><div><br></div></div><div><b>=========================</b><b>LLDB python automation code</b><b>=========================</b></div><div>main.py</div><div><br></div><div><div># Should be first for LLDB package to be added to search path.</div><div>from find_lldb import lldb</div><div>import sys</div><div>import os</div><div>import time</div><div>from sys import stdin, stdout</div><div>from event_thread import LLDBListenerThread</div><div>import threading</div><div><br></div><div>def wait_for_process_run_then_stop(running_signal, stopped_signal):</div><div> print 'running_signal wait'</div><div> running_signal.wait()</div><div> running_signal.clear()</div><div> print 'stopped_signal wait'</div><div> stopped_signal.wait()</div><div> stopped_signal.clear()</div><div><br></div><div>def do_test():</div><div> debugger = lldb.SBDebugger.Create()</div><div> debugger.SetAsync(True)</div><div> executable_path = '~/personal/cpp/temp/threads'</div><div> target = debugger.CreateTargetWithFileAndArch(executable_path, lldb.LLDB_ARCH_DEFAULT)</div><div> target.BreakpointCreateByName('PrintHello')</div><div><br></div><div> listener = lldb.SBListener('Event Listener')</div><div> error = lldb.SBError()</div><div> process = target.Launch (listener,</div><div> None, # argv</div><div> None, # envp</div><div> None, # stdin_path</div><div> None, # stdout_path</div><div> None, # stderr_path</div><div> None, # working directory</div><div> 0, # launch flags</div><div> False, # Stop at entry</div><div> error) # error</div><div> print 'Launch result: %s' % str(error)</div><div><br></div><div> running_signal = threading.Event()</div><div> stopped_signal = threading.Event()</div><div> running_signal.set()</div><div> event_thread = LLDBListenerThread(debugger, running_signal, stopped_signal)</div><div> event_thread.start()</div><div><br></div><div> wait_for_process_run_then_stop(running_signal, stopped_signal)</div><div><br></div><div> print 'after wait_for_process_run_then_stop'</div><div> activeThread = process.GetSelectedThread()</div><div> for frame in activeThread.frames:</div><div> print frame</div><div><br></div><div> event_thread.should_quit = True</div><div> event_thread.join()</div><div><br></div><div> lldb.SBDebugger.Destroy(debugger)</div><div> return debugger</div><div><br></div><div>def main():</div><div> debugger = do_test()</div><div><br></div><div>if __name__ == '__main__':</div><div> main()</div></div><div><br></div><div><br></div><div>===========event_thread.py============</div><div><br></div><div><div>import lldb</div><div>from threading import Thread</div><div>from sys import stdout</div><div>import thread</div><div>import threading</div><div><br></div><div>target_event_type_to_name_map = {</div><div> lldb.SBTarget.eBroadcastBitBreakpointChanged: 'BreakpointChanged',</div><div> lldb.SBTarget.eBroadcastBitWatchpointChanged: 'WatchpointChanged',</div><div> lldb.SBTarget.eBroadcastBitModulesLoaded: 'ModulesLoaded',</div><div> lldb.SBTarget.eBroadcastBitModulesUnloaded: 'ModulesUnloaded',</div><div> lldb.SBTarget.eBroadcastBitSymbolsLoaded: 'SymbolsLoaded',</div><div>}</div><div><br></div><div>process_event_type_to_name_map = {</div><div> lldb.SBProcess.eBroadcastBitStateChanged: 'StateChanged',</div><div> lldb.SBProcess.eBroadcastBitSTDOUT: 'Stdout',</div><div> lldb.SBProcess.eBroadcastBitSTDERR: 'Stderr',</div><div> lldb.SBProcess.eBroadcastBitInterrupt: 'Interupt',</div><div>}</div><div><br></div><div>breakpoint_event_type_to_name_map = {</div><div> lldb.eBreakpointEventTypeAdded: 'Added',</div><div> lldb.eBreakpointEventTypeCommandChanged: 'Command Changed',</div><div> lldb.eBreakpointEventTypeConditionChanged: 'Condition Changed',</div><div> lldb.eBreakpointEventTypeDisabled: 'Disabled',</div><div> lldb.eBreakpointEventTypeEnabled: 'Enabled',</div><div> lldb.eBreakpointEventTypeIgnoreChanged: 'Ignore Changed',</div><div> lldb.eBreakpointEventTypeInvalidType: 'Invalid Type',</div><div> lldb.eBreakpointEventTypeLocationsAdded: 'Location Added',</div><div> lldb.eBreakpointEventTypeLocationsRemoved: 'Location Removed',</div><div> lldb.eBreakpointEventTypeLocationsResolved: 'Location Resolved',</div><div> lldb.eBreakpointEventTypeRemoved: 'Removed',</div><div> lldb.eBreakpointEventTypeThreadChanged: 'Thread Changed',</div><div>}</div><div><br></div><div>process_state_name_map = {</div><div> lldb.eStateRunning: 'Running',</div><div> lldb.eStateStepping: 'Stepping',</div><div> lldb.eStateAttaching: 'Attaching',</div><div> lldb.eStateConnected: 'Connected',</div><div> lldb.eStateCrashed: 'Crashed',</div><div> lldb.eStateDetached: 'Detached',</div><div> lldb.eStateExited: 'Exited',</div><div> lldb.eStateInvalid: 'Invalid',</div><div> lldb.eStateLaunching: 'Launching',</div><div> lldb.eStateStopped: 'Stopped',</div><div> lldb.eStateSuspended: 'Suspended',</div><div> lldb.eStateUnloaded: 'Unloaded',</div><div>}</div><div><br></div><div><br></div><div>class LLDBListenerThread(Thread):</div><div> should_quit = False</div><div><br></div><div> def __init__(self, debugger, running_signal=None, stopped_sigal=None):</div><div> Thread.__init__(self)</div><div> self._running_signal = running_signal</div><div> self._stopped_sigal = stopped_sigal</div><div> process = debugger.GetSelectedTarget().process</div><div> self.listener = debugger.GetListener()</div><div> self._add_listener_to_process(process)</div><div> self._add_listener_to_target(process.target)</div><div><br></div><div> '''self.listener.StartListeningForEventClass(debugger, lldb.SBTarget.GetBroadcasterClassName(),</div><div> lldb.SBTarget.eBroadcastBitBreakpointChanged |</div><div> lldb.SBTarget.eBroadcastBitWatchpointChanged |</div><div> lldb.SBTarget.eBroadcastBitModulesLoaded |</div><div> lldb.SBTarget.eBroadcastBitModulesUnloaded |</div><div> lldb.SBTarget.eBroadcastBitSymbolsLoaded)</div><div> self.listener.StartListeningForEventClass(debugger, lldb.SBProcess.GetBroadcasterClassName(),</div><div> lldb.SBProcess.eBroadcastBitStateChanged |</div><div> lldb.SBProcess.eBroadcastBitSTDOUT |</div><div> lldb.SBProcess.eBroadcastBitSTDERR |</div><div> lldb.SBProcess.eBroadcastBitInterrupt)'''</div><div> '''self.listener.StartListeningForEventClass(debugger, lldb.SBThread.GetBroadcasterClassName(),</div><div> lldb.SBThread.eBroadcastBitStackChanged | lldb.SBThread.eBroadcastBitThreadSuspended |</div><div> lldb.SBThread.eBroadcastBitThreadResumed | lldb.SBThread.eBroadcastBitSelectedFrameChanged | lldb.SBThread.eBroadcastBitThreadSelected)'''</div><div><br></div><div> def _add_listener_to_target(self, target):</div><div> # Listen for breakpoint/watchpoint events (Added/Removed/Disabled/etc).</div><div> broadcaster = target.GetBroadcaster()</div><div> mask = lldb.SBTarget.eBroadcastBitBreakpointChanged | lldb.SBTarget.eBroadcastBitWatchpointChanged | lldb.SBTarget.eBroadcastBitModulesLoaded</div><div> broadcaster.AddListener(self.listener, mask)</div><div><br></div><div> def _add_listener_to_process(self, process):</div><div> # Listen for process events (Start/Stop/Interrupt/etc).</div><div> broadcaster = process.GetBroadcaster()</div><div> mask = lldb.SBProcess.eBroadcastBitStateChanged | lldb.SBProcess.eBroadcastBitSTDOUT | lldb.SBProcess.eBroadcastBitSTDERR | lldb.SBProcess.eBroadcastBitInterrupt</div><div> broadcaster.AddListener(self.listener, mask)</div><div><br></div><div> def run(self):</div><div> print '<Listener> Listening Thread ID: %d' % thread.get_ident()</div><div> while not self.should_quit:</div><div> event = lldb.SBEvent()</div><div> if self.listener.WaitForEvent(1, event):</div><div> if lldb.SBTarget.EventIsTargetEvent(event):</div><div> self._handle_target_event(event)</div><div> elif lldb.SBProcess.EventIsProcessEvent(event):</div><div> self._handle_process_event(event)</div><div> elif lldb.SBBreakpoint.EventIsBreakpointEvent(event):</div><div> self._handle_breakpoint_event(event)</div><div> elif lldb.SBThread.EventIsThreadEvent(event):</div><div> self._handle_thread_event(event)</div><div> else:</div><div> self._handle_unknown_event(event)</div><div> print '<Listener> Exiting listener thread'</div><div><br></div><div> def _handle_target_event(self, event):</div><div> event_type = event.GetType()</div><div> print 'Target event: %s' % target_event_type_to_name_map[event_type]</div><div><br></div><div> def _handle_process_event(self, event):</div><div> if lldb.SBProcess.GetRestartedFromEvent(event):</div><div> print 'Non stopping event: %s' % str(event)</div><div> return</div><div> process = lldb.SBProcess.GetProcessFromEvent(event)</div><div> event_type = event.GetType()</div><div> print 'Process event: %s, %s' % (process_event_type_to_name_map[event_type], process_state_name_map[process.state])</div><div> if process.state == lldb.eStateExited:</div><div> self.should_quit = True</div><div> elif process.state == lldb.eStateStopped:</div><div> if self._stopped_sigal:</div><div> self._stopped_sigal.set()</div><div> else:</div><div> if self._running_signal:</div><div> self._running_signal.set()</div><div><br></div><div> thread = process.selected_thread</div><div> print 'Stop reason: %d' % thread.GetStopReason()</div><div> if event_type == lldb.SBProcess.eBroadcastBitSTDOUT:</div><div> print 'Stdout:'</div><div> while True:</div><div> output = process.GetSTDOUT(1024)</div><div> if output is None or len(output) == 0:</div><div> break</div><div> stdout.write(output)</div><div><br></div><div> def _handle_breakpoint_event(self, event):</div><div> breakpoint = lldb.SBBreakpoint.GetBreakpointFromEvent(event)</div><div> event_type = lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(event)</div><div> print 'Breakpoint event: [%s] %s ' % (</div><div> breakpoint_event_type_to_name_map[event_type],</div><div> self._get_description_from_object(breakpoint))</div><div><br></div><div> def _handle_unknown_event(self, event):</div><div> print('Unknown event: %d %s %s' % (</div><div> event.GetType(),</div><div> lldb.SBEvent.GetCStringFromEvent(event),</div><div> self._get_description_from_object(event)))</div><div><br></div><div> def _get_description_from_object(self, lldb_object):</div><div> description_stream = lldb.SBStream()</div><div> lldb_object.GetDescription(description_stream)</div><div> return description_stream.GetData()</div></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 20, 2016 at 7:10 AM, Pavel Labath <span dir="ltr"><<a href="mailto:labath@google.com" target="_blank">labath@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you send me a small repro case, I can try to look at why is Linux<br>
different here.<br>
<br>
On 19 March 2016 at 00:46, Jim Ingham via lldb-dev<br>
<div class="HOEnZb"><div class="h5"><<a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a>> wrote:<br>
> All this logic is handled in Process::HandleProcessStateChangedEvent (see around line 1215 in Process.cpp) You shouldn’t have to reimplement the logic for setting the selected thread unless you don’t like our heuristics. Note, that’s in generic code, so I don’t know why it wouldn’t be working right on Linux.<br>
><br>
> Jim<br>
><br>
>> On Mar 18, 2016, at 5:38 PM, Greg Clayton <<a href="mailto:gclayton@apple.com">gclayton@apple.com</a>> wrote:<br>
>><br>
>> It is really up to the IDE to decide this so the logic belongs in your IDE. We do things as follows:<br>
>><br>
>> If no thread was selected before, display the first thread that has a stop reason other than none. If no threads have stop reasons, select the first thread. If a thread was selected before, then see if that same thread is stopped with a reason the next time you stop and select that one, regardless if it is the first thread with a stop reason. The idea is, if you were stepping or doing something in a thread, and then stop again, you don't want the IDE changing away from your current thread if this thread has a stop reason. If this thread doesn't have a stop reason, then select the first one that does. If not threads have stop reasons, then display the same thread as before.<br>
>><br>
>>> On Mar 18, 2016, at 5:23 PM, Jeffrey Tan via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a>> wrote:<br>
>>><br>
>>> Thanks for the info. I understand the multiple threads stopping at the same time issue. But I would think we should at least pick one stopped thread and set it as selected thread instead of some random thread with stop reason None. Also, in my repro case, there is only one thread that has stop reason, so the heuristics should be pretty trivial to set selected thread to that one.<br>
>>> I have workaround this issue with the suggestion but I think there is a bug(on Linux) here.<br>
>>><br>
>>> On Fri, Mar 18, 2016 at 4:40 PM, Jim Ingham <<a href="mailto:jingham@apple.com">jingham@apple.com</a>> wrote:<br>
>>> On many platforms (OS X for sure) there’s no guarantee that when you stop you will only have hit one breakpoint on one thread. On OS X in multithreaded programs, it is not at all uncommon to have many threads hit breakpoint(s) by the the time the stop gets reported. So you just have to iterate over all the threads and see what their stop reasons are. Note that it isn’t just breakpoints, you might have been stepping on thread A, and when you stop, thread A will have stopped with “plan complete” for the step operation, and thread B for some other breakpoint.<br>
>>><br>
>>> So when you get a stop event you have to iterate over the threads and see why they have stopped.<br>
>>><br>
>>> LLDB will set one of the threads as the selected thread, using some heuristics (if you were stepping on thread A & threads A & B stopped with breakpoints, thread A will be the selected thread, etc…) So you could just show the selected thread, but really you want to figure out what all the threads are doing.<br>
>>><br>
>>> Jim<br>
>>><br>
>>>> On Mar 18, 2016, at 4:25 PM, Jeffrey Tan <<a href="mailto:jeffrey.fudan@gmail.com">jeffrey.fudan@gmail.com</a>> wrote:<br>
>>>><br>
>>>><br>
>>>> Hmm, interesting, I got the stop reason from the lldb.SBProcess.GetProcessFromEvent(event).GetSelectedThread().GetStopReason(). Is that thread not the one that stopped? But you are right, the breakpoint hits in another thread:<br>
>>>><br>
>>>> thread #87: tid = 1006769, 0x000000000042eacd biggrep_master_server_async`facebook::biggrep::BigGrepMasterAsync::future_find(this=0x00007f3ea2d74fd0, corpus=error: summary string parsing error, needle=error: summary string parsing error, options=0x00007f3e899fc7e0) + 51 at BigGrepMasterAsync.cpp:171, name = 'BigGrep-pri3-32', stop reason = breakpoint 1.1<br>
>>>><br>
>>>> How do I know which thread hits the breakpoint?<br>
>>>><br>
>>>> Jeffrey<br>
>>>><br>
>>>><br>
>>>> On Fri, Mar 18, 2016 at 4:12 PM, Jim Ingham <<a href="mailto:jingham@apple.com">jingham@apple.com</a>> wrote:<br>
>>>> You only show one thread in your example. Did another thread have a valid stop reason? lldb shouldn’t be stopping for no reason anywhere…<br>
>>>><br>
>>>> Jim<br>
>>>><br>
>>>>> On Mar 18, 2016, at 4:08 PM, Jeffrey Tan via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a>> wrote:<br>
>>>>><br>
>>>>> Btw: the breakpoint I set is:<br>
>>>>> "b BigGrepMasterAsync.cpp:171" which is not in any of the stopped stack frames.<br>
>>>>><br>
>>>>> On Fri, Mar 18, 2016 at 3:47 PM, Jeffrey Tan <<a href="mailto:jeffrey.fudan@gmail.com">jeffrey.fudan@gmail.com</a>> wrote:<br>
>>>>> Hi,<br>
>>>>><br>
>>>>> Our IDE(wrapping lldb using python) works fine on Linux for simple hello world cases. While trying a real world case, I found whenever we set a source line breakpoint, then trigger the code path, lldb will send a stopped state process event, with thread.GetStopReason() being None and with weird callstack. Any ideas why do I get this stop stack(code is listed at the end)? I have verified that if I do not set breakpoint and trigger the same code path does not cause this stop event to generate.<br>
>>>>><br>
>>>>> bt<br>
>>>>> * thread #1: tid = 952490, 0x00007fd7cb2daa83 libc.so.6`__GI_epoll_wait + 51, name = 'biggrep_master_'<br>
>>>>> * frame #0: 0x00007fd7cb2daa83 libc.so.6`__GI_epoll_wait + 51<br>
>>>>> frame #1: 0x000000000271189f biggrep_master_server_async`epoll_dispatch(base=0x00007fd7ca970800, arg=0x00007fd7ca62c1e0, tv=<unavailable>) + 127 at epoll.c:315<br>
>>>>> frame #2: 0x000000000270f6d1 biggrep_master_server_async`event_base_loop(base=0x00007fd7ca970800, flags=<unavailable>) + 225 at event.c:524<br>
>>>>> frame #3: 0x00000000025f9378 biggrep_master_server_async`folly::EventBase::loopBody(this=0x00007fd7ca945180, flags=0) + 834 at EventBase.cpp:335<br>
>>>>> frame #4: 0x00000000025f900b biggrep_master_server_async`folly::EventBase::loop(this=0x00007fd7ca945180) + 29 at EventBase.cpp:287<br>
>>>>> frame #5: 0x00000000025fa053 biggrep_master_server_async`folly::EventBase::loopForever(this=0x00007fd7ca945180) + 109 at EventBase.cpp:435<br>
>>>>> frame #6: 0x0000000001e24b72 biggrep_master_server_async`apache::thrift::ThriftServer::serve(this=0x00007fd7ca96d710) + 110 at ThriftServer.cpp:365<br>
>>>>> frame #7: 0x00000000004906bc biggrep_master_server_async`facebook::services::ServiceFramework::startFramework(this=0x00007ffc06776140, waitUntilStop=true) + 1942 at ServiceFramework.cpp:885<br>
>>>>> frame #8: 0x000000000048fe6d biggrep_master_server_async`facebook::services::ServiceFramework::go(this=0x00007ffc06776140, waitUntilStop=true) + 35 at ServiceFramework.cpp:775<br>
>>>>> frame #9: 0x00000000004219a7 biggrep_master_server_async`main(argc=1, argv=0x00007ffc067769d8) + 2306 at BigGrepMasterServerAsync.cpp:134<br>
>>>>> frame #10: 0x00007fd7cb1ed0f6 libc.so.6`__libc_start_main + 246<br>
>>>>> frame #11: 0x0000000000420bfc biggrep_master_server_async`_start + 41 at start.S:122<br>
>>>>><br>
>>>>> Here is the code snippet of handling code:<br>
>>>>> def _handle_process_event(self, event):<br>
>>>>> # Ignore non-stopping events.<br>
>>>>> if lldb.SBProcess.GetRestartedFromEvent(event):<br>
>>>>> log_debug('Non stopping event: %s' % str(event))<br>
>>>>> return<br>
>>>>><br>
>>>>> process = lldb.SBProcess.GetProcessFromEvent(event)<br>
>>>>> if process.state == lldb.eStateStopped:<br>
>>>>> self._send_paused_notification(process)<br>
>>>>> elif process.state == lldb.eStateExited:<br>
>>>>> exit_message = 'Process(%d) exited with: %u' % (<br>
>>>>> process.GetProcessID(),<br>
>>>>> process.GetExitStatus())<br>
>>>>> if process.GetExitDescription():<br>
>>>>> exit_message += (', ' + process.GetExitDescription())<br>
>>>>> self._send_user_output('log', exit_message)<br>
>>>>> self.should_quit = True<br>
>>>>> else:<br>
>>>>> self._send_notification('Debugger.resumed', None)<br>
>>>>><br>
>>>>> event_type = event.GetType()<br>
>>>>> if event_type == lldb.SBProcess.eBroadcastBitSTDOUT:<br>
>>>>> # Read stdout from inferior.<br>
>>>>> process_output = ''<br>
>>>>> while True:<br>
>>>>> output_part = process.GetSTDOUT(1024)<br>
>>>>> if not output_part or len(output_part) == 0:<br>
>>>>> break<br>
>>>>> process_output += output_part<br>
>>>>> self._send_user_output('log', process_output)<br>
>>>>><br>
>>>>> _______________________________________________<br>
>>>>> lldb-dev mailing list<br>
>>>>> <a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a><br>
>>>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
>>>><br>
>>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> lldb-dev mailing list<br>
>>> <a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a><br>
>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
>><br>
><br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
</div></div></blockquote></div><br></div>