[Converted from Gnats 2427] I have on occasion (rarely, but still) wanted to specify the commands to multiple breakpoints at once. I think "commands" could be given a breakpoint list argument, the way "enable" works. (See map_breakpoint_numbers, and not "help enable", to see how this really works.) Release: unknown
*** Bug 10523 has been marked as a duplicate of this bug. ***
As described in bug 10523, it's intuitive that a plain "commands" invocation done right after executing "rbreak" should apply those "commands" to all the breakpoints created by the previous "rbreak". I still think it should be many breakpoints though because after rbreak/commands you might want to remove one or two of them or disable some of them etc. A simple use case is: user is trying to understand a new code base, he specifically wants to understand how a certain class interacts with the rest of the program. Thus he types: rbreak SomeClass::* commands silent bt 8 c end The existing behavior of letting a plain "commands" affect only the last breakpoint setup by "rbreak" is not really that useful.
Testing a patch.
I checked in the fix.
How has this been implemented? 'help' doesn't explain: (gdb) help commands Set commands to be executed when a breakpoint is hit. Give breakpoint number as argument after "commands". With no argument, the targeted breakpoint is the last one set. The commands themselves follow starting on the next line. Type a line containing "end" to indicate the end of them. Give "silent" as the first line to make the breakpoint silent; then no output is printed when it is hit, except what the commands print.