Re: [RFC 00/17] Merge event loop implementations

Pedro Alves
2019-09-27T14:05:35Z

On 9/27/19 2:53 PM, Pedro Alves wrote:
> On 9/27/19 12:09 AM, Tom Tromey wrote:
>>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>>
>> I'll reply to the rest later, after I absorb it.
>>
>>>> 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.
>>
>> Pedro> This was already discussed. Do I understand correctly that you're
>> Pedro> going to try to replace gdb_select with gnulib's select?
>>
>> Well, that was an idea, but at Cauldron you pointed out that I could
>> test the event loop under Wine. Also, this week I finally got a gdb
>> build working on Windows, so I may just try that instead. My thinking
>> for both of these is that if the code seems to work ok, then there's no
>> reason to attempt the gnulib thing.
>
> Ah, OK. Using the gnulib select would make gdbserver's stdio mode
> usable on Windows too, but that's certainly not something required
> for this patch series. Can always be done at some other time.
>
> What's the plan for gdb_fildes_t then?

FYI, the patch that introduced gdb_fildes_t came from here:

https://sourceware.org/ml/gdb-patches/2010-08/msg00459.html

Here MSDN talks about Unix vs Windows SOCKET types:

https://docs.microsoft.com/en-us/windows/win32/winsock/socket-data-type-2

But, given that gdb (unlike gdbserver), has been using "int"
for sockets on Windows for a long while, and 64-bit Windows
has been a thing for a long while too, I wonder whether in
practice Windows just makes sure that SOCKET handles
fit in 32-bit integers, exactly to avoid porting headaches...

Given that GDB has been using int, I guess that indeed, we
could most probably ignore this issue and get rid of gdb_fildes_t.
I'm not 100% sure of that, but the evidence suggests it.

Thanks,
Pedro Alves