summaryrefslogtreecommitdiff
path: root/gdb/python/py-breakpoint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-breakpoint.c')
-rw-r--r--gdb/python/py-breakpoint.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 698d91e9d32..65cb29fdca6 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 ());