| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Expand Up | @@ -19,6 +19,7 @@ struct _frame { | |||||||||||||
| struct _PyInterpreterFrame *f_frame; /* points to the frame data */ | ||||||||||||||
| PyObject *f_trace; /* Trace function */ | ||||||||||||||
| int f_lineno; /* Current line number. Only valid if non-zero */ | ||||||||||||||
| int f_last_traced_line; /* The last line traced for this frame */ | ||||||||||||||
| char f_trace_lines; /* Emit per-line trace events? */ | ||||||||||||||
| char f_trace_opcodes; /* Emit per-opcode trace events? */ | ||||||||||||||
| char f_fast_as_locals; /* Have the fast locals of this frame been converted to a dict? */ | ||||||||||||||
| Expand Down Expand Up | @@ -137,10 +138,16 @@ _PyFrame_GetLocalsArray(_PyInterpreterFrame *frame) | |||||||||||||
| return frame->localsplus; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| /* Fetches the stack pointer, and sets stacktop to -1. | ||||||||||||||
| Having stacktop <= 0 ensures that invalid | ||||||||||||||
| values are not visible to the cycle GC. | ||||||||||||||
| We choose -1 rather than 0 to assist debugging. */ | ||||||||||||||
|
Comment thread
Comment on lines
+142
to
+144
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
Sorry, something went wrong.
All reactions
|
||||||||||||||
| static inline PyObject** | ||||||||||||||
| _PyFrame_GetStackPointer(_PyInterpreterFrame *frame) | ||||||||||||||
| { | ||||||||||||||
| return frame->localsplus+frame->stacktop; | ||||||||||||||
| PyObject **sp = frame->localsplus + frame->stacktop; | ||||||||||||||
| frame->stacktop = -1; | ||||||||||||||
| return sp; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| static inline void | ||||||||||||||
| Expand Down | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
|
|
||
| #ifndef Py_INTERNAL_INSTRUMENT_H | ||
| #define Py_INTERNAL_INSTRUMENT_H | ||
|
|
||
|
|
||
| #include "pycore_bitutils.h" // _Py_popcount32 | ||
| #include "pycore_frame.h" | ||
|
|
||
| #include "cpython/code.h" | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| #define PY_MONITORING_TOOL_IDS 8 | ||
|
|
||
| /* Local events. | ||
| * These require bytecode instrumentation */ | ||
|
|
||
| #define PY_MONITORING_EVENT_PY_START 0 | ||
| #define PY_MONITORING_EVENT_PY_RESUME 1 | ||
| #define PY_MONITORING_EVENT_PY_RETURN 2 | ||
| #define PY_MONITORING_EVENT_PY_YIELD 3 | ||
| #define PY_MONITORING_EVENT_CALL 4 | ||
| #define PY_MONITORING_EVENT_LINE 5 | ||
| #define PY_MONITORING_EVENT_INSTRUCTION 6 | ||
| #define PY_MONITORING_EVENT_JUMP 7 | ||
| #define PY_MONITORING_EVENT_BRANCH 8 | ||
| #define PY_MONITORING_EVENT_STOP_ITERATION 9 | ||
|
|
||
| #define PY_MONITORING_INSTRUMENTED_EVENTS 10 | ||
|
|
||
| /* Other events, mainly exceptions */ | ||
|
|
||
| #define PY_MONITORING_EVENT_RAISE 10 | ||
| #define PY_MONITORING_EVENT_EXCEPTION_HANDLED 11 | ||
| #define PY_MONITORING_EVENT_PY_UNWIND 12 | ||
| #define PY_MONITORING_EVENT_PY_THROW 13 | ||
|
|
||
|
|
||
| /* Ancilliary events */ | ||
|
|
||
| #define PY_MONITORING_EVENT_C_RETURN 14 | ||
| #define PY_MONITORING_EVENT_C_RAISE 15 | ||
|
|
||
|
|
||
| typedef uint32_t _PyMonitoringEventSet; | ||
|
|
||
| /* Tool IDs */ | ||
|
|
||
| /* These are defined in PEP 669 for convenience to avoid clashes */ | ||
| #define PY_MONITORING_DEBUGGER_ID 0 | ||
| #define PY_MONITORING_COVERAGE_ID 1 | ||
| #define PY_MONITORING_PROFILER_ID 2 | ||
| #define PY_MONITORING_OPTIMIZER_ID 5 | ||
|
|
||
| /* Internal IDs used to suuport sys.setprofile() and sys.settrace() */ | ||
| #define PY_MONITORING_SYS_PROFILE_ID 6 | ||
| #define PY_MONITORING_SYS_TRACE_ID 7 | ||
|
|
||
|
|
||
| PyObject *_PyMonitoring_RegisterCallback(int tool_id, int event_id, PyObject *obj); | ||
|
|
||
| int _PyMonitoring_SetEvents(int tool_id, _PyMonitoringEventSet events); | ||
|
|
||
| extern int | ||
| _Py_call_instrumentation(PyThreadState *tstate, int event, | ||
| _PyInterpreterFrame *frame, _Py_CODEUNIT *instr); | ||
|
|
||
| extern int | ||
| _Py_call_instrumentation_line(PyThreadState *tstate, _PyInterpreterFrame* frame, | ||
| _Py_CODEUNIT *instr); | ||
|
|
||
| extern int | ||
| _Py_call_instrumentation_instruction( | ||
| PyThreadState *tstate, _PyInterpreterFrame* frame, _Py_CODEUNIT *instr); | ||
|
|
||
| int | ||
| _Py_call_instrumentation_jump( | ||
| PyThreadState *tstate, int event, | ||
| _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, _Py_CODEUNIT *target); | ||
|
|
||
| extern int | ||
| _Py_call_instrumentation_arg(PyThreadState *tstate, int event, | ||
| _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, PyObject *arg); | ||
|
|
||
| extern int | ||
| _Py_call_instrumentation_2args(PyThreadState *tstate, int event, | ||
| _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, PyObject *arg0, PyObject *arg1); | ||
|
|
||
| extern void | ||
| _Py_call_instrumentation_exc0(PyThreadState *tstate, int event, | ||
| _PyInterpreterFrame *frame, _Py_CODEUNIT *instr); | ||
|
|
||
| extern void | ||
| _Py_call_instrumentation_exc2(PyThreadState *tstate, int event, | ||
| _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, PyObject *arg0, PyObject *arg1); | ||
|
|
||
| extern int | ||
| _Py_Instrumentation_GetLine(PyCodeObject *code, int index); | ||
|
|
||
| extern PyObject _PyInstrumentation_MISSING; | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
| #endif /* !Py_INTERNAL_INSTRUMENT_H */ |
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.