[lldb-dev] C++ API question

jingham at apple.com jingham at apple.com
Wed May 29 17:17:34 PDT 2013


Are you pulling events from the process you've launched?  Various reactions to Process level events get triggered by the event getting pulled from the event queue.  One of these is updating the "public" state of the process in lldb to the state of the event you've just handled.  

So if you just leave events on the event queue, then the "public" state of the process won't get updated and you will see the sort of behavior you are describing.  Instead, you should structure your process handling in a little event loop that reads events from the process and then reacts to each change of state recorded in that event.  Then everything will be sync'ed up when you go to handle the event.

Jim

On May 29, 2013, at 5:07 PM, Sebastien Metrot <meeloo at gmail.com> wrote:

> Hello,
> 
> Now that my build problems are fixed I have started to do a little more than extracting symbols from OSX applications and I have a strange situation. 
> I create a target, add a symbolic breakpoint on 'main', launch the process and then inspect the threads + their stack frames. What troubles me is that I correctly find 1 thread but it always says there is 0 frames, meanwhile calling the method lldb::SBThread::GetStatus(..) and displaying its results correctly shows me what I'm expecting (a stack frame with the breakpoint on my main function). I have tried to step in lldb code and from what I understand GetNumFrames & all return 0 because it says the process is still running as it is unable to get some lock/mutex.
> 
> When I enable logs for API here is what I get:
> LLDB> 1369872253.995728 SBProcess(0x1250bec00)::GetNumThreads () => 1
> LLDB> 1369872253.995767 SBProcess(0x1250bec00)::Stop () => SBError (0x105602010): success
> LLDB> 1369872253.995790 SBProcess(0x1250bec00)::GetThreadAtIndex (index=0) => SBThread(0x110b313d0)
> LLDB> 1369872253.995807 SBThread(0x110b313d0)::GetNumFrames() => error: process is running
> LLDB> 1369872253.995816 SBThread(0x110b313d0)::GetNumFrames () => 0
> LLDB> 1369872253.995826 SBThread(0x110b313d0)::GetStopReason() => error: process is running
> LLDB> 1369872253.995833 SBThread(0x110b313d0)::GetStopReason () => invalid
> LLDB> 1369872253.999252 SBThread(0x110b313d0)::GetName() => error: process is running
> LLDB> 1369872253.999277 SBThread(0x110b313d0)::GetName () => NULL
> 
> I am clearly missing something here but what?
> 
> S.
>  
> -- 
> Sebastien Metrot
> Yasound - CTO - Cofounder
> sebastien at yasound.com
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev




More information about the lldb-dev mailing list