iOS调试

351 阅读1分钟

LLDB调试 lldb.llvm.org/use/map.htm…

Swift LLDB调试 medium.com/flawless-ap…

llvm.org/svn/llvm-pr…

1.chisel

截屏2020-10-26 下午8.44.45.png

2 bclass

command regex bclass 's/(.+)/rb \[%1 /'

最终 .lldbinit文件内容为:

command script import /usr/local/opt/chisel/libexec/fbchisellldb.py
command regex bclass 's/(.+)/rb \[%1 /'

方法匹配:

breakpoint set --selector 方法名
或:br s -S 方法名

函数匹配断点:

breakpoint set --func-regex 匹配的方法名
或:br s -r 匹配的方法名

数据断点

参考文档:developer.aliyun.com/article/245…

assassinor.github.io/notes/full-…

设置watchpoint,有以下两种添加watchpoint方法:

watchpoint set variable:为变量设置watchpoint。
watchpoint set expression:通过提供的表达式为地址设置breakpoint。

使用上述命令时,使用—watch(简写为-w)选项指定watchpoint类型,可选类型有read、write和read_write。如果没有指定watchpoint类型,默认为write类型。

使用—size(简写为-s)指定观察的字节大小,可选大小有1、2、4和8。如果没有指定字节大小,默认使用目标指针大小。

数据断点 watchpoint:

可以watch 变量 或者内存地址, 还可以条件watch。

watch变量:watchpoint s variable -w read 变量名

watch地址:watchpoint set expression 0x000000011dc02330

条件watch:  只适用变量?

例如,我们设置了一个变量 watch: watchpoint set variable self->_count

然后将它修改为条件watch(即 _count == 5时断下来): watchpoint modify -c '(_count == 5)'

Watch行为可以为: 读,写,或者 读写。

UI调试

lookin安装:lookin.work/

内存泄漏-内存图

Xcode8新增:Memory Graph解决闭包引用循环问题 www.jianshu.com/p/d8bc3d74d…