public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Tom Tromey <tom@tromey.com>,
	Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 4/4] gnulib: import select
Date: Thu, 10 Jun 2021 00:30:28 +0100	[thread overview]
Message-ID: <60800830-8909-07a4-3357-b01ac66b44fc@palves.net> (raw)
In-Reply-To: <YMEJL8R3FFKFdYpm@vapier>

On 2021-06-09 7:32 p.m., Mike Frysinger wrote:
> On 09 Jun 2021 19:12, Pedro Alves wrote:
>> On 2021-06-09 5:52 p.m., Mike Frysinger wrote:
>>> On 09 Jun 2021 13:27, Pedro Alves wrote:
>>>> I've always feared that gnulib's select module would conflict with that,
>>>> but I don't know for sure.  In theory, we should be able to replace all
>>>> that code by using gnulib's select instead, though I'm not sure gnulib
>>>> handles some particulars like Ctrl-C interruption.
>>>
>>> why do you think it would conflict ?  the file doesn't seem to use select()
>>> at all, and ser-mingw is always enabled for mingw targets.  seems like the
>>> func would just be ignored.
>>
>> gnulib also sometimes replaces headers with their own incompatible
>> definitions.
> 
> good point, but i'm not sure how that matters to ser-mingw specifically.
> it isn't including any select.h related headers, just Windows-specific ones.

I meant to also point at mingw-hdep.c, which is where gdb_select implementation lives.
That of course, includes sys/select.h via gdb_select.h.
I misremembered that gdb_select itself was in ser-mingw.c too.  mingw's version
of gdb_select is built on top of the ser-mingw.c and struct serial, but lives
in mingw-hdep.c.

Also, the sockets module was pulled in as well as dependency, and I suppose that hides the SOCKET vs
int, close vs closesocket, _get_osfhandle, read/write vs send/recv etc. WinSock2 particularities,
and don't know whether that can cause issues in the code that we have that assumes native Windows
sockets on mingw, which you'll find a lot of if you look for USE_WIN32API, particularly in
gdbserver and gdbreplay.

If it does, it may not be noticeable with a build-only check.

Even if it doesn't, there's now a lot of USE_WIN32API code in gdb, gdbsupport
and gdbserver that is now ripe for cleansing.  In addition to close vs closesocket, read vs send
etc I mentioned above, there should be no need anymore to include the windows/winsock headers to
get access to sockets things, we should call gl_sockets_startup instead of WSAStartup, etc.

> i haven't gone through that list (and indirect includes) explicitly.  but i
> would expect the build to at least warn or fail if that were the case.
> 
> did you have any specific concerns here ?  or just aiming for due diligence
> with the testsuite to assuage general unease ?

The latter, but I wasn't thinking of a testsuite run, which is notoriously difficult
on Windows.  More like a smoke test, run GDB, to make sure you can still debug something.

Also, a quick check to make sure remote debugging against a Windows GDBserver built
from master still works would be good -- gdbserver also uses gnulib, and uses select
(not gdb_select) and sockets.

Interestingly, this module import may have put us closer to removing the Windows
gdbserver limitation that it only works with tcp/ip socket connections, particularly
interesting being pipes, for "target remote | gdbserver" support.

Thanks,
Pedro Alves

  reply	other threads:[~2021-06-09 23:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-29 17:25 [PATCH 1/4] gnulib: import chown Mike Frysinger
2021-05-29 17:25 ` [PATCH 2/4] sim: v850: assume chown is available Mike Frysinger
2021-05-29 17:25 ` [PATCH 3/4] gnulib: import netdb Mike Frysinger
2021-06-07 14:27   ` Tom Tromey
2021-05-29 17:25 ` [PATCH 4/4] gnulib: import select Mike Frysinger
2021-06-07 14:29   ` Tom Tromey
2021-06-08  4:52     ` Mike Frysinger
2021-06-08 12:37       ` Tom Tromey
2021-06-09 12:27       ` Pedro Alves
2021-06-09 16:52         ` Mike Frysinger
2021-06-09 18:12           ` Pedro Alves
2021-06-09 18:32             ` Mike Frysinger
2021-06-09 23:30               ` Pedro Alves [this message]
2021-06-10  0:38                 ` Mike Frysinger
2021-06-10 18:11                   ` Tom Tromey
2021-06-07 14:23 ` [PATCH 1/4] gnulib: import chown Tom Tromey
2021-06-07 14:31   ` Eli Zaretskii
2021-06-08  1:15     ` Mike Frysinger
2021-06-08  2:32       ` Eli Zaretskii
2021-06-08  4:14         ` Mike Frysinger

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=60800830-8909-07a4-3357-b01ac66b44fc@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).