From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23888 invoked by alias); 31 Aug 2018 14:59:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23873 invoked by uid 89); 31 Aug 2018 14:59:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,SPF_PASS autolearn=ham version=3.3.2 spammy=afaik, AFAIK X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 31 Aug 2018 14:59:09 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvkt5-0007so-Od for gdb-patches@sourceware.org; Fri, 31 Aug 2018 10:59:07 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvkt3-0007s6-T4; Fri, 31 Aug 2018 10:59:03 -0400 Received: from [176.228.60.248] (port=2346 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fvkt3-0007zr-FO; Fri, 31 Aug 2018 10:59:01 -0400 Date: Fri, 31 Aug 2018 14:59:00 -0000 Message-Id: <83efee37mg.fsf@gnu.org> From: Eli Zaretskii To: John Darrington CC: gdb-patches@sourceware.org In-reply-to: <20180831101818.9175-1-john@darrington.wattle.id.au> (message from John Darrington on Fri, 31 Aug 2018 12:18:18 +0200) Subject: Re: [PATCH] Allow remote debugging over a local domain socket References: <874lfd5gjt.fsf@tromey.com> <20180831101818.9175-1-john@darrington.wattle.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00860.txt.bz2 > From: John Darrington > Cc: John Darrington > 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.