pudb icon indicating copy to clipboard operation
pudb copied to clipboard

Finding terminal size for remote debugging

Open rh-jelabarre opened this issue 2 years ago • 4 comments

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.

rh-jelabarre avatar Nov 12 '21 20:11 rh-jelabarre

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.

inducer avatar Nov 12 '21 20:11 inducer

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.

mvanderkamp avatar Nov 13 '21 18:11 mvanderkamp

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

inducer avatar Nov 14 '21 01:11 inducer

ahhh okay thank you.

mvanderkamp avatar Nov 14 '21 02:11 mvanderkamp