diff options
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-breakpoint.c | 15 | ||||
-rw-r--r-- | gdb/python/py-finishbreakpoint.c | 18 |
2 files changed, 21 insertions, 12 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 698d91e..65cb29f 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -871,10 +871,9 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) -static int -build_bp_list (struct breakpoint *b, void *arg) +static bool +build_bp_list (struct breakpoint *b, PyObject *list) { - PyObject *list = (PyObject *) arg; PyObject *bp = (PyObject *) b->py_bp_object; int iserr = 0; @@ -886,9 +885,9 @@ build_bp_list (struct breakpoint *b, void *arg) iserr = PyList_Append (list, bp); if (iserr == -1) - return 1; + return true; - return 0; + return false; } /* Static function to return a tuple holding all breakpoints. */ @@ -906,7 +905,11 @@ gdbpy_breakpoints (PyObject *self, PyObject *args) /* If iterate_over_breakpoints returns non NULL it signals an error condition. In that case abandon building the list and return NULL. */ - if (iterate_over_breakpoints (build_bp_list, list.get ()) != NULL) + auto callback = [&] (breakpoint *bp) + { + return build_bp_list(bp, list.get ()); + }; + if (iterate_over_breakpoints (callback) != NULL) return NULL; return PyList_AsTuple (list.get ()); 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. */ |