【问题标题】:Skip next n breakpoints in lldb跳过 lldb 中的下 n 个断点
【发布时间】:2013-02-24 19:14:04
【问题描述】:

在 gdb 中,我可以通过“continue n”跳过下 n 个断点,或者通过“next n”跳过下 n 行。 lldb 中的等价物是什么?

如果没有,我如何在 lldb python 扩展中自己创建它们?我尝试了类似的方法,但它不起作用,当我键入我添加的命令时,lldb 挂起。

def cc(debugger, args, result, dict):
    target = debugger.GetSelectedTarget()
    process = target.GetProcess()
    process.Continue()

【问题讨论】:

    标签: python xcode lldb


    【解决方案1】:

    process continue 命令接受-i 选项,该选项将忽略您当前在当前线程上停止的断点的下一个 i 匹配项。例如

    Process 13559 stopped
    * thread #1: tid = 0xb7da5, 0x0000000100000f21 a.out`main + 49 at a.c:7, stop reason = breakpoint 2.1
        #0: 0x0000000100000f21 a.out`main + 49 at a.c:7
       4        int i;
       5        for (i = 0; i < 100; i++)
       6        {
    -> 7            printf ("%d\n", i);
       8        }
       9    }
    (lldb) c -i 5
    Process 13559 resuming
    0
    1
    2
    3
    4
    5
    Process 13559 stopped
    * thread #1: tid = 0xb7da5, 0x0000000100000f21 a.out`main + 49 at a.c:7, stop reason = breakpoint 2.1
        #0: 0x0000000100000f21 a.out`main + 49 at a.c:7
       4        int i;
       5        for (i = 0; i < 100; i++)
       6        {
    -> 7            printf ("%d\n", i);
       8        }
       9    }
    (lldb) 
    

    您也可以直接使用breakpoint modify -i count bpnum 设置断点的忽略计数。

    【讨论】:

    • 很好的答案。非常感谢!
    • 还有一件事。跳过接下来的 n 行怎么样?(如 gdb 中的next n)。在 lldb 中,process 没有 step-over 子命令。 thread 确实有 step-over,但看起来它不需要 -i 选项。
    • thread step-over(又名n)采用-i 选项将是一个很好的增强,我会建议它。您可以使用命令别名 tbr(它只是 breakpoint set 的一个选项)添加一个临时断点(“一次性”断点),尽管我不记得何时将 tbr 添加到 lldb - 可能不是尚未发布。
    猜你喜欢
    • 2016-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-05
    • 2017-01-30
    • 1970-01-01
    • 2014-08-29
    相关资源
    最近更新 更多