In gdb, I can tell the debugger to always run a set of commands when it hits a breakpoint
(gdb) b somefile.c:25
(gdb) commands
> watch -l some->expression
> continue
> end
(gdb) continue
Is there an equivalent command/system in lldb
? When I try the above, I end up with
(lldb) commands
error: 'commands' is not a valid command.
error: Unrecognized command 'commands'.
and internet-searching for "gdb commands equivalent lldb" gives me a lot of great cheat sheets, but none with the commands
command.
Use 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)
You can also specify one or more single-line commands as options to a breakpoint set
command.
(lldb) breakpoint set -n f -C "watch set expression &b" -C "continue"
Breakpoint 2: where = x`f + 12 at x.c:4, address = 0x0000000000001161