Each time a thread stops, it either has a reason for stopping (breakpoint,
watchpoint, exception, etc), or it doesn't (just stopped because other threads
stopped).
You will need to check the thread stop reason for each thread when a process
stops. Below the code will check for
process = ...
for thread in process:
if thread.GetStopReason() == lldb.eStopReasonException:
if thread.GetStopReasonDataAtIndex(0) == 1: # EXC_BAD_ACCESS
stop_description = thread.GetStopDescription()
print "got EXC_BAD_ACCESS on thread %s: %s" % (thread,
stop_description)
EXC_BAD_ACCESS isn't represented as a mach exception, it is just represented as
an exception that has data. The "stop_description" should contain
EXC_BAD_ACCESS in the text for mach based platforms, but really we just want
the user to know that an exception happened and to be able to get to any data
the exception generates on the current system.
thread.GetStopReasonDataAtIndex(<index>) will return data for the exception
like the address and any other data that the system returns. So this is an
abstract way to represent exceptions on any system, yet still get to the
underlying data.
Greg
On Jan 31, 2014, at 10:24 PM, Jun Koi <[email protected]> wrote:
> hi,
>
> i am writing some simple Python script to intercept EXC_BAD_ACCESS error. i
> only know "stop-hook" that can be used to intercept breakpoint, but have no
> idea how to intercept EXC_BAD_ACCESS.
>
> any hint please?
>
> thanks.
> Jun
>
> _______________________________________________
> lldb-dev mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev