Skip to content
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

Jumpy output #178

Open
stefanct opened this issue Dec 2, 2019 · 3 comments
Open

Jumpy output #178

stefanct opened this issue Dec 2, 2019 · 3 comments

Comments

@stefanct
Copy link

stefanct commented Dec 2, 2019

As briefly discussed in #59 and #174 the unsteadiness of the output due to dynamically resized panes and the unavoidable output of gdb is a PITA when single-stepping and staring at e.g. variable numbers while they are jumping up and down a few lines.

The only known way to get rid of the Output/messages pane (where messages from GDBs interactive console are printed) - without patching GDB directly - is to use a separate terminal window for dashboard's output via the dashboard -output command. Setting this up for every session is tedious so I automated it:

An additional GDB init script launches a dedicated terminal window automatically by GDB at startup (and cleaned up when it shuts down too). This window is resized to my taste (resized to half the monitor width and snapped to the right) and focus is given back to the window where GDB was launched initially. In a more generic solution the window geometry should probably be configurable including the actual terminal application to use. (The latter is not as easy as one would hope for.) The implementation relies on the wmctrl binary for some of the X11-related operations that I could not implement via xlib or GDK (I tried but this hack took me already waaaaay longer than I would have liked).

Additionally, the script sets a GDB convenience variable named tty to the pty slave (aka PTS) of the new terminal. This variable can then be used as argument to the dashboard -output command (which I do in my "theme"/dashboard customization script). A small change is needed to .gdbinit itself to make this working because the current gdb-dashboard code cannot handle GDB convenience variables. In my hack this functionality is added to the -output command only but it might prove beneficial in other commands as well if there is the need to communicate between scripts (thus I have not submitted it as merge request).

All of the above allows us to keep interacting with GDB's console as before but shows the dashboard output in a distinct window where all the other panes reside. All remaining jumpiness of these panes is due to the lack of fixed- or minimum-sized gdb-dashboard panes whose implementation I hope to motivate a bit with this report ;)

@cyrus-and
Copy link
Owner

I feel that your solution might be unnecessarily complicated, using something like tmux (see an example in this wiki page) could be way easier IMHO. About the convenience variables it would be nice actually that they are expanded pretty much everywhere, but apparently it's not so easy...

Your solution though, makes it impossible to distinguish between a file named tty and the tty convenience variable.

You could simply use eval but there's a gotcha (bug from 2011...):

>>> eval "dashboard -output %s", $tty

Alternatively just use Python:

>>> python gdb.execute('dashboard -output {}'.format(whatever))

All remaining jumpiness of these panes is due to the lack of fixed- or minimum-sized gdb-dashboard panes whose implementation I hope to motivate a bit with this report ;)

I'll think about it thoroughly as soon as I'm a bit less busy.

@stefanct
Copy link
Author

stefanct commented Dec 2, 2019

I feel that your solution might be unnecessarily complicated, using something like tmux (see an example in this wiki page) could be way easier IMHO.

Yes and no. A GDB wrapper destroys the immediate integration (without additional work) when you launch different versions of GDB. The example in the wiki didn't work for me either but I did not bother to try further - not a big fan of tmux anyway. But you are of course right that juggling with an additional X window is way more complicated and possibly not worth it for many.

About the convenience variables it would be nice actually that they are expanded pretty much everywhere, but apparently it's not so easy...

Your solution though, makes it impossible to distinguish between a file named tty and the tty convenience variable.

Yes, indeed but good enough to get it going. I was surprised that a simple dashboard -output $tty did not work out of the box... :/

python gdb.execute('dashboard -output {}'.format(whatever))

Yes, replacing dashboard -output tty with the following would work without the modification in .gdbinit:

py gdb.execute('dashboard -output %s' % str(gdb.convenience_variable("tty")).strip('\"'))

All remaining jumpiness of these panes is due to the lack of fixed- or minimum-sized gdb-dashboard panes whose implementation I hope to motivate a bit with this report ;)

I'll think about it thoroughly as soon as I'm a bit less busy.

Thanks for your consideration and feedback!

@sthornington
Copy link

I just tried this for the first time in a while and yeah, for single-stepping, this is very tedious. I am just about to see if it's possible to put the output window at the bottom so it can use the "excess" space instead of the console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants