GDB (xrefs)

py-event.h
Go to the documentation of this file.
1 /* Python interface to inferior events.
2
3 Copyright (C) 2009-2018 Free Software Foundation, Inc.
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
20 #ifndef GDB_PY_EVENT_H
21 #define GDB_PY_EVENT_H
22
23 #include "py-events.h"
24 #include "command.h"
25 #include "python-internal.h"
26 #include "inferior.h"
27 #include "py-ref.h"
28
29 /* Declare all event types. */
30 #define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \
31 extern PyTypeObject name##_event_object_type \
32 CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
33 #include "py-event-types.def"
34 #undef GDB_PY_DEFINE_EVENT_TYPE
35
36 typedef struct
37 {
38 PyObject_HEAD
39
40 PyObject *dict;
41 } event_object;
42
43 extern int emit_continue_event (ptid_t ptid);
44 extern int emit_exited_event (const LONGEST *exit_code, struct inferior *inf);
45
46 /* For inferior function call events, discriminate whether event is
47 before or after the call. */
48
49 typedef enum
50 {
51 /* Before the call */
52 INFERIOR_CALL_PRE,
53 /* after the call */
54 INFERIOR_CALL_POST,
55 } inferior_call_kind;
56
57 extern int emit_inferior_call_event (inferior_call_kind kind,
58 ptid_t thread, CORE_ADDR addr);
59 extern int emit_register_changed_event (struct frame_info *frame,
60 int regnum);
61 extern int emit_memory_changed_event (CORE_ADDR addr, ssize_t len);
62 extern int evpy_emit_event (PyObject *event,
63 eventregistry_object *registry);
64
65 extern gdbpy_ref<> create_event_object (PyTypeObject *py_type);
66 extern gdbpy_ref<> create_thread_event_object (PyTypeObject *py_type,
67 PyObject *thread = nullptr);
68 extern int emit_new_objfile_event (struct objfile *objfile);
69 extern int emit_clear_objfiles_event (void);
70
71 extern void evpy_dealloc (PyObject *self);
72 extern int evpy_add_attribute (PyObject *event,
73 const char *name, PyObject *attr)
74 CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
75 int gdbpy_initialize_event_generic (PyTypeObject *type, const char *name)
76 CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
77
78 #endif /* GDB_PY_EVENT_H */
event_object::dict
PyObject_HEAD PyObject * dict
Definition: py-event.h:40
CORE_ADDR
bfd_vma CORE_ADDR
Definition: common-types.h:41
gdbpy_initialize_event_generic
int gdbpy_initialize_event_generic(PyTypeObject *type, const char *name) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
Definition: py-event.c:69
command.h
evpy_dealloc
void evpy_dealloc(PyObject *self)
Definition: py-event.c:24
inferior
Definition: inferior.h:310
event_object
Definition: py-event.h:36
py-events.h
frame_info
Definition: frame.c:85
emit_clear_objfiles_event
int emit_clear_objfiles_event(void)
Definition: py-newobjfileevent.c:90
create_event_object
gdbpy_ref create_event_object(PyTypeObject *py_type)
Definition: py-event.c:31
evpy_emit_event
int evpy_emit_event(PyObject *event, eventregistry_object *registry)
Definition: py-event.c:83
emit_inferior_call_event
int emit_inferior_call_event(inferior_call_kind kind, ptid_t thread, CORE_ADDR addr)
Definition: py-infevents.c:124
name
const char *const name
Definition: aarch64-tdep.c:76
gdb::ref_ptr< T, gdbpy_ref_policy< T > >
emit_exited_event
int emit_exited_event(const LONGEST *exit_code, struct inferior *inf)
Definition: py-exitedevent.c:55
ptid_t
Definition: ptid.h:35
emit_memory_changed_event
int emit_memory_changed_event(CORE_ADDR addr, ssize_t len)
Definition: py-infevents.c:140
inferior.h
type
Definition: gdbtypes.h:749
inf
Definition: gnu-nat.c:174
python-internal.h
emit_register_changed_event
int emit_register_changed_event(struct frame_info *frame, int regnum)
Definition: py-infevents.c:155
eventregistry_object
Definition: py-events.h:30
regnum
int regnum
Definition: aarch64-tdep.c:77
INFERIOR_CALL_POST
Definition: py-event.h:54
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
Definition: python-internal.h:63
emit_new_objfile_event
int emit_new_objfile_event(struct objfile *objfile)
Definition: py-newobjfileevent.c:49
objfile
Definition: objfiles.h:286
INFERIOR_CALL_PRE
Definition: py-event.h:52
inferior_call_kind
inferior_call_kind
Definition: py-event.h:49
create_thread_event_object
gdbpy_ref create_thread_event_object(PyTypeObject *py_type, PyObject *thread=nullptr)
Definition: py-threadevent.c:51
py-ref.h
LONGEST
long long LONGEST
Definition: common-types.h:52
emit_continue_event
int emit_continue_event(ptid_t ptid)
Definition: py-continueevent.c:35
evpy_add_attribute
int evpy_add_attribute(PyObject *event, const char *name, PyObject *attr) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
Definition: py-event.c:50