2013-09-04 Doug Evans <dje@google.com>
+ * gdb.python/py-events.py (exit_handler): Verify we get the expected
+ event.
+ (continue_handler, new_objfile_handler): Ditto.
+ (test_events): Rename command to "test-events".
+ (test_newobj_events): Rename command to "test-objfile-events".
+ * gdb.python/py-events.exp: Update.
+ * gdb.python/py-evsignal.exp: Update.
+ * gdb.python/py-evthreads.exp: Update.
+
* gdb.base/enumval.c (ZERO): New enum value.
(main): Use it
* gdb.base/enumval.exp: Test ability to print ZERO.
print ("all threads stopped")
def exit_handler (event):
- if (isinstance (event, gdb.ExitedEvent)):
- print ("event type: exit")
+ assert (isinstance (event, gdb.ExitedEvent))
+ print ("event type: exit")
print ("exit code: %d" % (event.exit_code))
print ("exit inf: %d" % (event.inferior.num))
print ("dir ok: %s" % str('exit_code' in dir(event)))
def continue_handler (event):
- if (isinstance (event, gdb.ContinueEvent)):
- print ("event type: continue")
+ assert (isinstance (event, gdb.ContinueEvent))
+ print ("event type: continue")
if ( event.inferior_thread is not None) :
print ("thread num: %s" % (event.inferior_thread.num))
def new_objfile_handler (event):
- if (isinstance (event, gdb.NewObjFileEvent)):
- print ("event type: new_objfile")
- if (event.new_objfile is not None):
- print ("new objfile name: %s" % (event.new_objfile.filename))
- else:
- print ("new objfile is None")
+ assert (isinstance (event, gdb.NewObjFileEvent))
+ print ("event type: new_objfile")
+ print ("new objfile name: %s" % (event.new_objfile.filename))
+ print ("inferior number: %d" % (event.inferior.num))
class test_events (gdb.Command):
"""Test events."""
def __init__ (self):
- gdb.Command.__init__ (self, "test_events", gdb.COMMAND_STACK)
+ gdb.Command.__init__ (self, "test-events", gdb.COMMAND_STACK)
def invoke (self, arg, from_tty):
gdb.events.stop.connect (signal_stop_handler)
"""NewObj events."""
def __init__ (self):
- gdb.Command.__init__ (self, "test_newobj_events", gdb.COMMAND_STACK)
+ gdb.Command.__init__ (self, "test-objfile-events", gdb.COMMAND_STACK)
def invoke (self, arg, from_tty):
gdb.events.new_objfile.connect (new_objfile_handler)
- print ("New ObjectFile Event tester registered.")
+ print ("Object file events registered.")
test_newobj_events ()