GDB Python API: stop/continue after breakpoint

Kevin Pouget
2011-03-11T16:09:26Z

Hello,

I've tried the GDB python interface today, which seems quite
efficient, but there is one important thing I couldn't figure out by
myself:

how to restart GDB when a[n internal] breakpoint is hit ?
from the testsuite I've got this code:

def breakpoint_stop_handler (event):
if (isinstance (event, gdb.StopEvent)):
print "event type: stop"
if (isinstance (event, gdb.BreakpointEvent)):
print "stop reason: breakpoint"
print "breakpoint number: %s" % (event.breakpoint.number)
if ( event.inferior_thread is not None) :
print "thread num: %s" % (event.inferior_thread.num);
else:
print "all threads stopped"

gdb.events.stop.connect (breakpoint_stop_handler)

which where I get the notification of the stop, but I'd to be able to
tell GDB something like

enum bpstat_what_main_action {
/* Remove breakpoints, single step once, then put them back in and
go back to what we were doing. It's possible that this should
be removed from the main_action and put into a separate field,
to more cleanly handle BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE. */
BPSTAT_WHAT_SINGLE,
/* Stop silently. */
BPSTAT_WHAT_STOP_SILENT,

/* Stop and print. */
BPSTAT_WHAT_STOP_NOISY,
...
}

to continue silently, stop silently or print the breakpoint hit.

is it possible at this stage ?

Thanks,

Kevin