Is there a way that I can script the initialization file for GDB so that instead of:
break file.c:1234
commands 1
# ... fancy commands
end
… if I could write something like:
break file.c:1234 $line1234
commands $line1234
# ... fancy commands
end
… i.e. remember what number was assigned to a break point, watch point etc – I would be able to continue using that last created item/entity. The question also applies to disp, watch and others.
This only becomes relevant when you have many many breakpoints, but then it will be very useful. I wasn’t able to dig anything up from the documentation.
It would also be useful if there was just one magic variable that I could use to refer to the last created item of each type respectively, e.g. $lastbp, $lastwp, $lastdisp …
I figured perhaps a better example is the one at hand:
break file.c:1234 $line1234
commands $line1234
# ... fancy commands
end
ignore $line1234 42
Recent GDB versions (7.3) expose breakpoints to Python scripting.
You can write a Python script to set them up, set conditions and commands on them, etc. etc.