+2011-09-15 Kevin Pouget <kevin.pouget@st.com>
+
+ Handle multiple breakpoint hits in Python interface:
+ * python/py-bpevent.c (create_breakpoint_event_object): Rename C/Python
+ variable to breakpoints.
+ * python/py-stopevent.c (emit_stop_event): Return a Python tuple of
+ bps instead of single breakpoint. Fix some space typos.
+ * python/py-stopevent.c (create_breakpoint_event_object): Rename
+ variable to breakpoints.
+
2011-09-15 Kevin Pouget <kevin.pouget@st.com>
* breakpoint.c (describe_other_breakpoints): Do not write 'duplicate'
** Symbols now provide the "type" attribute, the type of the symbol.
+ ** The "gdb.breakpoint" function has been deprecated in favor of
+ "gdb.breakpoints".
+
* libthread-db-search-path now supports two special values: $sdir and $pdir.
$sdir specifies the default system locations of shared libraries.
$pdir specifies the directory where the libpthread used by the application
+2011-09-15 Kevin Pouget <kevin.pouget@st.com>
+
+ Handle multiple breakpoint hits in Python interface:
+ * gdb.texinfo (Events In Python): New function documentation:
+ gdb.BreakpointEvent.breakpoints. Indicate that
+ gdb.BreakpointEvent.breakpoint is now deprecated.
+
2011-09-04 Joel Brobecker <brobecker@adacore.com>
* gdb.texinfo: Set EDITION to "Tenth" and change ISBN.
Also emits @code{gdb.BreakpointEvent} which extends @code{gdb.StopEvent}.
-@code{gdb.BreakpointEvent} event indicates that a breakpoint has been hit, and
-has the following attributes:
+@code{gdb.BreakpointEvent} event indicates that one or more breakpoints have
+been hit, and has the following attributes:
@table @code
-@defivar BreakpointEvent breakpoint
-A reference to the breakpoint that was hit of type @code{gdb.Breakpoint}.
+@defivar BreakpointEvent breakpoints
+A sequence containing references to all the breakpoints (type
+@code{gdb.Breakpoint}) that were hit.
@xref{Breakpoints In Python}, for details of the @code{gdb.Breakpoint} object.
@end defivar
+@defivar BreakpointEvent breakpoint
+A reference to the first breakpoint that was hit.
+This function is maintained for backward compatibility and is now deprecated
+in favor of the @code{gdb.BreakpointEvent.breakpoints} function.
@end table
@end table
/* Create and initialize a BreakpointEvent object. */
PyObject *
-create_breakpoint_event_object (PyObject *breakpoint)
+create_breakpoint_event_object (PyObject *breakpoint_list, PyObject *first_bp)
{
PyObject *breakpoint_event_obj =
create_stop_event_object (&breakpoint_event_object_type);
if (evpy_add_attribute (breakpoint_event_obj,
"breakpoint",
- breakpoint) < 0)
+ first_bp) < 0)
+ goto fail;
+ if (evpy_add_attribute (breakpoint_event_obj,
+ "breakpoints",
+ breakpoint_list) < 0)
goto fail;
return breakpoint_event_obj;
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". */
{
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,
extern int emit_stop_event (struct bpstats *bs,
enum target_signal stop_signal);
-extern PyObject *create_breakpoint_event_object (PyObject *breakpoint);
+extern PyObject *create_breakpoint_event_object (PyObject *breakpoint_list,
+ PyObject *first_bp);
extern PyObject *create_signal_event_object (enum target_signal stop_signal);
+2011-04-30 Kevin Pouget <kevin.pouget@st.com>
+
+ Handle multiple breakpoint hits in Python interface:
+ * gdb.python/py-events.exp: Set a duplicate breakpoint and check its
+ presence.
+ * gdb.python/py-events.py (breakpoint_stop_handler): Browse all the
+ breakpoint hits.
+
2011-09-13 Sami Wagiaalla <swagiaal@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
gdb_test "Test_Events" "Event testers registered."
+gdb_breakpoint "first"
gdb_breakpoint "first"
# Test continue event and breakpoint stop event
gdb_test "continue" ".*event type: continue.*
.*event type: stop.*
.*stop reason: breakpoint.*
+.*first breakpoint number: 2.*
.*breakpoint number: 2.*
+.*breakpoint number: 3.*
all threads stopped"
#test exited event.
print "event type: stop"
if (isinstance (event, gdb.BreakpointEvent)):
print "stop reason: breakpoint"
- print "breakpoint number: %s" % (event.breakpoint.number)
+ print "first breakpoint number: %s" % (event.breakpoint.number)
+ for bp in event.breakpoints:
+ print "breakpoint number: %s" % (bp.number)
if ( event.inferior_thread is not None) :
print "thread num: %s" % (event.inferior_thread.num);
else: