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
This commit is contained in:
Simon Marchi
2021-05-27 14:58:37 -04:00
parent f6d17b2b1c
commit 40cb8ca539
9 changed files with 83 additions and 101 deletions

View File

@@ -783,7 +783,7 @@ jit_breakpoint_deleted (struct breakpoint *b)
if (b->type != bp_jit_event)
return;
for (bp_location *iter = b->loc; iter != nullptr; iter = iter->next)
for (bp_location *iter : b->locations ())
{
for (objfile *objf : iter->pspace->objfiles ())
{