Allow enabling/disabling breakpoint location ranges
authorXavier Roirand <roirand@adacore.com>
Tue, 7 Nov 2017 11:00:31 +0000 (11:00 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 7 Nov 2017 11:00:31 +0000 (11:00 +0000)
commitd0fe47010fc3289e081ba547a0bfcc6d07906cd2
treecb255e0b04bb0b1e4d43bce583ca2938e08f4b7d
parent0198d5e6fc331d50dc19b7f250ac4bc510a8dbb5
Allow enabling/disabling breakpoint location ranges

When a breakpoint has multiple locations, like e.g.:

 Num  Type       Disp Enb  Address    What
 1    breakpoint keep y    <MULTIPLE>
 1.1                  y    0x080486a2 in void foo<int>()...
 1.2                  y    0x080486ca in void foo<double>()...
 [....]
 1.5                  y    0x080487fa in void foo<long>()...

it's possible to enable/disable the individual locations using the
'<breakpoint_number>.<location_number>' syntax, like e.g.:

 (gdb) disable 1.2 1.3 1.4 1.5

That's inconvenient when you have a long list of locations to disable,
however.

This patch adds shorthand for the above, by making it possible to
specify a range of locations with the following syntax (similar to
thread id ranges):

 <breakpoint_number>.<first_location_number>-<last_location_number>

For example, the command above can now be simplified to:

 (gdb) disable 1.2-5

gdb/ChangeLog:
2017-11-07  Xavier Roirand  <roirand@adacore.com>
    Pedro Alves  <palves@redhat.com>

* breakpoint.c (map_breakpoint_number_range): New, factored out
from ...
(map_breakpoint_numbers): ... here.
(find_location_by_number): Change parameters from string to
breakpoint number and location.
(extract_bp_number_and_location): New function.
(enable_disable_bp_num_loc)
(enable_disable_breakpoint_location_range)
(enable_disable_command): New functions, factored out ...
(enable_command, disable_command): ... these functions, and
adjusted to support ranges.
* NEWS: Document enable/disable breakpoint location range feature.

gdb/doc/ChangeLog:
2017-11-07  Xavier Roirand  <roirand@adacore.com>
    Pedro Alves  <palves@redhat.com>

* gdb.texinfo (Set Breaks): Document support for breakpoint
location ranges in the enable/disable commands.

gdb/testsuite/ChangeLog:
2017-11-07  Xavier Roirand  <roirand@adacore.com>
    Pedro Alves  <palves@redhat.com>

* gdb.base/ena-dis-br.exp: Add reference to
gdb.cp/ena-dis-br-range.exp.
* gdb.cp/ena-dis-br-range.exp: New file.
* gdb.cp/ena-dis-br-range.cc: New file.
gdb/ChangeLog
gdb/NEWS
gdb/breakpoint.c
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/ena-dis-br.exp
gdb/testsuite/gdb.cp/ena-dis-br-range.cc [new file with mode: 0644]
gdb/testsuite/gdb.cp/ena-dis-br-range.exp [new file with mode: 0644]