← index #3009PR #499
Related · high · value 0.605
QUERY · ISSUE

Add support for PDB debugging module

openby slush0opened 2017-04-09updated 2024-08-02
rfc

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?

CANDIDATE · PULL REQUEST

Draft: Working towards pdb debugging support.

openby andrewleechopened 2022-06-16updated 2025-06-11

Details TBD

Requires: https://github.com/micropython/micropython/pull/8767

3 comments
andrewleech · 2022-06-16

BDB Tested with bdb-example-1.zip / https://gist.github.com/Averroes/a208c5883c601992de08
Output doesn't quite match cpython at this stage, but seems to mostly work.

andrewleech · 2022-06-21
anl@STEP: ~/micropython/ports/unix $ ./micropython-dev -m pdb ../../tests/net_inet/test_tls_sites.py
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(1)<module>()
-> try:
(Pdb) b 48
Breakpoint 1 at /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py:48
(Pdb) c
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(48)main()
-> for site in SITES:
(Pdb) s
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(48)main()
-> for site in SITES:
(Pdb) unt 50
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(50)main()
-> if isinstance(site, dict):
(Pdb) s
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(54)main()
-> try:
(Pdb) s
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(55)main()
-> test_one(site, opts)
(Pdb) s
--Call--
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(14)test_one()
-> def test_one(site, opts):
(Pdb) s
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(15)test_one()
-> ai = _socket.getaddrinfo(site, 443)
(Pdb) s
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(16)test_one()
-> addr = ai[0][-1]
(Pdb) s
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(18)test_one()
-> s = _socket.socket()
(Pdb) s
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(20)test_one()
-> try:
(Pdb) s
> /home/anl/micropython/ports/unix/../../tests/net_inet/test_tls_sites.py(21)test_one()
-> s.connect(addr)
(Pdb) p addr
*** NameError("name 'addr' isn't defined",)
(Pdb) 
andrewleech · 2022-06-21
  • As expected, printing a local variable fails.
  • breakpoints seem to be stopped on the previous line... breaking on a function name main didn't work (presumably because it tried to break on previous line number`
  • pretty easy to crash
(Pdb) exit
FATAL: uncaught NLR 0x7f68a6961fa0

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied