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/ada-lang.c | |
parent | f6d17b2b1c042853b80d790b0c6a10d2b4347faa (diff) | |
download | gdb-40cb8ca5396e563968fa8465a10173e7c2fd9d84.zip gdb-40cb8ca5396e563968fa8465a10173e7c2fd9d84.tar.gz 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/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 1b50676..f0c1aa2 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -11552,8 +11552,6 @@ static void create_excep_cond_exprs (struct ada_catchpoint *c, enum ada_exception_catchpoint_kind ex) { - struct bp_location *bl; - /* Nothing to do if there's no specific exception to catch. */ if (c->excep_string.empty ()) return; @@ -11569,7 +11567,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c, /* Iterate over all the catchpoint's locations, and parse an expression for each. */ - for (bl = c->loc; bl != NULL; bl = bl->next) + for (bp_location *bl : c->locations ()) { struct ada_catchpoint_location *ada_loc = (struct ada_catchpoint_location *) bl; |