[lldb-dev] problems with async mode in lldb-python script

Hikaru Gosun hgosun at gmail.com
Mon Mar 17 09:29:08 PDT 2014


I have a small script to debug a program in OSX that looks more or less
like this:

debugger = lldb.SBDebugger.Create()
target = debugger.CreateTargetWithFileAndArch(exe,
launch_info = lldb.SBLaunchInfo(args)
error = lldb.SBError()
process = target.Launch(launch_info, error)
if not error.Success():
    print args, str(error)

listener = lldb.SBListener("event_listener")
done = 0
while not done:
    event = lldb.SBEvent()
    if listener.WaitForEvent(10, event):
      state = lldb.SBProcess.GetStateFromEvent(event)
      print state
      for thread in process:
        print thread, thread.GetFrameAtIndex(0)
      done = 1

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:

SBThread: tid = 0x2b9672 No value
SBThread: tid = 0x2b9686 No value
SBThread: tid = 0x2b9687 No value
SBThread: tid = 0x2b9689 No value
SBThread: tid = 0x2b968a No value
SBThread: tid = 0x2b96be No value
SBThread: tid = 0x2b96bf No value
SBThread: tid = 0x2b96c0 No value

This is for the lldb version that comes with XCode (lldb-300.2.53)

Any ideas? Is there anything wrong with my approach?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140317/16f94a6d/attachment.html>

More information about the lldb-dev mailing list