File indexing completed on 2025-11-19 09:50:48
0001 #ifndef Py_INTERNAL_INSTRUMENT_H
0002 #define Py_INTERNAL_INSTRUMENT_H
0003
0004 #ifndef Py_BUILD_CORE
0005 # error "this header requires Py_BUILD_CORE define"
0006 #endif
0007
0008 #include "pycore_frame.h" // _PyInterpreterFrame
0009
0010 #ifdef __cplusplus
0011 extern "C" {
0012 #endif
0013
0014 #define PY_MONITORING_TOOL_IDS 8
0015
0016 typedef uint32_t _PyMonitoringEventSet;
0017
0018
0019
0020
0021 #define PY_MONITORING_DEBUGGER_ID 0
0022 #define PY_MONITORING_COVERAGE_ID 1
0023 #define PY_MONITORING_PROFILER_ID 2
0024 #define PY_MONITORING_OPTIMIZER_ID 5
0025
0026
0027 #define PY_MONITORING_SYS_PROFILE_ID 6
0028 #define PY_MONITORING_SYS_TRACE_ID 7
0029
0030
0031 PyObject *_PyMonitoring_RegisterCallback(int tool_id, int event_id, PyObject *obj);
0032
0033 int _PyMonitoring_SetEvents(int tool_id, _PyMonitoringEventSet events);
0034 int _PyMonitoring_SetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEventSet events);
0035 int _PyMonitoring_GetLocalEvents(PyCodeObject *code, int tool_id, _PyMonitoringEventSet *events);
0036
0037 extern int
0038 _Py_call_instrumentation(PyThreadState *tstate, int event,
0039 _PyInterpreterFrame *frame, _Py_CODEUNIT *instr);
0040
0041 extern int
0042 _Py_call_instrumentation_line(PyThreadState *tstate, _PyInterpreterFrame* frame,
0043 _Py_CODEUNIT *instr, _Py_CODEUNIT *prev);
0044
0045 extern int
0046 _Py_call_instrumentation_instruction(
0047 PyThreadState *tstate, _PyInterpreterFrame* frame, _Py_CODEUNIT *instr);
0048
0049 _Py_CODEUNIT *
0050 _Py_call_instrumentation_jump(
0051 PyThreadState *tstate, int event,
0052 _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, _Py_CODEUNIT *target);
0053
0054 extern int
0055 _Py_call_instrumentation_arg(PyThreadState *tstate, int event,
0056 _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, PyObject *arg);
0057
0058 extern int
0059 _Py_call_instrumentation_2args(PyThreadState *tstate, int event,
0060 _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, PyObject *arg0, PyObject *arg1);
0061
0062 extern void
0063 _Py_call_instrumentation_exc2(PyThreadState *tstate, int event,
0064 _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, PyObject *arg0, PyObject *arg1);
0065
0066 extern int
0067 _Py_Instrumentation_GetLine(PyCodeObject *code, int index);
0068
0069 extern PyObject _PyInstrumentation_MISSING;
0070 extern PyObject _PyInstrumentation_DISABLE;
0071
0072 #ifdef __cplusplus
0073 }
0074 #endif
0075 #endif