我在lldb中添加一个断点,如下所示:
(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
我的目标是打印我的应用程序中调用的每个方法。结果如下:
(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
问题是如何使用方法名称及其选择器的实际值删除$__lldb_category
和$__lldb_expr:
?
答案 0 :(得分:1)
我会使用lldb命令打印此信息,例如:
(lldb) frame info
frame #0: 0x0000000100018dc7 Sketch`main(argc=1, argv=0x00007fff5fbff628) + 55 at SKTMain.m:17
会做你想要的我想的。如果您想要更多或更少的信息,您还可以定制帧信息的输出,如下所述: