[PATCH] Allow remote debugging over a local domain socket
John Darrington
john@darrington.wattle.id.au
Fri Aug 31 15:10:00 GMT 2018
On Fri, Aug 31, 2018 at 05:58:47PM +0300, Eli Zaretskii wrote:
> +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.
I am told, that the recent versions of Windows 10 do indeed have local
domain sockets. But if you like, I can conditionally include the file
in the SER_HARDWIRE variable. Then the whole issue is moot.
J'
--
Avoid eavesdropping. Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.
More information about the Gdb-patches
mailing list