I am trying to debug an application on a remote environment. Ofcourse running Tramp over gdb works as in https://www.gnu.org/software/emacs/manual/html_node/tramp/Remote-processes.html, but you miss out on source code linking. The frame/stacktrace buffer for example... now you can't click on a frame and go to source code on host machine.
[Host] (Source code) -> compiled binary -> scp binary to remote -> Debug On Remote.
So I tried making gdbserver work. Firstly I made both versions of gdb/gdbserver on both host and remote machine same. 8.3 latest. Now running from terminal:
In Terminal Remote:
$ cd /path/to/folder/
$ gdbserver --multi :44421
gdbserver
starts listening. Also tried entire exercise with gdbserver --no-shell-on-startup --multi :44421
but it results in same thing.
In Host machine TERMINAL:
$ gdb /file/to/executable
gdb> target extended-remote <remote>:44421
gdb> set remote exec-file ./executable
gdb> set args -c config.xml
gdb> r
^This works as expected. Or atleast it starts and i am able to get debug output.
BUT In emacs GBD mode it doesn't work: In HOST machine. EMACS:
M-x gdb RET gdb -i=mi /file/to/executable
gdb> target extended-remote <remote>:44421
gdb> set remote exec-file ./executable
gdb> set args -c config.xml
gdb> r
^This doesn't work. I get output: In Remote Machine:
$ gdbserver...
...
/bin/sh: /path/to/executable/folder/executable: No such file or directory
...
How do I solve this?
- Emacs: 26.3
- GDB: 8.3
- Both machines are centos 7.
- Using spacemacs develop branch as emacs frontend.
Since I do frequently copy executable from host to remote, I do want gdbserver to simply run forever, hence the --multi <port>
use case. And I can do k
from gdb when i need to copy the binary over.