在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'.
并在互联网上搜索“等效于dbdb的gdb命令”给了我很多很棒的备忘单,但是commands
命令却没有。
答案 0 :(得分: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