gdb: use intrusive_list for breakpoint locations
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 18 May 2023 17:56:00 +0000 (13:56 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 25 May 2023 12:47:12 +0000 (08:47 -0400)
commit20afe380e8c1c2647e9475340a0f6a53d573331b
tree7e14ffda08ad225c08ad8d9ff94b113ea5d30bfb
parent774d21c10b971425c758b10ab65e28104feae47c
gdb: use intrusive_list for breakpoint locations

Replace the hand-maintained linked lists of breakpoint locations with
and intrusive list.

 - Remove breakpoint::loc, add breakpoint::m_locations.

 - Add methods for the various manipulations that need to be done on the
   location list, while maintaining reasonably good encapsulation.

 - bp_location currently has a default constructor because of one use
   in hoist_existing_locations.  hoist_existing_locations now returns a
   bp_location_list, and doesn't need the default-constructor
   bp_location anymore, so remove the bp_location default constructor.

 - I needed to add a call to clear_locations in delete_breakpoint to
   avoid a use-after-free.

 - Add a breakpoint::last_loc method, for use in
   set_breakpoint_condition.

bp_location_range uses reference_to_pointer_iterator, so that all
existing callers of breakpoint::locations don't need to change right
now.  It will be removed in the next patch.

The rest of the changes are to adapt the call sites to use the new
methods, of breakpoint::locations, rather than breakpoint::loc directly.

Change-Id: I25f7ee3d66a4e914a0540589ac414b3b820b6e70
Reviewed-By: Andrew Burgess <aburgess@redhat.com>
gdb/breakpoint.c
gdb/breakpoint.h
gdb/tracepoint.c