[PATCH 2/2] Allow ASLR to be disabled on Windows

Christian Biesinger cbiesinger@google.com
Tue Oct 12 20:52:43 GMT 2021


On Thu, Oct 7, 2021 at 2:47 AM Eli Zaretskii via Gdb-patches
<gdb-patches@sourceware.org> wrote:
>
> > Date: Wed,  6 Oct 2021 14:47:04 -0600
> > From: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
> > Cc: Tom Tromey <tromey@adacore.com>
> >
> > Note that, in order to see the necessary declarations for this code to
> > work, the patch bumps _WIN32_WINNT from 0x0501 to 0x0602 -- that is,
> > Windows 8.  I don't know whether this may is a problem for anyone.
>
> It is for me.

Hm, not sure that that define is an issue for runtime per se.

> > +#include <winbase.h>
> > +#include <processthreadsapi.h>
>
> I don't think this is the right way of including Windows headers.
> Doesn't it work to just include <windows.h> (which nat/windows-nat.h
> already does)?  The MS documentation seems to say it should be enough.

It looks like gdb does not define WIN32_LEAN_AND_MEAN so I agree this
should not be necessary.

> > -/* We don't support Windows versions before XP, so we define
> > +/* We don't support Windows versions before Windows 8, so we define
> >     _WIN32_WINNT correspondingly to ensure the Windows API headers
> >     expose the required symbols.  */
> >  #if defined (__MINGW32__) || defined (__CYGWIN__)
> >  # ifdef _WIN32_WINNT
> > -#  if _WIN32_WINNT < 0x0501
> > +#  if _WIN32_WINNT < 0x0602
> >  #   undef _WIN32_WINNT
> > -#   define _WIN32_WINNT 0x0501
> > +#   define _WIN32_WINNT 0x0602
> >  #  endif
> >  # else
> > -#  define _WIN32_WINNT 0x0501
> > +#  define _WIN32_WINNT 0x0602
> >  # endif
> >  #endif       /* __MINGW32__ || __CYGWIN__ */
>
> will not help when building on older systems, and unnecessarily limits
> the GDB support to Windows 8 and later systems.

This does not affect *building* on older systems at all. But see above
re running on older systems.

Christian


More information about the Gdb-patches mailing list