Re: [PATCH] Fix windows-nat.c for -Wnarrowing

Eli Zaretskii
2018-08-29T19:33:10Z

> Date: Wed, 29 Aug 2018 22:28:40 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> CC: tom@tromey.com, palves@redhat.com, gdb-patches@sourceware.org
>
> I don't understand: EXCEPTION_ACCESS_VIOLATION is defined like this:
>
> #define STATUS_ACCESS_VIOLATION 0xC0000005
> #define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION
>
> And you've removed DWORD from the definition of xlate. So where does
> DWORD come from?

Ah, I see: it's a MinGW64 specific thing. It defines

#define STATUS_ACCESS_VIOLATION (DWORD)0xC0000005

So I would suggest to do this:

static const struct xlate_exception xlate[] =
{
{(long)EXCEPTION_ACCESS_VIOLATION, GDB_SIGNAL_SEGV},
{(long)STATUS_STACK_OVERFLOW, GDB_SIGNAL_SEGV},
{(long)EXCEPTION_BREAKPOINT, GDB_SIGNAL_TRAP},
{(long)DBG_CONTROL_C, GDB_SIGNAL_INT},
{(long)EXCEPTION_SINGLE_STEP, GDB_SIGNAL_TRAP},
{(long)STATUS_FLOAT_DIVIDE_BY_ZERO, GDB_SIGNAL_FPE},
{-1L, GDB_SIGNAL_UNKNOWN}
};