-
Notifications
You must be signed in to change notification settings - Fork 53
LLDB 正则表达式断点
jiaxw32 edited this page Jan 6, 2021
·
3 revisions
匹配 UIImagePickerController
的所有方法
breakpoint set -r '\[UIImagePickerController .*\]$'
上述断点包括类方法与实例方法,但不括父类方法
正则表达式说明:
-
\
为转义字符,用于匹配一些保留的字符,如:[ ] ( ) { } . * + ? ^ $ \ |
-
.
句号匹配除换行符的任意单个字符 -
*
匹配>=0个重复的在*
号之前的字符 -
$
匹配字符串结束
使用 br list
查看断点,效果如下图:

如果要包括父类方法,可以使用条件语句,如下:
br s -r '\[UIViewController .*\]$' -c '(BOOL)[(id)$arg1 isKindOfClass:[CustomVC class]]’
br s -r "\+\[.+ load\]$"
-
.
匹配任意单个字符,但不匹配换行符 -
+
号匹配+号之前的字符出现 >=1 次
br list
查看结果如下所示:
(lldb) br list
Current breakpoints:
14: regex = '\+\[.+ load\]$', locations = 515, resolved = 515, hit count = 0