我在-[CALayer setSpeed:]上设置一个符号断点,我希望只有当函数被分隔函数调用时才触发断点
-[UIPercentDrivenInteractiveTransition _updateInteractiveTransition:percent:isFinished:didComplete:]
有办法这样做吗?
通过执行bt 2,我可以手动看到调用函数的值。是否有某种方法可以在断点条件中与此输出执行字符串比较?
谢谢!
发布于 2015-01-08 22:50:45
您可以在断点上使用一些python脚本来完成这一任务。这意味着,每次命中断点时,lldb将停止进程并恢复它--对于像objc_msgSend这样的非常热门的函数,这将极大地影响性能。
在您的homedir中创建一个python函数,如~/lldb/stopifcaller.py,其中包含以下内容
import lldb
def stop_if_caller(current_frame, function_of_interest):
thread = current_frame.GetThread()
if thread.GetNumFrames() > 1:
if thread.GetFrameAtIndex(1).GetFunctionName() != function_of_interest:
thread.GetProcess().Continue()然后放
command script import ~/lldb/stopifcaller.py在~/.lldbinit文件中。
在lldb中这样使用它:
(lldb) br s -n bar
Breakpoint 1: where = a.out`bar + 15 at a.c:5, address = 0x0000000100000e7f
(lldb) br comm add --script-type python -o "stopifcaller.stop_if_caller(frame, 'foo')" 1这样就完成了--只有当调用方帧是foo()时,断点1(在foo()上)才会停止。或者换个说法,如果调用方帧不是foo(),它就会继续。
https://stackoverflow.com/questions/27849384
复制相似问题