【问题标题】:Equivilant of gdb "commands" Command in lldblldb中gdb“commands”命令的等价物
【发布时间】:2019-07-19 02:53:14
【问题描述】:

在 gdb 中,我可以告诉调试器在遇到断点时始终运行一组命令

(gdb) b somefile.c:25
(gdb) commands
> watch -l some->expression
> continue
> end
(gdb) continue

lldb 中是否有等效的命令/系统?当我尝试上述方法时,我最终得到了

(lldb) commands
error: 'commands' is not a valid command.
error: Unrecognized command 'commands'.

在互联网上搜索“gdb commands equivalent lldb”给了我很多很棒的备忘单,但没有commands 命令。

【问题讨论】:

    标签: macos gdb lldb


    【解决方案1】:

    使用breakpoint command add [optional_breakpoint_id]

    (lldb) breakpoint set -n f
    Breakpoint 1: where = x`f + 12 at x.c:4, address = 0x0000000000001161
    (lldb) breakpoint command add
    Enter your debugger command(s).  Type 'DONE' to end.
    > watch set expression &b 
    > continue
    > DONE
    (lldb)
    

    您还可以指定一个或多个单行命令作为breakpoint set 命令的选项。

    (lldb) breakpoint set -n f -C "watch set expression &b" -C "continue"
    Breakpoint 2: where = x`f + 12 at x.c:4, address = 0x0000000000001161
    

    【讨论】:

      猜你喜欢
      • 2019-12-18
      • 2016-01-30
      • 2013-02-02
      • 2011-12-08
      • 2021-01-15
      • 1970-01-01
      • 2017-02-11
      • 2021-12-19
      • 2013-05-03
      相关资源
      最近更新 更多