0

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.

0

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.