如何设置每10次触发LLDB断点一次? [英] How can I setup an LLDB breakpoint firing every 10th time?

查看:128
本文介绍了如何设置每10次触发LLDB断点一次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要调试高频定时器或传感器的值,配置仅每x次触发的断点将很有用.最好的方法是什么?

To debug the values of high frequency timers or sensors it would be useful to configure a breakpoint that only fires every x times. What's the best way to accomplish this?

我尝试了Xcode中的在停止之前先忽略x次"选项,但这仅在第一次使用时有效.我可以使用LLDB命令重置此计数器吗?

I tried the "Ignore x times before stopping" option in Xcode but that only works for the first time. Can I reset this counter using an LLDB command?

推荐答案

您可以随时通过以下方式重置忽略计数器:

You can reset the ignore counter at any time with:

(lldb) break modify -i <NEW_VALUE> <BKPT_SPECIFICATION>

请注意,不满足其忽略计数"的断点不会被视为命中,因此不会运行其断点命令.因此,如果您想每隔十分之一就自动停下断点,只需执行以下操作即可:

Note, a breakpoint which doesn't satisfy its "ignore count" is not considered to be hit, so its breakpoint command does NOT get run. So if you wanted to stop every tenth the time you hit the breakpoint automatically, just do:

    (lldb) break set -l 10 -i 10 -N my_bkpt
    Breakpoint 1: where = foo`main + 46 at foo.c:10, address = 0x0000000100000f5e
    (lldb) break com add
    Enter your debugger command(s).  Type 'DONE' to end.
    > break modify -i 10 my_bkpt 
    > DONE
    (lldb)

然后只需在每个停止点单击继续",您将每10次命中一次断点.

Then just hit "continue" at each stop and you will hit the breakpoint once every 10 times.

注意,我使用了命名断点的功能(-N选项),因此我不必在添加的breakpoint命令中知道断点编号.如果要将这些断​​点存储在命令文件等中,这很方便.

Note, I used the ability to name the breakpoint (the -N option) so I didn't have to know the breakpoint number in the breakpoint command that I added. That's convenient if you're going to store these breakpoints in a command file, etc.

参考:

Ref: Apple docs on Managing breakpoints. You can also do help breakpoint set command for a complete list of available options

这篇关于如何设置每10次触发LLDB断点一次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆