Porting GDB-5 to native Windows (using MINGW32)...

Eli Zaretskii eliz@is.elta.co.il
Thu Jun 7 07:40:00 GMT 2001

On Thu, 7 Jun 2001, Joel Brobecker wrote:

> 1) GDB-5 event loop.
>    This part of the code is really UNIX oriented and will be quite difficult  
>    to port to native Windows platforms. The main problem is the use of a
>    select statement on files descriptors. The select C routine under Windows
>    works only on socket.

I suggest to write your own version of `select' and use it instead.  All 
you need is to call low-level OS functions which will tell you whether a 
file or device has some input pending, or is ready to accept output.  Disk 
files can be assumed to always be ready, so you are left with the 
keyboard and pipes.

Failing that, you could still use the -noasync option which disables the 
async operation.

> 2) readline module
>    The readline module uses some libraries not ported to Windows.
>    For example it uses needs <termios.h>, <termio.h> or <sgtty.h> this is not
>    available with GCC under Windows. It needs also <pwd.h> which is
>    missing. This one should not be to hard to implement though.

Indeed.  The emulation of these features is relatively easy; you could 
look at what the DJGPP (a.k.a. MS-DOS) port of readline does.

> Is there any patch already available that fix that ?

I know for a fact that GDB 4.18 was available in the MinGW port; perhaps 
some of these problems (readline, for sure) are already solved there.

> What is the plan about support of GDB 5 under native Windows ?

I don't think there is a plan, but I might be mistaken.

> We have eard of a readline port available on the net, do you expect this one
> to be ok to build GDB-5 ? Have anybody tried it ?

Readline is not maintained by the GDB team, it is maintained separately.  
The GDB maintainers generally prefer that any patches for external 
packages such as readline are submitted to the maintainers of those 
packages; then they are automatically included in the next GDB release.

In other words, your best bet would be to submit any MinGW-related 
patches to readline to the readline maintainer.

More information about the Gdb mailing list