Op 19-10-2012 20:26, Bill Terwilliger schreef:
Hi,
I'm having trouble using breakpoints with the python API... My script creates a
bunch of breakpoints (by address), launches the target and then goes into an
infinite loop checking 'process.GetState()'. The scripts checks for a state of
'eStateStopped', and then iterates through the threads until it finds a thread
stop reason of 'eStopReasonBreakpoint'. The issue with that approach is that I
can't figure out which breakpoint triggered the thread to stop. So I guess I
have two questions, (1) how do I use SetCallback() to call a method when a
breakpoint is triggered and (2) if I know which thread hit my breakpoint, how
do I know which SBBreakpoint triggered?
BTW, I looked through all of the unit test for examples of how to do this but
all I could find was a call to SetCallback(None, None). The documentation for
SBBreakpoint gives a prototype of SetCallback(BreakpointHitCallback callback,
void baton) but BreakpointHitCallback doesn't appear to be documented in the
python docs.
Any help would be greatly appreciated. :-)
There's an events sample for python. Essentially you have a thread
waiting for events on a listener, the wait call returns and the SBEvent
you get then can be retrieved:
SBEvent data;
while (!stop) {
if (self->m_listener.WaitForEvent(UINT32_MAX, data)) {
if (data.getType() == SBProcess::eBroadcastBitStateChanged &&
m_process.GetStateFromEvent (data) == eStateStopped) {
SBThread th = m_process.GetSelectedThread();
if (th.GetStopReason() == eStopReasonBreakpoint) {
// th.GetStopReasonDataAtIndex(0) should have the breakpoint id
}
}
}
}
something like that
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev