[RFC 00/17] Merge event loop implementations
Eli Zaretskii
eliz@gnu.org
Sun Feb 24 17:14:00 GMT 2019
> From: Tom Tromey <tom@tromey.com>
> Date: Sun, 24 Feb 2019 09:51:36 -0700
>
> The second unresolved issue involves the USE_WIN32API code. Before
> this series, gdbserver used gdb_fildes_t, defined like:
>
> #if USE_WIN32API
> #include <winsock2.h>
> typedef SOCKET gdb_fildes_t;
> #else
> typedef int gdb_fildes_t;
> #endif
>
> gdb did not use this approach, but does have a separate gdb_select
> implementation in mingw-hdep.c, which gdbserver does not.
>
> I don't know much about Windows, so I don't know why these things are
> needed. I did a build using " --host=i686-w64-mingw32
> --target=i686-w64-mingw32", and everything built just fine using a
> POSIX-style API.
>
> Given that, I removed gdb_fildes_t in this series. However, perhaps
> it is still needed and this series needs some more work. I could use
> some advice here -- when is this code actually needed and is there a
> way I can reproduce any problems? I don't have a Windows host, so I'm
> hoping for some sort of compile-time error using a mingw cross.
The problem here is that Windows' implementation of 'select' works
only on sockets, and wants HSOCKET handles instead of file
descriptors. If you feed it a file descriptor, it won't work, even if
the descriptor is for a socket.
I cannot really tell, by reading the patches, what code would
gdbserver on Windows use after this series, so I don't know whether it
will be broken or not. But one thing I do see is that mingw-hdep.c
doesn't support waiting on write descriptors, whereas gdbserver's
event-loop.c seems to support that.
More information about the Gdb-patches
mailing list