forked from Imagelibrary/binutils-gdb
gdb: remove iterate_over_breakpoints function
Now that we have range functions that let us use ranged for loops, we can remove iterate_over_breakpoints in favor of those, which are easier to read and write. This requires exposing the declaration of all_breakpoints and all_breakpoints_safe in breakpoint.h, as well as the supporting types. Change some users of iterate_over_breakpoints to use all_breakpoints, when they don't need to delete the breakpoint, and all_breakpoints_safe otherwise. gdb/ChangeLog: * breakpoint.h (iterate_over_breakpoints): Remove. Update callers to use all_breakpoints or all_breakpoints_safe. (breakpoint_range, all_breakpoints, breakpoint_safe_range, all_breakpoints_safe): Move here. * breakpoint.c (all_breakpoints, all_breakpoints_safe): Make non-static. (iterate_over_breakpoints): Remove. * python/py-finishbreakpoint.c (bpfinishpy_detect_out_scope_cb): Return void. * python/py-breakpoint.c (build_bp_list): Add comment, reverse return value logic. * guile/scm-breakpoint.c (bpscm_build_bp_list): Return void. Change-Id: Idde764a1f577de0423e4f2444a7d5cdb01ba5e48
This commit is contained in:
@@ -493,27 +493,17 @@ bool target_exact_watchpoints = false;
|
||||
|
||||
static struct breakpoint *breakpoint_chain;
|
||||
|
||||
/* Breakpoint linked list range. */
|
||||
/* See breakpoint.h. */
|
||||
|
||||
using breakpoint_range = next_adapter<breakpoint, breakpoint_iterator>;
|
||||
|
||||
/* Return a range to iterate over all breakpoints. */
|
||||
|
||||
static breakpoint_range
|
||||
breakpoint_range
|
||||
all_breakpoints ()
|
||||
{
|
||||
return breakpoint_range (breakpoint_chain);
|
||||
}
|
||||
|
||||
/* Breakpoint linked list range, safe against deletion of the current
|
||||
breakpoint while iterating. */
|
||||
/* See breakpoint.h. */
|
||||
|
||||
using breakpoint_safe_range = basic_safe_range<breakpoint_range>;
|
||||
|
||||
/* Return a range to iterate over all breakpoints. This range is safe against
|
||||
deletion of the current breakpoint while iterating. */
|
||||
|
||||
static breakpoint_safe_range
|
||||
breakpoint_safe_range
|
||||
all_breakpoints_safe ()
|
||||
{
|
||||
return breakpoint_safe_range (all_breakpoints ());
|
||||
@@ -15191,16 +15181,6 @@ add_catch_command (const char *name, const char *docstring,
|
||||
set_cmd_completer (command, completer);
|
||||
}
|
||||
|
||||
struct breakpoint *
|
||||
iterate_over_breakpoints (gdb::function_view<bool (breakpoint *)> callback)
|
||||
{
|
||||
for (breakpoint *b : all_breakpoints_safe ())
|
||||
if (callback (b))
|
||||
return b;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Zero if any of the breakpoint's locations could be a location where
|
||||
functions have been inlined, nonzero otherwise. */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user