[lldb-dev] Cannot resume process using LLDB API
gclayton at apple.com
Mon Mar 30 10:12:42 PDT 2015
> On Mar 28, 2015, at 10:25 AM, Ziming Song <s.ziming at hotmail.com> wrote:
> Thank you for your detailed explanation.
> My GUI front end is quite simple, and I set the SBDebugger to synchronous mode to make my life easier (`debugger.SetAsync(false)`). Besides, I only use single thread, so every time the API call returns, I can guarantee that I'm not in the middle of executing any other api function.
> For example, the "Resume" button calls `process.Continue()`, when `process.Continue()` returns, we can guarantee that the debuggee is not active executing, so we call another function called `handleDebugEvent` to check its state, if the debugge is in eStateStopped, it grab the current value of local variables and print them in the gui.
> Other buttons works similar, after doing their work, they call `handleDebugEvent` to check state and dispatch event.
> Since I can't find any tutorials on LLDB API besides generated docs, I can only come up with that strategy.
Take a look at:
svn cat http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/process_events.py
This tells you how to handle events correctly. The problem with your approach is you won't be able to interrupt a running process because you will be stuck in process.Continue(), so you really do need to switch over to using an event loop as the python above will show you exactly how to do it.
More information about the lldb-dev