In GDB debugging C++ code: I have 15 breakpoints strategically set, but I don't want any of them to activate until I've hit breakpoint #2. Is there any run-until-breakpoint-n command in GDB?
I find myself doing one of two things instead:
-
Delete all other breakpoints so that #2 is all that exists, run, re-add all breakpoints; or
-
Run and repeatedly
continue
past all breaks until I see the first break at #2.
I want something like run-until 2
that will ignore all other breakpoints except #2, but not delete them. Does this exist? Does anyone else have a better way to deal with this?
Best Answer
As of version 7.0 GDB supports python scripting. I wrote a simple script that will temporary disable all enabled breakpoints except the one with specified number and execute GDB
run
command.Add the following code to the
.gdbinit
file: