I've been working on a script to store and fetch stack traces for gcd and I've got it working if I set the symbolic breakpoints manually, but if I set the breakpoints in the script, one of my breakpoints never hits and the command attached to it behaves weirdly:
https://github.com/rustle/LLDBStackStoreFetch This is the function to make the breakpoints in the script def set_dispatch_breakpoints(debugger, command, result, dict): debugger.HandleCommand('breakpoint set -F dispatch_async') breakpointcount = lldb.target.GetNumBreakpoints() debugger.HandleCommand("breakpoint command add -s command {index} -o 'store_stack -a $arg2'".format(index=breakpointcount)) debugger.HandleCommand('breakpoint set -F _dispatch_call_block_and_release') breakpointcount = lldb.target.GetNumBreakpoints() lldb.debugger.HandleCommand("breakpoint command add -s command {index} -o 'print_stack -a $arg1'".format(index=breakpointcount)) The breakpoints get made (using a debugging command on a breakpoint in main to call set_dispatch_breakpoints) (lldb) b breakpoint list --full Current breakpoints: 1: file ='main.m', line = 27, locations = 1, resolved = 1 1.1: where = BlockStack`main + 22 at main.m:27, address = 0x0000000100001c36, resolved, hit count = 1 2: name = 'dispatch_async', locations = 1, resolved = 1 Breakpoint commands: store_stack -a $arg2 2.1: where = libdispatch.dylib`dispatch_async, address = 0x00007fff89753cb5, resolved, hit count = 0 3: name = '_dispatch_call_block_and_release', locations = 1, resolved = 1 Breakpoint commands: print_stack -a $arg1 3.1: where = libdispatch.dylib`_dispatch_call_block_and_release, address = 0x00007fff89751a74, resolved, hit count = 0 and the second break point gets called and the expression looking up the functions argument memory address description works as expected. The third breakpoint never hits, but it's debug command does. The debug command that hits for the third breakpoint resolves a garbage memory address and once it returns the debugger becomes unresponsive. This is all on xcode 4.5 on lion Thanks, Doug Russell
_______________________________________________ lldb-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
