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
This commit is contained in:
parent
9b142ddb4a
commit
95da600f40
8 changed files with 64 additions and 38 deletions
|
@ -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 ());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue