Debian Codegraph @

Include/internal/pycore_instruments.h

raw
1 #ifndef Py_INTERNAL_INSTRUMENT_H
2 #define Py_INTERNAL_INSTRUMENT_H
3
4 #ifndef Py_BUILD_CORE
5 # error "this header requires Py_BUILD_CORE define"
6 #endif
7
8 #include "pycore_frame.h" // _PyInterpreterFrame
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 #define PY_MONITORING_TOOL_IDS 8
15
16 typedef uint32_t _PyMonitoringEventSet;
17
18 /* Tool IDs */
19
20 /* These are defined in PEP 669 for convenience to avoid clashes */
21 #define PY_MONITORING_DEBUGGER_ID 0
22 #define PY_MONITORING_COVERAGE_ID 1
23 #define PY_MONITORING_PROFILER_ID 2
24 #define PY_MONITORING_OPTIMIZER_ID 5
25
26 /* Internal IDs used to suuport sys.setprofile() and sys.settrace() */
27 #define PY_MONITORING_SYS_PROFILE_ID 6
28 #define PY_MONITORING_SYS_TRACE_ID 7
29
30
31 PyObject *_PyMonitoring_RegisterCallback(int tool_id, int event_id, PyObject *obj);
32
33 int _PyMonitoring_SetEvents(int tool_id, _PyMonitoringEventSet events);
34 int _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEventSet events);
35 int _PyMonitoring_GetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEventSet *events);
36
37 extern int
38 _Py_call_instrumentation(PyThreadState *tstate, int event,
39 _PyInterpreterFrame *frame, _Py_CODEUNIT *instr);
40
41 extern int
42 _Py_call_instrumentation_line(PyThreadState *tstate, _PyInterpreterFrame* frame,
43 _Py_CODEUNIT *instr, _Py_CODEUNIT *prev);
44
45 extern int
46 _Py_call_instrumentation_instruction(
47 PyThreadState *tstate, _PyInterpreterFrame* frame, _Py_CODEUNIT *instr);
48
49 _Py_CODEUNIT *
50 _Py_call_instrumentation_jump(
51 PyThreadState *tstate, int event,
52 _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, _Py_CODEUNIT *target);
53
54 extern int
55 _Py_call_instrumentation_arg(PyThreadState *tstate, int event,
56 _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, PyObject *arg);
57
58 extern int
59 _Py_call_instrumentation_2args(PyThreadState *tstate, int event,
60 _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, PyObject *arg0, PyObject *arg1);
61
62 extern void
63 _Py_call_instrumentation_exc2(PyThreadState *tstate, int event,
64 _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, PyObject *arg0, PyObject *arg1);
65
66 extern int
67 _Py_Instrumentation_GetLine(PyCodeObject *code, int index);
68
69 extern PyObject _PyInstrumentation_MISSING;
70 extern PyObject _PyInstrumentation_DISABLE;
71
72 #ifdef __cplusplus
73 }
74 #endif
75 #endif /* !Py_INTERNAL_INSTRUMENT_H */