gdb: add breakpoint::locations method
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 27 May 2021 18:58:37 +0000 (14:58 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 27 May 2021 18:58:37 +0000 (14:58 -0400)
commit40cb8ca5396e563968fa8465a10173e7c2fd9d84
treeaefc927ed2d6358fffd3c6db828751a3fd0996ce
parentf6d17b2b1c042853b80d790b0c6a10d2b4347faa
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
gdb/ChangeLog
gdb/ada-lang.c
gdb/breakpoint.c
gdb/breakpoint.h
gdb/jit.c
gdb/remote.c
gdb/solib-svr4.c
gdb/tracepoint.c
gdb/tui/tui-winsource.c