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/tui | |
parent | f6d17b2b1c042853b80d790b0c6a10d2b4347faa (diff) | |
download | binutils-40cb8ca5396e563968fa8465a10173e7c2fd9d84.zip binutils-40cb8ca5396e563968fa8465a10173e7c2fd9d84.tar.gz binutils-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/tui')
-rw-r--r-- | gdb/tui/tui-winsource.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 908d901..738f691 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -459,12 +459,10 @@ tui_source_window_base::update_breakpoint_info tui_bp_flags mode = 0; iterate_over_breakpoints ([&] (breakpoint *bp) -> bool { - struct bp_location *loc; - if (bp == being_deleted) return false; - for (loc = bp->loc; loc != NULL; loc = loc->next) + for (bp_location *loc : bp->locations ()) { if (location_matches_p (loc, i)) { |