| OLD | NEW |
| 1 /* Python interface to inferior stop events. | 1 /* Python interface to inferior stop events. |
| 2 | 2 |
| 3 Copyright (C) 2009-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2009-2012 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of GDB. | 5 This file is part of GDB. |
| 6 | 6 |
| 7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
| 9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
| 10 (at your option) any later version. | 10 (at your option) any later version. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 /* Callback observers when a stop event occurs. This function will create a | 37 /* Callback observers when a stop event occurs. This function will create a |
| 38 new Python stop event object. If only a specific thread is stopped the | 38 new Python stop event object. If only a specific thread is stopped the |
| 39 thread object of the event will be set to that thread. Otherwise, if all | 39 thread object of the event will be set to that thread. Otherwise, if all |
| 40 threads are stopped thread object will be set to None. | 40 threads are stopped thread object will be set to None. |
| 41 return 0 if the event was created and emitted successfully otherwise | 41 return 0 if the event was created and emitted successfully otherwise |
| 42 returns -1. */ | 42 returns -1. */ |
| 43 | 43 |
| 44 int | 44 int |
| 45 emit_stop_event (struct bpstats *bs, enum target_signal stop_signal) | 45 emit_stop_event (struct bpstats *bs, enum gdb_signal stop_signal) |
| 46 { | 46 { |
| 47 PyObject *stop_event_obj = NULL; /* Appease GCC warning. */ | 47 PyObject *stop_event_obj = NULL; /* Appease GCC warning. */ |
| 48 PyObject *list = NULL; | 48 PyObject *list = NULL; |
| 49 PyObject *first_bp = NULL; | 49 PyObject *first_bp = NULL; |
| 50 struct bpstats *current_bs; | 50 struct bpstats *current_bs; |
| 51 | 51 |
| 52 if (evregpy_no_listeners_p (gdb_py_events.stop)) | 52 if (evregpy_no_listeners_p (gdb_py_events.stop)) |
| 53 return 0; | 53 return 0; |
| 54 | 54 |
| 55 /* Add any breakpoint set at this location to the list. */ | 55 /* Add any breakpoint set at this location to the list. */ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 if (list != NULL) | 79 if (list != NULL) |
| 80 { | 80 { |
| 81 stop_event_obj = create_breakpoint_event_object (list, first_bp); | 81 stop_event_obj = create_breakpoint_event_object (list, first_bp); |
| 82 if (!stop_event_obj) | 82 if (!stop_event_obj) |
| 83 goto fail; | 83 goto fail; |
| 84 } | 84 } |
| 85 | 85 |
| 86 /* Check if the signal is "Signal 0" or "Trace/breakpoint trap". */ | 86 /* Check if the signal is "Signal 0" or "Trace/breakpoint trap". */ |
| 87 if (stop_signal != TARGET_SIGNAL_0 | 87 if (stop_signal != GDB_SIGNAL_0 |
| 88 && stop_signal != TARGET_SIGNAL_TRAP) | 88 && stop_signal != GDB_SIGNAL_TRAP) |
| 89 { | 89 { |
| 90 stop_event_obj = | 90 stop_event_obj = |
| 91 create_signal_event_object (stop_signal); | 91 create_signal_event_object (stop_signal); |
| 92 if (!stop_event_obj) | 92 if (!stop_event_obj) |
| 93 goto fail; | 93 goto fail; |
| 94 } | 94 } |
| 95 | 95 |
| 96 /* If all fails emit an unknown stop event. All event types should | 96 /* If all fails emit an unknown stop event. All event types should |
| 97 be known and this should eventually be unused. */ | 97 be known and this should eventually be unused. */ |
| 98 if (!stop_event_obj) | 98 if (!stop_event_obj) |
| 99 { | 99 { |
| 100 stop_event_obj = create_stop_event_object (&stop_event_object_type); | 100 stop_event_obj = create_stop_event_object (&stop_event_object_type); |
| 101 if (!stop_event_obj) | 101 if (!stop_event_obj) |
| 102 goto fail; | 102 goto fail; |
| 103 } | 103 } |
| 104 | 104 |
| 105 return evpy_emit_event (stop_event_obj, gdb_py_events.stop); | 105 return evpy_emit_event (stop_event_obj, gdb_py_events.stop); |
| 106 | 106 |
| 107 fail: | 107 fail: |
| 108 Py_XDECREF (list); | 108 Py_XDECREF (list); |
| 109 return -1; | 109 return -1; |
| 110 } | 110 } |
| 111 | 111 |
| 112 GDBPY_NEW_EVENT_TYPE (stop, | 112 GDBPY_NEW_EVENT_TYPE (stop, |
| 113 "gdb.StopEvent", | 113 "gdb.StopEvent", |
| 114 "StopEvent", | 114 "StopEvent", |
| 115 "GDB stop event object", | 115 "GDB stop event object", |
| 116 thread_event_object_type, | 116 thread_event_object_type, |
| 117 /*no qual*/); | 117 /*no qual*/); |
| OLD | NEW |