Set gdb breakpoint two lines after existing label

I have a build program with multiple labels on different lines. I need to set gdb breakpoint on two lines after line with label. How to do this in gdb without adding an extra label to the program?

+4
source share
2 answers

gdb supports adding breakpoints X bytes after the label, and since each instruction has 4 bytes, I needed to do the following:

 *&labelname + 8 
+6
source

b foo , where foo is the line number in the source.

+1
source

All Articles