gdb: add breakpoint::first_loc methods
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 9 May 2023 14:28:09 +0000 (10:28 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 25 May 2023 12:47:00 +0000 (08:47 -0400)
commitf5951b9ff8a018c9234656e9b26b372c6b3d238b
tree4427bb72ea2170d31468656e6d0bd53306c46ca7
parent9dc1523b573cc065d6124e3127009c1d7cb8317b
gdb: add breakpoint::first_loc methods

Add convenience first_loc methods to struct breakpoint (const and
non-const overloads).  A subsequent patch changes the list of locations
to be an intrusive_list and makes the actual list private, so these
spots would need to change from:

    b->loc

to something ugly like:

    *b->locations ().begin ()

That would make the code much heavier and not readable.  There is a
surprisingly big number of places that access the first location of
breakpoints.  Whether this is correct, or these spots fail to consider
the possibility of multi-location breakpoints, I don't know.  But
anyhow, I think that using this instead:

 b->first_loc ()

conveys the intention better than the other two forms.

Change-Id: Ibbefe3e4ca6cdfe570351fe7e2725f2ce11d1e95
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
gdb/breakpoint.c
gdb/breakpoint.h
gdb/elfread.c
gdb/infrun.c
gdb/tracectf.c
gdb/tracefile-tfile.c
gdb/tracefile.c
gdb/tracepoint.c
gdb/tui/tui-winsource.c