0

I have been trying to remotely debug an application which can only be run on a specific server because of hardware limitations. To normally run the program I would login to an ssh shell with X.11 forwarding enabled (-X option of ssh) and its QT interface will show up.

I have been trying to achieve the same but with no success while debugging via gdb with the gdbserver and the integrated gdb client of Eclipse IDE.

Is there a way to achieve this?

I have already tried to copy the settings of the system variables DISPLAY and XDG_RUNTIME_DIR of an ssh -X session (the later being empty) but with no success. Searching for it gives no relatable results (or I may need a hint on what to search).

  • Did you try [emacs](https://www.gnu.org/software/emacs/)? You could run it on the remote Linux server, and start `gdb` from it. – Basile Starynkevitch Aug 21 '18 at 07:37
  • I did not as I am not really familiar at all with emacs (and I would have to set at least 20 other environmental variables). My understanding is that if emacs can use gdbserver with graphical ui then it is generally possible which means it must also exist a way for eclipse to do it. – Georgios Leventis Aug 21 '18 at 07:47

1 Answers1

0

It's not the cleanest solution, but you can manually set the DISPLAY variable in /etc/environment. Variables set in /etc/environment are available to the entire system. You'll need to reboot the server before gdb will see it.

See: https://help.ubuntu.com/community/EnvironmentVariables#A.2Fetc.2Fenvironment

Here's a one-liner to append your current DISPLAY variable

echo "DISPLAY=$DISPLAY" >> /etc/environment
  • That would not be possible as except of not being a not clean solution it would affect all the other people working on the same server (it is a shared staging machine) and even if I wanted I do not have the credentials to change such a system wide setting on the server. – Georgios Leventis Oct 13 '20 at 17:55