diff options
Diffstat (limited to 'gdb/python/py-stopevent.c')
-rw-r--r-- | gdb/python/py-stopevent.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/gdb/python/py-stopevent.c b/gdb/python/py-stopevent.c index 122fe6b..1ecbe6c 100644 --- a/gdb/python/py-stopevent.c +++ b/gdb/python/py-stopevent.c @@ -45,18 +45,42 @@ int emit_stop_event (struct bpstats *bs, enum target_signal stop_signal) { PyObject *stop_event_obj = NULL; /* Appease GCC warning. */ + PyObject *list = NULL; + PyObject *first_bp = NULL; + struct bpstats *current_bs; if (evregpy_no_listeners_p (gdb_py_events.stop)) return 0; - if (bs && bs->breakpoint_at - && bs->breakpoint_at->py_bp_object) + /* Add any breakpoint set at this location to the list. */ + for (current_bs = bs; current_bs != NULL; current_bs = current_bs->next) { - stop_event_obj = create_breakpoint_event_object ((PyObject *) bs - ->breakpoint_at - ->py_bp_object); + if (current_bs->breakpoint_at + && current_bs->breakpoint_at->py_bp_object) + { + PyObject *current_py_bp = + (PyObject *) current_bs->breakpoint_at->py_bp_object; + + if (list == NULL) + { + list = PyList_New (0); + if (!list) + goto fail; + } + + if (PyList_Append (list, current_py_bp)) + goto fail; + + if (first_bp == NULL) + first_bp = current_py_bp; + } + } + + if (list != NULL) + { + stop_event_obj = create_breakpoint_event_object (list, first_bp); if (!stop_event_obj) - goto fail; + goto fail; } /* Check if the signal is "Signal 0" or "Trace/breakpoint trap". */ @@ -75,13 +99,14 @@ emit_stop_event (struct bpstats *bs, enum target_signal stop_signal) { stop_event_obj = create_stop_event_object (&stop_event_object_type); if (!stop_event_obj) - goto fail; + goto fail; } return evpy_emit_event (stop_event_obj, gdb_py_events.stop); - fail: - return -1; + fail: + Py_XDECREF (list); + return -1; } GDBPY_NEW_EVENT_TYPE (stop, |