Add means for accessing locals when MicroPython is built with sys.settrace
sys.settrace is a great step towards having a usable MicroPython debugger, but as long as it's not possible to query local variables, people can't replace their print-debugging with a debugger based on sys.settrace.
My proposal is to somehow expose locals when sys.settrace is enabled. It doesn't need to be a Dict[str, Any]. If the exact rules are published for mapping local names to positions in an array, the debugger can still present a conventional view to the user. It's alright if some locals (eg. created by constant expressions) don't end up in this array at all, as long as the rules are clear.
If something like this gets done, then I'd do my best to create a beginner-friendly MicroPython debugger for Thonny IDE.
implement sys.settrace (or its subset)
We are thinking about implementing sys.settrace or its subset. Currently, the most wanted is the 'line' event (we are trying to create a very simple code-coverage tool using that). I think this feature should be an optional, enabled during the build-time via the compilation flag.
This feature is the first necessary step and can be later expanded to implement https://github.com/micropython/micropython/issues/3009 fully.
Do you have any pointers how to do that or has anyone done any experiments in that area?
// cc @matejcik @jpochyla