So I am using Qt Creator with LLDB as debugger. To debug stuff I add breakpoints and when the code hits the breakpoint it stops and I can see the back trace and all and that's useful. However, sometimes I don't want to stop and I am only interested in whether the breakpoint is hit, or I want to inspect a value there. I usually do this with adding debugging messages but that generally takes a lot of time to recompile the project and rerun the scenario. I'm wondering is there a better way to do this, using a debugger, preferably LLDB.
All the break set
commands take a --auto-continue
option (one-letter: -G
) that will instruct lldb to continue after stopping for the breakpoint (and running any of its commands).
You can run lldb commands when a breakpoint is hit (e.g. to do a backtrace or print some locals) using the break command add
command or by adding any number of -C
options to the break set
command. You can also add a Python implemented callback to the breakpoint as described here:
https://lldb.llvm.org/use/python-reference.html#running-a-python-script-when-a-breakpoint-gets-hit
if you need to do something fancier to gather your report when you hit the breakpoint.
If you want to edit an extant break point you can do the following:
breakpoint modify <break_point_id> -G true <bkpt-number>
If you don't specify a breakpoint number, lldb acts on the last breakpoint you set.