From f33f1aa9d36c4dd2de4e1209ed7a94f14505d981 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 21 Jun 2025 08:26:20 +0200 Subject: unix/coverage: Initialize more code_state fields. When `MICROPY_PY_SYS_SETTRACE` was enabled, a crash was seen in the qemu_mips build. It seems likely that this was due to these added fields not being initialized. Signed-off-by: Jeff Epler --- ports/unix/coverage.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ports/unix/coverage.c') diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c index b041141f0..33e4208d9 100644 --- a/ports/unix/coverage.c +++ b/ports/unix/coverage.c @@ -582,12 +582,24 @@ static mp_obj_t extra_coverage(void) { fun_bc.context = &context; fun_bc.child_table = NULL; fun_bc.bytecode = (const byte *)"\x01"; // just needed for n_state + #if MICROPY_PY_SYS_SETTRACE + struct _mp_raw_code_t rc = {}; + fun_bc.rc = &rc; + #endif mp_code_state_t *code_state = m_new_obj_var(mp_code_state_t, state, mp_obj_t, 1); code_state->fun_bc = &fun_bc; code_state->ip = (const byte *)"\x00"; // just needed for an invalid opcode code_state->sp = &code_state->state[0]; code_state->exc_sp_idx = 0; code_state->old_globals = NULL; + #if MICROPY_STACKLESS + code_state->prev = NULL; + #endif + #if MICROPY_PY_SYS_SETTRACE + code_state->prev_state = NULL; + code_state->frame = NULL; + #endif + mp_vm_return_kind_t ret = mp_execute_bytecode(code_state, MP_OBJ_NULL); mp_printf(&mp_plat_print, "%d %d\n", ret, mp_obj_get_type(code_state->state[0]) == &mp_type_NotImplementedError); } -- cgit v1.2.3