mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Extend RemoteUnwinder to capture precise bytecode locations
Introduces LocationInfo struct sequence with end_lineno, col_offset, and end_col_offset fields. Adds opcodes parameter to RemoteUnwinder that extracts the currently executing opcode alongside its source span. Refactors linetable parsing to correctly accumulate line numbers separately from output values, fixing edge cases in computed_line.
This commit is contained in:
parent
8801c6dec7
commit
dd27e5e679
5 changed files with 146 additions and 46 deletions
|
|
@ -157,6 +157,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
PyTypeObject *RemoteDebugging_Type;
|
||||
PyTypeObject *TaskInfo_Type;
|
||||
PyTypeObject *LocationInfo_Type;
|
||||
PyTypeObject *FrameInfo_Type;
|
||||
PyTypeObject *CoroInfo_Type;
|
||||
PyTypeObject *ThreadInfo_Type;
|
||||
|
|
@ -195,6 +196,7 @@ typedef struct {
|
|||
int skip_non_matching_threads;
|
||||
int native;
|
||||
int gc;
|
||||
int opcodes;
|
||||
RemoteDebuggingState *cached_state;
|
||||
#ifdef Py_GIL_DISABLED
|
||||
uint32_t tlbc_generation;
|
||||
|
|
@ -248,6 +250,7 @@ typedef int (*set_entry_processor_func)(
|
|||
* ============================================================================ */
|
||||
|
||||
extern PyStructSequence_Desc TaskInfo_desc;
|
||||
extern PyStructSequence_Desc LocationInfo_desc;
|
||||
extern PyStructSequence_Desc FrameInfo_desc;
|
||||
extern PyStructSequence_Desc CoroInfo_desc;
|
||||
extern PyStructSequence_Desc ThreadInfo_desc;
|
||||
|
|
@ -298,11 +301,20 @@ extern int parse_code_object(
|
|||
int32_t tlbc_index
|
||||
);
|
||||
|
||||
extern PyObject *make_location_info(
|
||||
RemoteUnwinderObject *unwinder,
|
||||
int lineno,
|
||||
int end_lineno,
|
||||
int col_offset,
|
||||
int end_col_offset
|
||||
);
|
||||
|
||||
extern PyObject *make_frame_info(
|
||||
RemoteUnwinderObject *unwinder,
|
||||
PyObject *file,
|
||||
PyObject *line,
|
||||
PyObject *func
|
||||
PyObject *location, // LocationInfo structseq or None for synthetic frames
|
||||
PyObject *func,
|
||||
PyObject *opcode
|
||||
);
|
||||
|
||||
/* Line table parsing */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue