Trying to write debugger for MicroPython via settrace (develop it on Python first), but debugging the debugger doesn't work

The idea is as follows - there is no debugger for MicroPython, but MicroPython has now support of sys.settrace. So I was trying to write a debugger using this sys.settrace, first to work on "normal" Python, then adapt the differences onto MicroPython. Because I thought I would have PyCharm debugger while writing my debugger.


PyCharm gives the warning leading to this blogpost:

I understand the basics what is it about, though I was wondering if I could somehow "bend the limitation".

I can already follow the current stack with my settrace code including lines executed which at least offer me possibility of making breakpoints (and dropping REPL shell for example so that user can examine variables and stack).

I was wondering if there was a possibility to have pydevd and sys settraces either somehow separated but running at the same time, or somehow chained to work together.

Another question is if parts of pydevd could be repurposed for MicroPython? It was hard to say after glancing at its sources.

Last option I considered is creating similar GDB macros like "pyframe" or "pystack", but the settrace approach seems much more sane.

Please sign in to leave a comment.