diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 14:58:37 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-27 14:58:37 -0400 |
commit | 40cb8ca5396e563968fa8465a10173e7c2fd9d84 (patch) | |
tree | aefc927ed2d6358fffd3c6db828751a3fd0996ce /gdb/breakpoint.h | |
parent | f6d17b2b1c042853b80d790b0c6a10d2b4347faa (diff) | |
download | fsf-binutils-gdb-40cb8ca5396e563968fa8465a10173e7c2fd9d84.zip fsf-binutils-gdb-40cb8ca5396e563968fa8465a10173e7c2fd9d84.tar.gz fsf-binutils-gdb-40cb8ca5396e563968fa8465a10173e7c2fd9d84.tar.bz2 |
gdb: add breakpoint::locations method
Add the breakpoint::locations method, which returns a range that can be
used to iterate over a breakpoint's locations. This shortens
for (bp_location *loc = b->loc; loc != nullptr; loc = loc->next)
into
for (bp_location *loc : b->locations ())
Change all the places that I found that could use it.
gdb/ChangeLog:
* breakpoint.h (bp_locations_range): New.
(struct breakpoint) <locations>: New. Use where possible.
Change-Id: I1ba2f7d93d57e544e1f8609124587dcf2e1da037
Diffstat (limited to 'gdb/breakpoint.h')
-rw-r--r-- | gdb/breakpoint.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 5a10839..f31498a 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -703,6 +703,10 @@ enum watchpoint_triggered extern bool target_exact_watchpoints; +/* bp_location linked list range. */ + +using bp_locations_range = next_adapter<bp_location>; + /* Note that the ->silent field is not currently used by any commands (though the code is in there if it was to be, and set_raw_breakpoint does set it to 0). I implemented it because I thought it would be @@ -715,6 +719,9 @@ struct breakpoint { virtual ~breakpoint (); + /* Return a range of this breakpoint's locations. */ + bp_locations_range locations (); + /* Methods associated with this breakpoint. */ const breakpoint_ops *ops = NULL; |