diff options
author | Milan Rossa <rossa.milan@gmail.com> | 2019-08-14 16:09:36 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-08-30 16:44:12 +1000 |
commit | 310b3d1b81d561e19d719acd89ee47b759e3795c (patch) | |
tree | 18beb2d50b30dd525fc57efd43a7e705e777fade /py/bc.h | |
parent | c96aedad4691d864c073890a7a20abc7ebd2de27 (diff) |
py: Integrate sys.settrace feature into the VM and runtime.
This commit adds support for sys.settrace, allowing to install Python
handlers to trace execution of Python code. The interface follows CPython
as closely as possible. The feature is disabled by default and can be
enabled via MICROPY_PY_SYS_SETTRACE.
Diffstat (limited to 'py/bc.h')
-rw-r--r-- | py/bc.h | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -60,6 +60,20 @@ // const0 : obj // constN : obj +typedef struct _mp_bytecode_prelude_t { + uint n_state; + uint n_exc_stack; + uint scope_flags; + uint n_pos_args; + uint n_kwonly_args; + uint n_def_pos_args; + qstr qstr_block_name; + qstr qstr_source_file; + const byte *line_info; + const byte *locals; + const byte *opcodes; +} mp_bytecode_prelude_t; + // Exception stack entry typedef struct _mp_exc_stack_t { const byte *handler; @@ -84,6 +98,10 @@ typedef struct _mp_code_state_t { #if MICROPY_STACKLESS struct _mp_code_state_t *prev; #endif + #if MICROPY_PY_SYS_SETTRACE + struct _mp_code_state_t *prev_state; + struct _mp_obj_frame_t *frame; + #endif // Variable-length mp_obj_t state[0]; // Variable-length, never accessed by name, only as (void*)(state + n_state) |