<div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px">Hi,</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I have a small script to debug a program in OSX that looks more or less like this:<br>
<br>debugger = lldb.SBDebugger.Create()<br>target = debugger.CreateTargetWithFileAndArch(exe, lldb.LLDB_ARCH_DEFAULT_64BIT)<br>launch_info = lldb.SBLaunchInfo(args)<br>launch_info.SetLaunchFlags(lldb.eLaunchFlagNone)<br>error = lldb.SBError()<br>
process = target.Launch(launch_info, error)<br>if not error.Success():<br>    print args, str(error)<br>    return<br><br>listener = lldb.SBListener("event_listener")<br>process.GetBroadcaster().AddListener(listener, lldb.SBProcess.eBroadcastBitStateChanged)<br>
done = 0<br>while not done:<br>    event = lldb.SBEvent()<br>    if listener.WaitForEvent(10, event):<br>      state = lldb.SBProcess.GetStateFromEvent(event)<br>      print state<br>      for thread in process:<br>        print thread, thread.GetFrameAtIndex(0)<br>
      process.Continue()<br>    else:<br>      done = 1<br><br>My intention is to debug the target with some kind of timeout, that's why I'm trying to use the async mode and use the timeout in WaitForEvent(). The problem that I'm facing is that once WaitForEvent() succeeds, there's no way I can get access to the thread information (for example to get frame info for each thread). This is the output from the script:<br>
<br>5<br>SBThread: tid = 0x2b9672 No value<br>SBThread: tid = 0x2b9686 No value<br>SBThread: tid = 0x2b9687 No value<br>SBThread: tid = 0x2b9689 No value</div><span style="font-family:arial,sans-serif;font-size:13px">SBThread: tid = 0x2b968a No value</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">SBThread: tid = 0x2b96be No value</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">SBThread: tid = 0x2b96bf No value</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">SBThread: tid = 0x2b96c0 No value</span><br style="font-family:arial,sans-serif;font-size:13px"><div style="font-family:arial,sans-serif;font-size:13px"><br></div>
<div style="font-family:arial,sans-serif;font-size:13px">This is for the lldb version that comes with XCode (<span style="font-family:arial;font-size:small">lldb-300.2.53)</span></div>







<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Any ideas? Is there anything wrong with my approach?</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Thanks,</div><div style="font-family:arial,sans-serif;font-size:13px">HG</div></div>