howto? gdb --> AF_UNIX --> gdbserver

Rick van Rein
Sat Dec 19 14:50:59 GMT 2020


Our project uses a test program [0][1] that automatically runs and
connects test processes.  It would be useful to debug one or more of
these in their connected context.  The best match would be to use a
socket file name relative to the testdir, rather than a numeric port
shared with the entire host.

* I cannot figure out how to tell gdbserver to listen to a UNIX domain
socket at a given filename.  I would expect it to listen, like it does
for TCP sockets, but it complains that the name is missing.

* Using gdb with "target remote", the same thing seems to happen; it
seems to want a pre-existing UNIX domain socket.  This _is_ in line with
the TCP style of connecting.

* The automated tests might benefit from the reverse approach; try to
start gdbserver when it can connect to the UNIX domain socket of the
host, and if not continue with exec() to run the process without
debugger.  This is not how things seem to work, judging from the sparse

* In all cases, both the syntax and available features are unclear and I
am confused after trying the things I can imagine; does a socket need a
prefix "unix:" or "unix::" or does it figure it all out?  An example
flow could be really useful...

The documentation about gdb and gdbserver is not really helping in
answering these questions.  May I suggest extending it?  Happy to
proof-read or, once understood, write some proze that would have helped me.



More information about the Gdb mailing list