Bug 9532 - let "commands" select more than one breakpoint
Summary: let "commands" select more than one breakpoint
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: 7.2
Assignee: Tom Tromey
URL:
Keywords:
: 10523 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-10 01:08 UTC by Tom Tromey
Modified: 2017-02-09 17:35 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2008-03-10 01:08:01 UTC
[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
Comment 1 Tom Tromey 2009-08-14 18:17:16 UTC
*** Bug 10523 has been marked as a duplicate of this bug. ***
Comment 2 mnemo 2009-08-14 19:24:53 UTC
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.
Comment 3 Tom Tromey 2010-03-09 18:33:28 UTC
Testing a patch.
Comment 4 Tom Tromey 2010-03-24 21:29:09 UTC
I checked in the fix.
Comment 5 Daniel Gutson 2017-02-09 17:35:37 UTC
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.