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/emitbc.c | |
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/emitbc.c')
-rw-r--r-- | py/emitbc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/py/emitbc.c b/py/emitbc.c index fcbd979d2..ef0d20a10 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -284,6 +284,9 @@ STATIC void emit_write_bytecode_byte_raw_code(emit_t *emit, int stack_adj, byte assert(c == MP_ALIGN(c, sizeof(void*))); *c = rc; #endif + #if MICROPY_PY_SYS_SETTRACE + rc->line_of_definition = emit->last_source_line; + #endif } // unsigned labels are relative to ip following this instruction, stored as 16 bits |