]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ChangeLog
gdb: define builtin long type to be 64 bits on amd64 Cygwin
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 16 Mar 2020 20:56:36 +0000 (16:56 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 16 Mar 2020 20:56:36 +0000 (16:56 -0400)
commit30efb6c7af7ad8b50936157fe0a0ef22d6787dd7
tree5ab2f17411bcb3088e7b56173fc51449791e68ee
parent8db52437243e251c01e352cdb325bc9ace578e7c
gdb: define builtin long type to be 64 bits on amd64 Cygwin

On Windows x86-64 (when building with MinGW), the size of the "long"
type is 32 bits.  amd64_windows_init_abi therefore does:

    set_gdbarch_long_bit (gdbarch, 32);

This is also used when the chosen OS ABI is Cygwin, where the "long"
type is 64 bits.  GDB therefore gets sizeof(long) wrong when using the
builtin long type:

    $ ./gdb -nx --data-directory=data-directory -batch -ex "set architecture i386:x86-64" -ex "set osabi Cygwin" -ex "print sizeof(long)"
    The target architecture is assumed to be i386:x86-64
    $1 = 4

This patch makes GDB avoid setting the size of the long type to 32 bits
when using the Cygwin OS ABI.  it will inherit the value set in
amd64_init_abi.

With this patch, I get:

    $ ./gdb -nx --data-directory=data-directory -batch -ex "set architecture i386:x86-64" -ex "set osabi Cygwin" -ex "print sizeof(long)"
    The target architecture is assumed to be i386:x86-64
    $1 = 8

gdb/ChangeLog:

PR gdb/21500
* amd64-windows-tdep.c (amd64_windows_init_abi): Rename
to...
(amd64_windows_init_abi_common): ... this.  Don't set size of
long type.
(amd64_windows_init_abi): New function.
(amd64_cygwin_init_abi): New function.
(_initialize_amd64_windows_tdep): Use amd64_cygwin_init_abi for
the Cygwin OS ABI.
* i386-windows-tdep.c (_initialize_i386_windows_tdep): Clarify
comment.
gdb/ChangeLog
gdb/amd64-windows-tdep.c
gdb/i386-windows-tdep.c