这里介绍一下LLDB中关于断点的强大功能的冰山一角,有兴趣的话直接在LLDB中输入help就会有详细的说明文档。这里只举例一些经常用到的。
根据函数名称
- breakpoint set -n 函数名称
OC方法
给ViewController类中的 -touchesBegan:withEven: 方法添加断点
然后如果真的成功了,你会发现即使把断点的标志置灰仍然会断主:
C方法
######根据行数
- breakpoint set -l 行数 -f 文件名
######根据物理地址(反汇编用到,有时候调整BAD_EXC用到)
- breakpoint set -a 16位的物理地址
######根据函数全名设置断点(非常有用,这个是一般打断点无法比拟的)
- breakpoint set -F 函数全名
*注:这里因为一次性打了两个端点,所以显示的 Breakpint 1:2 locations。意思是添加了组号为1的断点组,这组里包含两个断点。
######根据局部函数全名设置断点
- breakpoint set -r 函数局部名称
######常用的配置项
- -i 设置断点忽略次数
-i ( --ignore-count ) Set the number of times this breakpoint is skipped before stopping.
- -o 只断住一次
-o ( --one-shot ) The breakpoint is deleted the first time it stop causes a stop.
- -o 设置断点条件
-c ( --condition ) The breakpoint stops only if this condition expression evaluates to true.
断点条件是简单语句:
- -N 给断点添加别名
-N ( --breakpoint-name ) Adds this to the list of names for this breakpoint.