简体   繁体   中英

How to force GDB to start number breakpoints at 1

How can I force GDB to start its numbering of newly added breakpoints at 1, after I have deleted all breakpoints with the delete command?

I'm using this version of GDB: GNU gdb (GDB) 8.0.50.20171024-git

TL;DR Rationale

During complicated debug sessions, I have a separate command file that I use the source command to source back in, with the first line of that command being delete br . That does clear the breakpoints as it should. Then, in subsequent lines, I add the complicated breakpoints, but does not restart with breakpoint 1. That means that, during a the same debug session, and without exiting and restarting the whole GDB session again, GDB will continue numbering the breakpoints at the next integer after the last one that was added before, but then was deleted. Yes, I could restart the GDB session, sure, and that is a workaround, but that is suboptimal because it forces me to wait for GDB to reload the executable into core, and the executable is quite large (yes, that is indeed a problem, but is not the droids we are discussing right now). Then, I want to add, to that command file, commands to disable all breakpoints except the first one, then manually use continue to continue to the first breakpoint, and only then re-enable the subsequent breakpoints. Then once those are added in, I want to execute specifically the command (which shall be hardcoded into my wetware and never ever be changed): enable 2-20 . Because then I want to discover some code, then use the disable 2-20 command (also hardcoded in my wetware) followed by the run command, and repeat ad infinitum, all without having to restart GDB.

Side note: Please do not ask me to program in GDB's Python. Yes, I know how. But I don't wanna. This should be something built-into plain 'ole GDB without any extra Python coding chores/requirements. But if you do have a Python based approach, I will reluctantly listen and so too maybe even accept it as the answer.

Not possible without GDB source code change.

If somebody wants to apply that change, then I will mark their answer as the accepted answer. For now I will just answer my own question as I did above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM