One Quickie


Breaking on a particular caller (lldb->General)
Say that we have a borkFunction, and it's called by greebleFunction and hooverFunction:
    greebleFunction ();
    hooverFunction ();
And say that we want to break when borkFunction is called by hoover, and not by greeble.
(lldb) breakpoint set -n borkFunction
Breakpoint created: 1: name = 'borkFunction', locations = 1

(lldb) breakpoint command add --script-type python 1
Enter your Python command(s). Type 'DONE' to end.
> thread = frame.GetThread()
> caller = thread.GetFrameAtIndex(1)
> if caller.GetFunctionName() != "hooverFunction":
>     process = thread.GetProcess()
>     process.Continue()
> DONE

(lldb) run
greeble!
    bork!
hoover!
Process 9074 stopped
* thread #1: tid = 0x2007, 0x0000000100000dff funcs`borkFunction + 15 at funcs.m:7, 
  stop reason = breakpoint 1.1
...
(lldb) thread backtrace
  frame #0: 0x0000000100000dff funcs`borkFunction + 15 at funcs.m:7
  frame #1: 0x0000000100000e5e funcs`hooverFunction + 30 at funcs.m:19
...



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com