Re: howto? gdb --> AF_UNIX --> gdbserver

Martin Simmons <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
>>>>> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.