inducer / pudb

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

Finding terminal size for remote debugging #485

Open rh-jelabarre opened 2 years ago

rh-jelabarre commented 2 years ago

Back a few months ago (March/April 2021 time frame) I used to use PUDB debugger, and it would fit itself to the size of my terminal window. Now I am finding it will only display 25 lines by 80 columns. I have tried different $TERM values, but it doesn't change what I get.

This is a remote connection (ssh to remote system). I have tried this in a "tmux" session as well as a regular ssh session under Gnome-terminal and xterm. Tested with $TERM unset, as well as xterm-256color, xterm, gnome, linux, and screen-256color (tmux automatically sets $TERM=screen).

I don't have a simplified script to sun as a test, so the only option I have to try this is a full Tempest testcase, and I have to just close the terminal window so that I don't have to wait for the full testcase to run.

I'm presuming pudb must have a preferred terminal type. I also uninstalled pudb along with it's dependencies and reinstalled.

inducer commented 2 years ago

I should preface this by saying that getting terminal sizes for remote pudb is not an actually solvable problem, AFAICT. All that we have is heuristics. This is the current edition of that heuristic:

https://github.com/inducer/pudb/blob/9c8a1408a5a88ff1015187c1e1529cfd40e06512/pudb/remote.py#L208-L214

At the very least, you can simply pass in the terminal size, and it'll use that. Or maybe you'll be able to help determine why the heuristic fails in your use case and what about it could be improved.

mvanderkamp commented 2 years ago

I'm actually a bit confused about this heuristic. It looks like it will grab the size of the terminal in which the program is executing, but if we're using remote debugging won't the pudb instance show up in a completely different terminal? So this would only be correct if the new terminal happened to be the same size. I just tried it out and that does seem to be the case- if I use a smaller terminal to telnet into pudb than I used to run the program, it does not render correctly.

inducer commented 2 years ago

Yep, that's the assumption. The idea behind the heuristic is that you have both running in two tabs of the same terminal.

mvanderkamp commented 2 years ago

ahhh okay thank you.