tools/mpy-tool.py: Fix freezing of non-bytecode funcs with settrace.

Only bytecode functions can be profiled at this stage.  Native functions
(eg inline assembler) may not even have a valid prelude.

Fixes issue #5075.
pull/1/head
Damien George 2019-09-06 23:55:15 +10:00
parent bd2e46e0a5
commit c69f58e6b9
1 changed files with 17 additions and 16 deletions

View File

@ -412,6 +412,7 @@ class RawCode(object):
print(' .fun_data_len = %u,' % len(self.bytecode))
print(' .n_obj = %u,' % len(self.objs))
print(' .n_raw_code = %u,' % len(self.raw_codes))
if self.code_kind == MP_CODE_BYTECODE:
print(' #if MICROPY_PY_SYS_SETTRACE')
print(' .prelude = {')
print(' .n_state = %u,' % self.prelude[0])