[PATCH 0/9] Convert breakpoint iteration macros to ranges

Simon Marchi simon.marchi@polymtl.ca
Thu May 27 15:35:49 GMT 2021


This all started with me finding that the update_global_location_list
function was hard to read, notably because the breakpoint iteration
macros are a bit hard to read (require multiple local variables and
pointers to pointers).  So this removes all breakpoint-related iteration
macros in favor of functions that return iterable ranges.

Patch 5 also converts the bp_locations array into a vector, which
simplifies things a bit.

In the end, the update_global_location_list is still hard to understand
(big surprise), but I think that the code in general is a bit tidier
like this.

I regtested this on Linux, with the unix and native-extended-gdbserver
boards.

Simon Marchi (9):
  gdb: add all_breakpoints function
  gdb: add all_breakpoints_safe function
  gdb: add all_tracepoints function
  gdb: add breakpoint::locations method
  gdb: make bp_locations an std::vector
  gdb: add all_bp_locations function
  gdb: add all_bp_locations_at_addr function
  gdb: remove iterate_over_breakpoints function
  gdb: remove iterate_over_bp_locations function

 gdb/ada-lang.c                   |   4 +-
 gdb/breakpoint.c                 | 866 +++++++++++--------------------
 gdb/breakpoint.h                 |  69 ++-
 gdb/dummy-frame.c                |   7 +-
 gdb/guile/scm-breakpoint.c       |  10 +-
 gdb/jit.c                        |   2 +-
 gdb/python/py-breakpoint.c       |  27 +-
 gdb/python/py-finishbreakpoint.c |  17 +-
 gdb/record-full.c                |  26 +-
 gdb/remote.c                     |   3 +-
 gdb/solib-svr4.c                 |   7 +-
 gdb/tracepoint.c                 |  31 +-
 gdb/tui/tui-winsource.c          |   9 +-
 13 files changed, 420 insertions(+), 658 deletions(-)

-- 
2.31.1



More information about the Gdb-patches mailing list