GDB (xrefs)
Loading...
Searching...
No Matches
py-event.h
Go to the documentation of this file.
1/* Python interface to inferior events.
2
3 Copyright (C) 2009-2023 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 PYTHON_PY_EVENT_H
21#define PYTHON_PY_EVENT_H
22
23#include "py-events.h"
24#include "command.h"
25#include "python-internal.h"
26#include "inferior.h"
27
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
34
36{
37 PyObject_HEAD
38
40};
41
42extern int emit_continue_event (ptid_t ptid);
43extern int emit_exited_event (const LONGEST *exit_code, struct inferior *inf);
44
45/* For inferior function call events, discriminate whether event is
46 before or after the call. */
47
49{
50 /* Before the call */
52 /* after the call */
54};
55
57 ptid_t thread, CORE_ADDR addr);
59 int regnum);
60extern int emit_memory_changed_event (CORE_ADDR addr, ssize_t len);
61extern int evpy_emit_event (PyObject *event,
63
64/* Emits a thread exit event for THREAD */
65extern int emit_thread_exit_event (thread_info * thread);
66
67extern gdbpy_ref<> create_event_object (PyTypeObject *py_type);
68
69/* thread events can either be thread specific or process wide. If gdb is
70 running in non-stop mode then the event is thread specific, otherwise
71 it is process wide.
72 This function returns the currently stopped thread in non-stop mode and
73 Py_None otherwise. */
74extern gdbpy_ref<> py_get_event_thread (ptid_t ptid);
75
76extern gdbpy_ref<> create_thread_event_object (PyTypeObject *py_type,
77 PyObject *thread);
78
79extern int emit_new_objfile_event (struct objfile *objfile);
80extern int emit_free_objfile_event (struct objfile *objfile);
81extern int emit_clear_objfiles_event (program_space *pspace);
82
83extern void evpy_dealloc (PyObject *self);
84extern int evpy_add_attribute (PyObject *event,
85 const char *name, PyObject *attr)
87int gdbpy_initialize_event_generic (PyTypeObject *type, const char *name)
89
90#endif /* PYTHON_PY_EVENT_H */
int regnum
const char *const name
gdbpy_ref create_thread_event_object(PyTypeObject *py_type, PyObject *thread)
int gdbpy_initialize_event_generic(PyTypeObject *type, const char *name) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
Definition py-event.c:69
int emit_inferior_call_event(inferior_call_kind kind, ptid_t thread, CORE_ADDR addr)
int evpy_add_attribute(PyObject *event, const char *name, PyObject *attr) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
Definition py-event.c:50
int emit_clear_objfiles_event(program_space *pspace)
int emit_memory_changed_event(CORE_ADDR addr, ssize_t len)
int emit_continue_event(ptid_t ptid)
gdbpy_ref py_get_event_thread(ptid_t ptid)
int emit_register_changed_event(frame_info_ptr frame, int regnum)
void evpy_dealloc(PyObject *self)
Definition py-event.c:24
int emit_new_objfile_event(struct objfile *objfile)
int emit_exited_event(const LONGEST *exit_code, struct inferior *inf)
gdbpy_ref create_event_object(PyTypeObject *py_type)
Definition py-event.c:31
int emit_free_objfile_event(struct objfile *objfile)
inferior_call_kind
Definition py-event.h:49
@ INFERIOR_CALL_POST
Definition py-event.h:53
@ INFERIOR_CALL_PRE
Definition py-event.h:51
int evpy_emit_event(PyObject *event, eventregistry_object *registry)
Definition py-event.c:83
int emit_thread_exit_event(thread_info *thread)
gdb::ref_ptr< T, gdbpy_ref_policy< T > > gdbpy_ref
Definition py-ref.h:42
#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
PyObject_HEAD PyObject * dict
Definition py-event.h:39
Definition gnu-nat.c:153
int PyObject
Definition varobj.c:41