* 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.
This commit is contained in:
parent
89e63ee47a
commit
314bb8c368
@ -1,5 +1,14 @@
|
||||
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.
|
||||
|
@ -45,7 +45,7 @@ if { [skip_python_tests] } { continue }
|
||||
|
||||
gdb_test_no_output "python exec (open ('${pyfile}').read ())" ""
|
||||
|
||||
gdb_test "Test_Newobj_Events" "New ObjectFile Event tester registered." "Register new objfile event handler"
|
||||
gdb_test "test-objfile-events" "Object file events registered."
|
||||
|
||||
gdb_breakpoint "main" {temporary}
|
||||
|
||||
@ -53,7 +53,7 @@ gdb_test "run" ".*event type: new_objfile.*new objfile name.*" "New objfile noti
|
||||
|
||||
gdb_test_no_output "set detach-on-fork off" ""
|
||||
|
||||
gdb_test "Test_Events" "Event testers registered."
|
||||
gdb_test "test-events" "Event testers registered."
|
||||
|
||||
gdb_breakpoint "first"
|
||||
gdb_breakpoint "first"
|
||||
|
@ -40,31 +40,29 @@ def breakpoint_stop_handler (event):
|
||||
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)
|
||||
@ -79,10 +77,10 @@ class test_newobj_events (gdb.Command):
|
||||
"""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 ()
|
||||
|
@ -33,7 +33,7 @@ if { [skip_python_tests] } { continue }
|
||||
|
||||
gdb_test_no_output "python exec (open ('${pyfile}').read ())" ""
|
||||
|
||||
gdb_test "Test_Events" "Event testers registered."
|
||||
gdb_test "test-events" "Event testers registered."
|
||||
gdb_test_no_output "set non-stop on"
|
||||
gdb_test_no_output "set target-async on"
|
||||
|
||||
|
@ -38,7 +38,7 @@ if { [skip_python_tests] } { continue }
|
||||
|
||||
gdb_test_no_output "python exec (open ('${pyfile}').read ())" ""
|
||||
|
||||
gdb_test "Test_Events" "Event testers registered."
|
||||
gdb_test "test-events" "Event testers registered."
|
||||
gdb_test_no_output "set non-stop on"
|
||||
gdb_test_no_output "set target-async on"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user