summaryrefslogtreecommitdiff
path: root/py/bc.c
diff options
context:
space:
mode:
authorMilan Rossa <rossa.milan@gmail.com>2019-08-14 16:09:36 +0200
committerDamien George <damien.p.george@gmail.com>2019-08-30 16:44:12 +1000
commit310b3d1b81d561e19d719acd89ee47b759e3795c (patch)
tree18beb2d50b30dd525fc57efd43a7e705e777fade /py/bc.c
parentc96aedad4691d864c073890a7a20abc7ebd2de27 (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.c')
-rw-r--r--py/bc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/bc.c b/py/bc.c
index b178e7c20..7d0b13bd7 100644
--- a/py/bc.c
+++ b/py/bc.c
@@ -119,6 +119,11 @@ void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw
code_state->prev = NULL;
#endif
+ #if MICROPY_PY_SYS_SETTRACE
+ code_state->prev_state = NULL;
+ code_state->frame = NULL;
+ #endif
+
// get params
size_t n_state = mp_decode_uint(&code_state->ip);
code_state->ip = mp_decode_uint_skip(code_state->ip); // skip n_exc_stack