Is there any way to label/name breakpoints in GDB, in order to more easily identify them in, for instance, info b
? And if so, how?
No, there is no way to do this.
http://users.ece.utexas.edu/~adnan/gdb-refcard.pdf
While this doesn't help with the output of info b
, for other purposes where you need to reference the breakpoint later in commands you can store the breakpoint number of the last breakpoint from $bpnum
in another convenience variable, e.g.:
b foo.c:123
set $im_a_breakpoint = $bpnum
# ... set some more breakpoints and do some other stuff ...
disable $im_a_breakpoint
As a further example, I'm using this pattern right now for a task: I'm using normal gdb breakpoints in code emitted by a JIT, which requires setting the breakpoint on the address after the code has actually been emitted as gdb modifies the code. For this purpose I actually disable the initial set-up breakpoint from within its own commands
block:
set $cur_stop_point = 0x41aaa
b basic_jit_cache::copy_block if ((uint32_t)this->code_ptr()) > ($gencode + $cur_stop_point)
set $cur_stop_point_setup_bp = $bpnum
commands
b *($gencode + $cur_stop_point)
disable $cur_stop_point_setup_bp
cont
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With