howto? gdb --> AF_UNIX --> gdbserver

Martin Simmons qqxnjvamvxwx@dyxyl.com
Sat Dec 19 17:10:13 GMT 2020


>>>>> On Sat, 19 Dec 2020 15:50:59 +0100, Rick van Rein via Gdb said:
> 
> 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.

You can't do this with gdbserver itself, but you can wrap it with nc,
e.g.

rm $unix-domain-socket
nc -Ul -e "gdbserver --no-startup-with-shell stdio $program-to-debug" $unix-domain-socket


> * 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.

Yes, if the argument to "target remote" is an existing UNIX domain
socket name then gdb will connect to it.

__Martin


More information about the Gdb mailing list