1、下断点
breakpoint set --name test1
或
breakpoint set -n test1
打印:
Breakpoint 2: where = LLDB`-[ViewController test1] + 23 at ViewController.m:25:5, address = 0x0000000109de9f97
断点位置信息,执行便能在该处断住。
连续下多个断点:
breakpoint set -n "-[ViewController save:]" -n "-[ViewController pause:]" -n "-[ViewController continues:]"
运行c继续运行。
2、查看断点列表
breakpoint list
打印:
1: file = '/Users/hibo/Documents/test/LLDB/LLDB/ViewController.m', line = 21, exact_match = 0, locations = 1 Options: disabled
1.1: where = LLDB`-[ViewController touchesBegan:withEvent:] + 70 at ViewController.m:22:6, address = 0x0000000109de9f46, unresolved, hit count = 2 Options: disabled
2: name = 'test1', locations = 1, resolved = 1, hit count = 7
2.1: where = LLDB`-[ViewController test1] + 23 at ViewController.m:25:5, address = 0x0000000109de9f97, resolved, hit count = 7
3、禁用断点
breakpoint disable //禁用所有断点
breakpoint disable 1.1 //禁用第一个断点
4、启用断点
breakpoint enable //启用所有断点
breakpoint enable 1.1 //启用1处断点
5、删除所有断点
breakpoint delete
breakpoint delete 1
删除只能删除一组,不能单个删除
6、设置selector
breakpoint set --selector touchesBegan:withEvent:
将为所有该方法设置断点
7、设置文件中的selector断点
breakpoint set --file ViewController.m --selector touchesBegan:withEvent:
8、设置带有相同字符串的方法断点
breakpoint set -r Game:
打印:
Current breakpoints:
1: regex = 'Game:', locations = 3, resolved = 3, hit count = 0
1.1: where = LLDB`-[ViewController pauseGame:] + 43 at ViewController.m:31:5, address = 0x00000001010dff0b, resolved, hit count = 0
1.2: where = LLDB`-[ViewController continueGame:] + 43 at ViewController.m:34:5, address = 0x00000001010dff5b, resolved, hit count = 0
1.3: where = LinkPresentation`-[LPGameCenterInvitationMetadata setGame:], address = 0x00007fff2733e5e9, resolved, hit count = 0
如上也给其他带有Game字符的类下了断点
给某一个文件下的带有相同字符串的方法下断点:
breakpoint set --file ViewController.m -r Game
简写:breakpoint->b
打印列表需要写全:
breakpoint list
或者
break list