inducer / pudb

Full-screen console debugger for Python
https://documen.tician.de/pudb/
Other
3k stars 230 forks source link

feat: add reverse remote pudb #409

Closed jen6 closed 3 years ago

jen6 commented 4 years ago

Hi PUDB community!

" python debugger
autocmd FileType python nmap <space>db O from pudb.remote import set_trace; set_trace(term_size=(202, 40), host='localhost', port=9999)<esc>
autocmd FileType python nmap <space>dt :TestNearest <cr> <bar>:!sleep 3<cr> <bar> :Start telnet localhost 9999<CR>

This is my vim setting for using the pudb in vim to debug python code. It works well usually. But sometimes telnet cannot connect to pudb because rarely tests need more than three seconds to initialize. I want to solve this but as I know there is no way to receive debugging started for now.

My idea to solve this problem is using reverse telnet.

$ stty -echo -icanon && nc -lcv 9999

Using NC open the port to accept the reverse shell connection, in pudb connect to the reverse shell. It makes no need to wait for the test program ready.

Welcome for opinions. thanks

inducer commented 4 years ago

Thanks for your contribution! I like the idea. A few comments:

jen6 commented 4 years ago

Hi @inducer. It nice you like my idea!

I added reverse parameter in the remote debugger and remove duplicate code in reverse_remote.py . Also added description in starting.rst

jen6 commented 3 years ago

@inducer I applied your suggestion. Please check it.

inducer commented 3 years ago

Thanks for your contribution!