-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for PDB debugging module #3009
Comments
Everything is possible :) In the case of PDB I think it is difficult to implement it and requires significant changes/additions to the VM.
It's not a priority and to get it started would require someone (likely an additional person to the current team) to perform some initial research and analysis to propose ways to implement PDB support. |
Well, it is getting priority for us in TREZOR; we're building Micropython-based framework for crypto devices and having a debugging features would be really helpful not only for us, but also for framework users later. Considering it is some priority for us and I expect it would be also useful addition into Micropython environment, can you steer me what's the best choice to make it done? I see three general options - open a bounty for pull request, donate directly to Micropython team or implement it by ourselves (least feasible as we don't have free capacity now). What do you prefer? You mentioned some research, so maybe it won't be so straightforward as I imagine, so internal research would be necessary anyway? |
Yes it requires some investigation first before implementation could proceed. Such an investigation can really only be done by someone who has deep knowledge of the internals of the VM and runtime. I just took a quick look at CPython's pdb module. It basically requires 3 layers to implement a debugger:
Each of these steps are non-trivial. Point 1 requires modest changes to the VM and runtime to intercept all the relevant events. It would make the VM less efficient (execution of each opcode needs a check if the trace function is set) so would need to be a compile time option that's disabled by default. It would also require extra work to expose the names of local variables for the debugger (currently, once the code is compiled, the local variable names in a function are lost). Points 2 and 3 require a fair bit of work, and probably it's easiest to start with CPython's implementation and adapt that. I have no doubt that pdb would be a useful feature. At this stage the main thing holding back an implementation is lack of time from someone familiar enough with the code. |
So, we're lucky that Python's locals() doesn't return a live view into local vars, but rather a current snapshot. So, implementing it in uPy would be easier. |
+1 |
|
This is likely to become more of an issue in one of MicroPython's descendents, CircuitPython, as the boards are getting "bigger" now and this is allowing much larger applications to be written. |
…-fix STM32: Rework LSE clock init, allow clock overrides
@dpgeorge I do not see this in the current build was this removed? Any update on progress of adding PDB to the platform? |
MicroPython must be built with |
Thanks @int19h I will git that a try. |
Having (any) debugger in micropython is a "must" for me too. |
I used to think the lack of debugger would be a deal-breaker, but in fact found the new ways of working that are possible changed the way I code. Things like Jupiter notebook live connected to device, and test driven development over mpremote mount have been great, but the thing that beats it all has been aiorepl running in my production app, so I can live interact with it while running. That being said I still use gbd a lot while working on C extensions or internal C code updates and there are some things I'd love the python debugger in vscode to just work for, but have been very low on personal dev time to work in things like this. |
There is now a draft MR at micropython/micropython-lib#499 |
Hello,
I'd like to see support for debugger in Micropython. I know it has been discussed before, but I cannot find any conclusion on that topic from Micropython team. Is even possible to implement PDB support in current Micropython codebase?
If so, what is needed to make it happen? Do the project need more manpower for this task or is it matter of priority or money?
The text was updated successfully, but these errors were encountered: