获取 LLDB 断点中的方法名称和选择器
Get method name and selectors in LLDB breakpoint
我在 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]) [=11=] = "void $__lldb_expr(void *)"
(lldb) continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb) p __PRETTY_FUNCTION__
(const char [47]) = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb) continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb) p __PRETTY_FUNCTION__
(const char [47]) = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb) continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb) p __PRETTY_FUNCTION__
(const char [47]) = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb) continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb) p __PRETTY_FUNCTION__
(const char [47]) = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb) continue
问题是如何使用方法名称及其选择器的实际值删除 $__lldb_category
和 $__lldb_expr:
?
我会使用 lldb 命令打印此信息,例如:
(lldb) frame info
frame #0: 0x0000000100018dc7 Sketch`main(argc=1, argv=0x00007fff5fbff628) + 55 at SKTMain.m:17
我会做你想做的事。如果您想要更多或更少的信息,您还可以按照此处所述定制帧信息的输出:
我在 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]) [=11=] = "void $__lldb_expr(void *)"
(lldb) continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb) p __PRETTY_FUNCTION__
(const char [47]) = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb) continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb) p __PRETTY_FUNCTION__
(const char [47]) = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb) continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb) p __PRETTY_FUNCTION__
(const char [47]) = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb) continue
Process 96238 resuming
Command #1 'continue' continued the target.
(lldb) p __PRETTY_FUNCTION__
(const char [47]) = "-[AppDelegate($__lldb_category) $__lldb_expr:]"
(lldb) continue
问题是如何使用方法名称及其选择器的实际值删除 $__lldb_category
和 $__lldb_expr:
?
我会使用 lldb 命令打印此信息,例如:
(lldb) frame info
frame #0: 0x0000000100018dc7 Sketch`main(argc=1, argv=0x00007fff5fbff628) + 55 at SKTMain.m:17
我会做你想做的事。如果您想要更多或更少的信息,您还可以按照此处所述定制帧信息的输出: