@@ -1664,8 +1665,8 @@ public:
returned. This can be useful for implementing a search for a
breakpoint with arbitrary attributes, or for applying an operation
to every breakpoint. */
-extern struct breakpoint *iterate_over_breakpoints (int (*) (struct breakpoint *,
- void *), void *);
+extern struct breakpoint *iterate_over_breakpoints
+ (gdb::function_view<int (breakpoint *, void *)>, void *);
/* Nonzero if the specified PC cannot be a location where functions
have been inlined. */
for (i = 0; i < content.size (); i++)
- struct breakpoint *bp;
- extern struct breakpoint *breakpoint_chain;
struct tui_source_element *line;
line = &content[i];
@@ -413,9 +411,7 @@ tui_source_window_base::update_breakpoint_info
do with it. Identify enable/disabled breakpoints as well as
those that we already hit. */
tui_bp_flags mode = 0;
- for (bp = breakpoint_chain;
- bp != NULL;
- bp = bp->next)
+ iterate_over_breakpoints ([&] (struct breakpoint *bp, void*) -> int
struct bp_location *loc;
> From: Christian Biesinger <[hidden email]>
> This allows callers to pass in capturing lambdas. I have not changed the
> signature to remove the void* argument or to change the return type to
> bool; that can be done in a future cleanup.
> >>>>> cbiesinger <[hidden email]> writes:
> > From: Christian Biesinger <[hidden email]>
> > This allows callers to pass in capturing lambdas. I have not changed the
> > signature to remove the void* argument or to change the return type to
> > bool; that can be done in a future cleanup.
> > gdb/ChangeLog:
> > 2019-10-09 Christian Biesinger <[hidden email]>
> > * breakpoint.c (iterate_over_breakpoints): Change function pointer to
> > a gdb::function_view.
> > * breakpoint.h (iterate_over_breakpoints): Likewise.
> > +iterate_over_breakpoints
> > + (gdb::function_view<int (breakpoint *, void *)> callback, void *data)
> I think normally a function_view conversion would remove the "void *"
> callback data, because that can be passed in via the closure now.