OLD | NEW |
1 # Copyright (C) 2010-2012 Free Software Foundation, Inc. | 1 # Copyright (C) 2010-2012 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
4 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
(...skipping 26 matching lines...) Expand all Loading... |
37 if ( event.inferior_thread is not None) : | 37 if ( event.inferior_thread is not None) : |
38 print "thread num: %s" % (event.inferior_thread.num); | 38 print "thread num: %s" % (event.inferior_thread.num); |
39 else: | 39 else: |
40 print "all threads stopped" | 40 print "all threads stopped" |
41 | 41 |
42 def exit_handler (event): | 42 def exit_handler (event): |
43 if (isinstance (event, gdb.ExitedEvent)): | 43 if (isinstance (event, gdb.ExitedEvent)): |
44 print "event type: exit" | 44 print "event type: exit" |
45 print "exit code: %d" % (event.exit_code) | 45 print "exit code: %d" % (event.exit_code) |
46 print "exit inf: %d" % (event.inferior.num) | 46 print "exit inf: %d" % (event.inferior.num) |
| 47 print "dir ok: %s" % str('exit_code' in dir(event)) |
47 | 48 |
48 def continue_handler (event): | 49 def continue_handler (event): |
49 if (isinstance (event, gdb.ContinueEvent)): | 50 if (isinstance (event, gdb.ContinueEvent)): |
50 print "event type: continue" | 51 print "event type: continue" |
51 if ( event.inferior_thread is not None) : | 52 if ( event.inferior_thread is not None) : |
52 print "thread num: %s" % (event.inferior_thread.num); | 53 print "thread num: %s" % (event.inferior_thread.num); |
53 | 54 |
54 def new_objfile_handler (event): | 55 def new_objfile_handler (event): |
55 if (isinstance (event, gdb.NewObjFileEvent)): | 56 if (isinstance (event, gdb.NewObjFileEvent)): |
56 print "event type: new_objfile" | 57 print "event type: new_objfile" |
(...skipping 21 matching lines...) Expand all Loading... |
78 """NewObj events.""" | 79 """NewObj events.""" |
79 | 80 |
80 def __init__ (self): | 81 def __init__ (self): |
81 gdb.Command.__init__ (self, "test_newobj_events", gdb.COMMAND_STACK) | 82 gdb.Command.__init__ (self, "test_newobj_events", gdb.COMMAND_STACK) |
82 | 83 |
83 def invoke (self, arg, from_tty): | 84 def invoke (self, arg, from_tty): |
84 gdb.events.new_objfile.connect (new_objfile_handler) | 85 gdb.events.new_objfile.connect (new_objfile_handler) |
85 print "New ObjectFile Event tester registered." | 86 print "New ObjectFile Event tester registered." |
86 | 87 |
87 test_newobj_events () | 88 test_newobj_events () |
OLD | NEW |