Idr
Idr

Reputation: 6250

Get method name and selectors in LLDB breakpoint

I am adding a breakpoint in lldb like so:

(lldb) breakpoint set -s MyApp --func-regex .
(lldb) breakpoint command add 1
Enter your debugger command(s).  Type 'DONE' to end.
> p __PRETTY_FUNCTION__
> continue
> DONE
(lldb) process attach --name MyApp --waitfor
(lldb) continue

My goal is to print each of the methods called in the my app. The results looks like:

(lldb)  p __PRETTY_FUNCTION__
(const char [26]) $0 = "void $__lldb_expr(void *)"
(lldb)  continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb)  p __PRETTY_FUNCTION__
(const char [47]) $1 = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb)  continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb)  p __PRETTY_FUNCTION__
(const char [47]) $2 = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb)  continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb)  p __PRETTY_FUNCTION__
(const char [47]) $3 = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb)  continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb)  p __PRETTY_FUNCTION__
(const char [47]) $4 = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb)  continue

The question is how do I remove the $__lldb_category and the $__lldb_expr: with the actual values of the method name and it's selectors?

Upvotes: 0

Views: 1563

Answers (1)

Jim Ingham
Jim Ingham

Reputation: 27203

I would use lldb commands to print this information, for instance:

(lldb) frame info
frame #0: 0x0000000100018dc7 Sketch`main(argc=1, argv=0x00007fff5fbff628) + 55 at SKTMain.m:17

would do what you want I think. If you want more or less info, you can also tailor the output of frame info as described here:

http://lldb.llvm.org/formats.html

Upvotes: 1

Related Questions