[PATCH] Allow remote debugging over a Unix local domain socket.

Tom Tromey tom@tromey.com
Fri Sep 7 21:06:00 GMT 2018


>>>>> "John" == John Darrington <john@darrington.wattle.id.au> writes:

John> Extend the "target remote" and "target extended-remote" commands
John> such that if the filename provided is a Unix local domain (AF_UNIX)
John> socket, then it'll be treated as such, instead of trying to open
John> it as if it were a character device.

I think Pedro should have the final review on this, since he had more
comments the last time around.

John> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
John> index 5068c0ac81..dae62c1787 100644
John> --- a/gdb/doc/gdb.texinfo
John> +++ b/gdb/doc/gdb.texinfo
John> @@ -20703,7 +20703,8 @@ programs.
 
John>  @code{target} command.
 
John> +
John> +@item target remote @var{local-socket}
John> +@itemx target extended-remote @var{local-socket}

That looked like one extra newline in there to me.

John> +#ifndef UNIX_MAX_PATH
John> +# define UNIX_MAX_PATH 108
John> +#endif

As mentioned before, use the sizeof thing.
Now that there are 3 copies of this in gdb, it would be good to unify
them somewhere in common/.

I see:

./gdbserver/tracepoint.c6861:#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *) NULL)->sun_path)
./common/agent.c131:#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *) NULL)->sun_path)

The linux unix(7) man page has some stuff to say about the sizes.

In another message you said:

John> I thought posix required a minimum of 108.

I don't know, but if other platforms do it differently, then gdb has to
adapt to them and not just go by POSIX.

One alternative in these cases is to see if there is a gnulib module we
could use.

thanks,
Tom



More information about the Gdb-patches mailing list