Commit | Line | Data |
---|---|---|
c17a9e46 HZ |
1 | /* Python interface to inferior events. |
2 | ||
42a4f53d | 3 | Copyright (C) 2009-2019 Free Software Foundation, Inc. |
c17a9e46 HZ |
4 | |
5 | This file is part of GDB. | |
6 | ||
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 | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
19 | ||
1a5c2598 TT |
20 | #ifndef PYTHON_PY_EVENT_H |
21 | #define PYTHON_PY_EVENT_H | |
c17a9e46 | 22 | |
c17a9e46 HZ |
23 | #include "py-events.h" |
24 | #include "command.h" | |
25 | #include "python-internal.h" | |
26 | #include "inferior.h" | |
27 | ||
7d221d74 TT |
28 | /* Declare all event types. */ |
29 | #define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \ | |
30 | extern PyTypeObject name##_event_object_type \ | |
31 | CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); | |
32 | #include "py-event-types.def" | |
33 | #undef GDB_PY_DEFINE_EVENT_TYPE | |
c17a9e46 HZ |
34 | |
35 | typedef struct | |
36 | { | |
37 | PyObject_HEAD | |
38 | ||
39 | PyObject *dict; | |
40 | } event_object; | |
41 | ||
42 | extern int emit_continue_event (ptid_t ptid); | |
cb6be26b | 43 | extern int emit_exited_event (const LONGEST *exit_code, struct inferior *inf); |
c17a9e46 | 44 | |
162078c8 NB |
45 | /* For inferior function call events, discriminate whether event is |
46 | before or after the call. */ | |
47 | ||
48 | typedef enum | |
49 | { | |
50 | /* Before the call */ | |
51 | INFERIOR_CALL_PRE, | |
52 | /* after the call */ | |
53 | INFERIOR_CALL_POST, | |
54 | } inferior_call_kind; | |
55 | ||
56 | extern int emit_inferior_call_event (inferior_call_kind kind, | |
57 | ptid_t thread, CORE_ADDR addr); | |
58 | extern int emit_register_changed_event (struct frame_info *frame, | |
59 | int regnum); | |
60 | extern int emit_memory_changed_event (CORE_ADDR addr, ssize_t len); | |
c17a9e46 | 61 | extern int evpy_emit_event (PyObject *event, |
abf5651e | 62 | eventregistry_object *registry); |
c17a9e46 | 63 | |
35c61a1d | 64 | extern gdbpy_ref<> create_event_object (PyTypeObject *py_type); |
da3c8738 PA |
65 | |
66 | /* thread events can either be thread specific or process wide. If gdb is | |
67 | running in non-stop mode then the event is thread specific, otherwise | |
68 | it is process wide. | |
69 | This function returns the currently stopped thread in non-stop mode and | |
db1337cc TT |
70 | Py_None otherwise. */ |
71 | extern gdbpy_ref<> py_get_event_thread (ptid_t ptid); | |
da3c8738 | 72 | |
35c61a1d | 73 | extern gdbpy_ref<> create_thread_event_object (PyTypeObject *py_type, |
da3c8738 PA |
74 | PyObject *thread); |
75 | ||
20c168b5 | 76 | extern int emit_new_objfile_event (struct objfile *objfile); |
4ffbba72 | 77 | extern int emit_clear_objfiles_event (void); |
c17a9e46 HZ |
78 | |
79 | extern void evpy_dealloc (PyObject *self); | |
80 | extern int evpy_add_attribute (PyObject *event, | |
a121b7c1 | 81 | const char *name, PyObject *attr) |
5d153bd1 | 82 | CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; |
a121b7c1 | 83 | int gdbpy_initialize_event_generic (PyTypeObject *type, const char *name) |
5d153bd1 | 84 | CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; |
c17a9e46 | 85 | |
1a5c2598 | 86 | #endif /* PYTHON_PY_EVENT_H */ |