Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: John Darrington <john@darrington.wattle.id.au>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Allow remote debugging over a local domain socket
Date: Fri, 31 Aug 2018 14:59:00 -0000	[thread overview]
Message-ID: <83efee37mg.fsf@gnu.org> (raw)
In-Reply-To: <20180831101818.9175-1-john@darrington.wattle.id.au> (message	from John Darrington on Fri, 31 Aug 2018 12:18:18 +0200)

> From: John Darrington <john@darrington.wattle.id.au>
> Cc: John Darrington <john@darrington.wattle.id.au>
> Date: Fri, 31 Aug 2018 12:18:18 +0200
> 
> Extend the "target remote"  and "target extended-remote" commands
> such that if the filename provided is a unix domain (AF_UNIX)
> socket, then it'll be treated as such, instead of trying to open
> it as if it were a character device.

Thanks.

> +target remote FILENAME
> +target extended-remote FILENAME
> +  If FILENAME is a unix domain socket gdb will attempt to connect
                                        ^
Missing comma.  Also, I believe "unix" should be "Unix" and "gdb"
should be "GDB".

>  @subsection Remote Connection Commands
>  @cindex remote connection commands
> -@value{GDBN} can communicate with the target over a serial line, or
> +@value{GDBN} can communicate with the target over a serial line, a
> +local socket, or

I'd prefer to say "local Unix domain socket" here.

> +@item target remote @var{local-socket}
> +@itemx target extended-remote @var{local-socket}
> +@cindex local socket, @code{target remote}
> +Use @var{local-socket} to communicate with the target.  For example,
> +to use a local socket bound to the file system entry @file{/tmp/gdb-socket0}:

Likewise here.  Alternatively, add a note that this only works on
systems that support Unix domain sockets.

The documentation parts are approved with these fixed.

> +int
> +socket_read_prim (struct serial *scb, size_t count)
> +{
> +  /* Need to cast to silence -Wpointer-sign on MinGW, as Winsock's
> +     'recv' takes 'char *' as second argument, while 'scb->buf' is
> +     'unsigned char *'.  */
> +  return recv (scb->fd, (char *) scb->buf, count, 0);
> +}
> +
> +int
> +socket_write_prim (struct serial *scb, const void *buf, size_t count)
> +{
> +  /* On Windows, the second parameter to send is a "const char *"; on
> +     UNIX systems it is generally "const void *".  The cast to "const
> +     char *" is OK everywhere, since in C++ any data pointer type can
> +     be implicitly converted to "const void *".  */
> +  return send (scb->fd, (const char *) buf, count, 0);
> +}

I'm confused: why does this mention MinGW and Windows, when Windows
doesn't support AF_UNIX (AFAIK)?  Should this stuff even be compiled
on Windows?

> +#ifdef USE_WIN32API
> +  /* Do nothing; Windoze does not have local domain sockets. */

Exactly!

> -    ops = serial_interface_lookup ("hardwire");
> +    {
> +      /* Check to see if name is a socket.  If it is, then treat is
> +         as such.  Otherwise assume that it's a character device.  */
> +      struct stat sb;
> +      if (0 == stat (name, &sb) && ((sb.st_mode & S_IFMT) == S_IFSOCK))

AFAIK, S_IFSOCK is not defined in the MinGW headers, so we need some
replacement definition, or we need to ifdef this away in the Windows
build.

Thanks.


  reply	other threads:[~2018-08-31 14:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29  7:05 Remote debugging over local domain sockets? John Darrington
2018-08-29 15:17 ` Tom Tromey
2018-08-29 15:28   ` John Darrington
2018-08-29 15:39     ` Tom Tromey
2018-08-31 10:18       ` [PATCH] Allow remote debugging over a local domain socket John Darrington
2018-08-31 14:59         ` Eli Zaretskii [this message]
2018-08-31 15:10           ` John Darrington
2018-08-31 17:50             ` Eli Zaretskii
2018-08-31 15:10         ` Tom Tromey
2018-08-31 15:12           ` John Darrington
2018-08-31 16:01         ` Pedro Alves
2018-08-31 16:40           ` John Darrington
2018-09-03 13:19             ` Pedro Alves
2018-09-03 18:49               ` John Darrington
2018-10-01 19:45                 ` Pedro Alves
2018-10-02 10:16                   ` John Darrington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83efee37mg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=john@darrington.wattle.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox