diff options
author | Mark Shannon <mark@hotpy.org> | 2023-05-12 11:21:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-12 11:21:20 (GMT) |
commit | 45f5aa8fc73acf516071d52ef8213532f0381316 (patch) | |
tree | bc1f7219305185a7befef7003688d7a4359f98e4 /Include | |
parent | 19ee53d52e8adf267dfd588c2142967734a3b65a (diff) | |
download | cpython-45f5aa8fc73acf516071d52ef8213532f0381316.zip cpython-45f5aa8fc73acf516071d52ef8213532f0381316.tar.gz cpython-45f5aa8fc73acf516071d52ef8213532f0381316.tar.bz2 |
GH-103082: Filter LINE events in VM, to simplify tool implementation. (GH-104387)
When monitoring LINE events, instrument all instructions that can have a predecessor on a different line.
Then check that the a new line has been hit in the instrumentation code.
This brings the behavior closer to that of 3.11, simplifying implementation and porting of tools.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_frame.h | 1 | ||||
-rw-r--r-- | Include/internal/pycore_instruments.h | 5 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Include/internal/pycore_frame.h b/Include/internal/pycore_frame.h index 3d3cbbf..a72e03f 100644 --- a/Include/internal/pycore_frame.h +++ b/Include/internal/pycore_frame.h @@ -19,7 +19,6 @@ 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? */ diff --git a/Include/internal/pycore_instruments.h b/Include/internal/pycore_instruments.h index e94d875..9fb3952 100644 --- a/Include/internal/pycore_instruments.h +++ b/Include/internal/pycore_instruments.h @@ -69,13 +69,13 @@ _Py_call_instrumentation(PyThreadState *tstate, int event, extern int _Py_call_instrumentation_line(PyThreadState *tstate, _PyInterpreterFrame* frame, - _Py_CODEUNIT *instr); + _Py_CODEUNIT *instr, _Py_CODEUNIT *prev); extern int _Py_call_instrumentation_instruction( PyThreadState *tstate, _PyInterpreterFrame* frame, _Py_CODEUNIT *instr); -int +_Py_CODEUNIT * _Py_call_instrumentation_jump( PyThreadState *tstate, int event, _PyInterpreterFrame *frame, _Py_CODEUNIT *instr, _Py_CODEUNIT *target); @@ -100,6 +100,7 @@ extern int _Py_Instrumentation_GetLine(PyCodeObject *code, int index); extern PyObject _PyInstrumentation_MISSING; +extern PyObject _PyInstrumentation_DISABLE; #ifdef __cplusplus } |