diff options
author | Christian Biesinger <cbiesinger@google.com> | 2019-10-09 13:50:20 -0500 |
---|---|---|
committer | Christian Biesinger <cbiesinger@google.com> | 2019-10-15 15:29:55 +0200 |
commit | 95da600f404ca159242f49441d9b4ea78183852b (patch) | |
tree | e72c73cbdad57163586abb1c6ead09661d0fbb96 /gdb/guile | |
parent | 9b142ddb4a115b6e58fabb05920bdd94811fda98 (diff) | |
download | gdb-95da600f404ca159242f49441d9b4ea78183852b.zip gdb-95da600f404ca159242f49441d9b4ea78183852b.tar.gz gdb-95da600f404ca159242f49441d9b4ea78183852b.tar.bz2 |
Change iterate_over_breakpoints to take a function_view
This allows callers to pass in capturing lambdas. Also changes the return
type to bool.
gdb/ChangeLog:
2019-10-15 Christian Biesinger <cbiesinger@google.com>
* breakpoint.c (iterate_over_breakpoints): Change function pointer
to a gdb::function_view and return value to bool.
* breakpoint.h (iterate_over_breakpoints): Likewise.
* dummy-frame.c (pop_dummy_frame_bpt): Update.
(pop_dummy_frame): Update.
* guile/scm-breakpoint.c (bpscm_build_bp_list): Update.
(gdbscm_breakpoints): Update.
* python/py-breakpoint.c (build_bp_list): Update.
(gdbpy_breakpoints): Update.
* python/py-finishbreakpoint.c (bpfinishpy_detect_out_scope_cb):
Update.
(bpfinishpy_handle_stop): Update.
(bpfinishpy_handle_exit): Update.
* solib-svr4.c (svr4_update_solib_event_breakpoint): Update.
(svr4_update_solib_event_breakpoints): Update.
Change-Id: Ia9de4deecae562a70a40f5cd49f5a74d64570251
Diffstat (limited to 'gdb/guile')
-rw-r--r-- | gdb/guile/scm-breakpoint.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c index 9a4efee..a75daa0 100644 --- a/gdb/guile/scm-breakpoint.c +++ b/gdb/guile/scm-breakpoint.c @@ -505,10 +505,9 @@ gdbscm_delete_breakpoint_x (SCM self) /* iterate_over_breakpoints function for gdbscm_breakpoints. */ -static int -bpscm_build_bp_list (struct breakpoint *bp, void *arg) +static bool +bpscm_build_bp_list (struct breakpoint *bp, SCM *list) { - SCM *list = (SCM *) arg; breakpoint_smob *bp_smob = bp->scm_bp_object; /* Lazily create wrappers for breakpoints created outside Scheme. */ @@ -534,7 +533,7 @@ bpscm_build_bp_list (struct breakpoint *bp, void *arg) if (bp_smob != NULL) *list = scm_cons (bp_smob->containing_scm, *list); - return 0; + return false; } /* (breakpoints) -> list @@ -545,11 +544,10 @@ gdbscm_breakpoints (void) { SCM list = SCM_EOL; - /* If iterate_over_breakpoints returns non-NULL it means the iteration - terminated early. - In that case abandon building the list and return #f. */ - if (iterate_over_breakpoints (bpscm_build_bp_list, &list) != NULL) - return SCM_BOOL_F; + iterate_over_breakpoints ([&] (breakpoint *bp) + { + return bpscm_build_bp_list(bp, &list); + }); return scm_reverse_x (list, SCM_EOL); } |