iOS Developer自己看的文章实用工具

断点远比你想象中的强大 -- LLDB BreakPoint 设

2018-05-31  本文已影响104人  sqatm

这里介绍一下LLDB中关于断点的强大功能的冰山一角,有兴趣的话直接在LLDB中输入help就会有详细的说明文档。这里只举例一些经常用到的。

根据函数名称

OC方法

给ViewController类中的 -touchesBegan:withEven: 方法添加断点


image

输入后回车,如果添加成功则会出现下面的提示:


image

然后如果真的成功了,你会发现即使把断点的标志置灰仍然会断主:


image

C方法


image
根据行数
根据物理地址(反汇编用到,有时候调整BAD_EXC用到)
根据函数全名设置断点(非常有用,这个是一般打断点无法比拟的)

*注:这里因为一次性打了两个端点,所以显示的 Breakpint 1:2 locations。意思是添加了组号为1的断点组,这组里包含两个断点。

根据局部函数全名设置断点
常用的配置项

-i <count> ( --ignore-count <count> )
Set the number of times this breakpoint is skipped before stopping.

image

这里设置了跳跃2次,可以看出前两次是没有断住的。

-o <boolean> ( --one-shot <boolean> )
The breakpoint is deleted the first time it stop causes a stop.

image

-c <expr> ( --condition <expr> )
The breakpoint stops only if this condition expression evaluates to
true.

断点条件是简单语句:


image

断点条件是OC语句:


image
多条件断点:
image

-N <breakpoint-name> ( --breakpoint-name <breakpoint-name> )
Adds this to the list of names for this breakpoint.

image
上一篇 下一篇

猜你喜欢

热点阅读