public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] gdb: define builtin long type to be 64 bits on amd64 Cygwin
Date: Wed, 01 Apr 2020 06:48:28 -0400	[thread overview]
Message-ID: <30efb6c7af7ad8b50936157fe0a0ef22d6787dd7@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 30efb6c7af7ad8b50936157fe0a0ef22d6787dd7 ***

commit 30efb6c7af7ad8b50936157fe0a0ef22d6787dd7
Author:     Simon Marchi <simon.marchi@efficios.com>
AuthorDate: Mon Mar 16 16:56:36 2020 -0400
Commit:     Simon Marchi <simon.marchi@polymtl.ca>
CommitDate: Mon Mar 16 16:56:36 2020 -0400

    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.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 68c8bf7471..6cb3cb5dcc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2020-03-16  Simon Marchi  <simon.marchi@efficios.com>
+
+	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.
+
 2020-03-16  Simon Marchi  <simon.marchi@efficios.com>
 
 	* windows-tdep.h (is_linked_with_cygwin_dll): New declaration.
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index e0346f8628..6d5076d1c4 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -1209,7 +1209,7 @@ amd64_windows_auto_wide_charset (void)
 }
 
 static void
-amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+amd64_windows_init_abi_common (gdbarch_info info, struct gdbarch *gdbarch)
 {
   /* The dwarf2 unwinder (appended very early by i386_gdbarch_init) is
      preferred over the SEH one.  The reasons are:
@@ -1229,9 +1229,6 @@ amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   windows_init_abi (info, gdbarch);
 
-  /* On Windows, "long"s are only 32bit.  */
-  set_gdbarch_long_bit (gdbarch, 32);
-
   /* Function calls.  */
   set_gdbarch_push_dummy_call (gdbarch, amd64_windows_push_dummy_call);
   set_gdbarch_return_value (gdbarch, amd64_windows_return_value);
@@ -1244,6 +1241,21 @@ amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_auto_wide_charset (gdbarch, amd64_windows_auto_wide_charset);
 }
 
+static void
+amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+  amd64_windows_init_abi_common (info, gdbarch);
+
+  /* On Windows, "long"s are only 32bit.  */
+  set_gdbarch_long_bit (gdbarch, 32);
+}
+
+static void
+amd64_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+  amd64_windows_init_abi_common (info, gdbarch);
+}
+
 static gdb_osabi
 amd64_windows_osabi_sniffer (bfd *abfd)
 {
@@ -1262,11 +1274,10 @@ void _initialize_amd64_windows_tdep ();
 void
 _initialize_amd64_windows_tdep ()
 {
-  /* The Cygwin and Windows OS ABIs are currently equivalent.  */
   gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_WINDOWS,
                           amd64_windows_init_abi);
   gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_CYGWIN,
-                          amd64_windows_init_abi);
+                          amd64_cygwin_init_abi);
 
   gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
 				  amd64_windows_osabi_sniffer);
diff --git a/gdb/i386-windows-tdep.c b/gdb/i386-windows-tdep.c
index bd6107b02f..b26731c6bf 100644
--- a/gdb/i386-windows-tdep.c
+++ b/gdb/i386-windows-tdep.c
@@ -270,7 +270,7 @@ _initialize_i386_windows_tdep ()
   gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
                                   i386_cygwin_core_osabi_sniffer);
 
-  /* The Windows and Cygwin OS ABIs are currently equivalent.  */
+  /* The Windows and Cygwin OS ABIs are currently equivalent on i386.  */
   gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_WINDOWS,
                           i386_windows_init_abi);
   gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_CYGWIN,


             reply	other threads:[~2020-04-01 10:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01 10:48 gdb-buildbot [this message]
2020-04-01 10:48 ` Failures on Fedora-i686, branch master gdb-buildbot
2020-04-01 11:35 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-04-01 11:49 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-04-01 12:31 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-04-01 12:32 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-04-05  7:09 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30efb6c7af7ad8b50936157fe0a0ef22d6787dd7@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).