aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-finishbreakpoint.c
diff options
context:
space:
mode:
authorChristian Biesinger <cbiesinger@google.com>2019-10-09 13:50:20 -0500
committerChristian Biesinger <cbiesinger@google.com>2019-10-15 15:29:55 +0200
commit95da600f404ca159242f49441d9b4ea78183852b (patch)
treee72c73cbdad57163586abb1c6ead09661d0fbb96 /gdb/python/py-finishbreakpoint.c
parent9b142ddb4a115b6e58fabb05920bdd94811fda98 (diff)
downloadgdb-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/python/py-finishbreakpoint.c')
-rw-r--r--gdb/python/py-finishbreakpoint.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 7784a92..7f81821 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -341,10 +341,10 @@ bpfinishpy_out_of_scope (struct finish_breakpoint_object *bpfinish_obj)
/* Callback for `bpfinishpy_detect_out_scope'. Triggers Python's
`B->out_of_scope' function if B is a FinishBreakpoint out of its scope. */
-static int
-bpfinishpy_detect_out_scope_cb (struct breakpoint *b, void *args)
+static bool
+bpfinishpy_detect_out_scope_cb (struct breakpoint *b,
+ struct breakpoint *bp_stopped)
{
- struct breakpoint *bp_stopped = (struct breakpoint *) args;
PyObject *py_bp = (PyObject *) b->py_bp_object;
/* Trigger out_of_scope if this is a FinishBreakpoint and its frame is
@@ -383,8 +383,11 @@ bpfinishpy_handle_stop (struct bpstats *bs, int print_frame)
{
gdbpy_enter enter_py (get_current_arch (), current_language);
- iterate_over_breakpoints (bpfinishpy_detect_out_scope_cb,
- bs == NULL ? NULL : bs->breakpoint_at);
+ iterate_over_breakpoints ([&] (breakpoint *bp)
+ {
+ return bpfinishpy_detect_out_scope_cb
+ (bp, bs == NULL ? NULL : bs->breakpoint_at);
+ });
}
/* Attached to `exit' notifications, triggers all the necessary out of
@@ -395,7 +398,10 @@ bpfinishpy_handle_exit (struct inferior *inf)
{
gdbpy_enter enter_py (target_gdbarch (), current_language);
- iterate_over_breakpoints (bpfinishpy_detect_out_scope_cb, NULL);
+ iterate_over_breakpoints ([&] (breakpoint *bp)
+ {
+ return bpfinishpy_detect_out_scope_cb (bp, nullptr);
+ });
}
/* Initialize the Python finish breakpoint code. */