Page 1 of 1

track program execution

Posted: Sun May 15, 2022 6:30 pm
by ardthusiast
Hello, I was wondering if there's a way to track the execution of Micropython code. Similar to this CPython library.

Re: track program execution

Posted: Mon May 16, 2022 1:33 am
by KJM
Thonny has some built it program tracking but I find it's hard to beat a few well placed print statements. See also viewtopic.php?f=2&t=12411

Re: track program execution

Posted: Mon May 16, 2022 8:20 am
by stijn
If you build with MICROPY_PY_SYS_SETTRACE defined (e.g. make CFLAGS_EXTRA="-DMICROPY_PY_SYS_SETTRACE=1") the sys.settrace (https://docs.python.org/3/library/sys.html#sys.settrace) functionality becomes available. Not completely the same as the trace module, but does track all calls. You can use the test to get an idea what the output is: https://github.com/micropython/micropyt ... eatures.py