* psymtab.c (PSYMTAB_TO_SYMTAB): Remove.
[deliverable/binutils-gdb.git] / gdb / python / py-event.h
CommitLineData
c17a9e46
HZ
1/* Python interface to inferior events.
2
0b302171 3 Copyright (C) 2009-2012 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
20#ifndef GDB_PY_EVENT_H
21#define GDB_PY_EVENT_H
22
23#include "defs.h"
24#include "py-events.h"
25#include "command.h"
26#include "python-internal.h"
27#include "inferior.h"
28
29/* This macro creates the following functions:
30
31 gdbpy_initialize_{NAME}_event
32 Used to add the newly created event type to the gdb module.
33
34 and the python type data structure for the event:
35
36 struct PyTypeObject {NAME}_event_object_type
37
38 NAME is the name of the event.
39 PY_PATH is a string representing the module and python name of
40 the event.
41 PY_NAME a string representing what the event should be called in
42 python.
43 DOC Python documentation for the new event type
44 BASE the base event for this event usually just event_object_type.
45 QUAL qualification for the create event usually 'static'
46*/
47
48#define GDBPY_NEW_EVENT_TYPE(name, py_path, py_name, doc, base, qual) \
49\
50 qual PyTypeObject name##_event_object_type = \
51 { \
52 PyObject_HEAD_INIT (NULL) \
53 0, /* ob_size */ \
54 py_path, /* tp_name */ \
55 sizeof (event_object), /* tp_basicsize */ \
56 0, /* tp_itemsize */ \
57 evpy_dealloc, /* tp_dealloc */ \
58 0, /* tp_print */ \
59 0, /* tp_getattr */ \
60 0, /* tp_setattr */ \
61 0, /* tp_compare */ \
62 0, /* tp_repr */ \
63 0, /* tp_as_number */ \
64 0, /* tp_as_sequence */ \
65 0, /* tp_as_mapping */ \
66 0, /* tp_hash */ \
67 0, /* tp_call */ \
68 0, /* tp_str */ \
69 0, /* tp_getattro */ \
70 0, /* tp_setattro */ \
71 0, /* tp_as_buffer */ \
72 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ \
73 doc, /* tp_doc */ \
74 0, /* tp_traverse */ \
75 0, /* tp_clear */ \
76 0, /* tp_richcompare */ \
77 0, /* tp_weaklistoffset */ \
78 0, /* tp_iter */ \
79 0, /* tp_iternext */ \
80 0, /* tp_methods */ \
81 0, /* tp_members */ \
82 0, /* tp_getset */ \
83 &base, /* tp_base */ \
84 0, /* tp_dict */ \
85 0, /* tp_descr_get */ \
86 0, /* tp_descr_set */ \
87 0, /* tp_dictoffset */ \
88 0, /* tp_init */ \
89 0 /* tp_alloc */ \
90 }; \
91\
92void \
93gdbpy_initialize_##name##_event (void) \
94{ \
95 gdbpy_initialize_event_generic (&name##_event_object_type, \
96 py_name); \
97}
98
99typedef struct
100{
101 PyObject_HEAD
102
103 PyObject *dict;
104} event_object;
105
106extern int emit_continue_event (ptid_t ptid);
cb6be26b 107extern int emit_exited_event (const LONGEST *exit_code, struct inferior *inf);
c17a9e46
HZ
108
109extern int evpy_emit_event (PyObject *event,
110 eventregistry_object *registry);
111
112extern PyObject *create_event_object (PyTypeObject *py_type);
113extern PyObject *create_thread_event_object (PyTypeObject *py_type);
20c168b5 114extern int emit_new_objfile_event (struct objfile *objfile);
c17a9e46
HZ
115
116extern void evpy_dealloc (PyObject *self);
117extern int evpy_add_attribute (PyObject *event,
118 char *name, PyObject *attr);
119int gdbpy_initialize_event_generic (PyTypeObject *type, char *name);
120
121
122#endif /* GDB_PY_EVENT_H */
This page took 0.169378 seconds and 4 git commands to generate.