+2020-07-01 Jon Turney <jon.turney@dronecode.org.uk>
+
+ * amd64-windows-tdep.c (amd64_cygwin_core_osabi_sniffer): New.
+ (_initialize_amd64_windows_tdep): Register amd64_cygwin_core_osabi_sniffer.
+
2020-09-18 Pedro Alves <pedro@palves.net>
PR gdb/26631
AMD64_R9_REGNUM /* %r9 */
};
+#define AMD64_WINDOWS_SIZEOF_GREGSET 1232
+
/* Return nonzero if an argument of type TYPE should be passed
via one of the integer registers. */
return GDB_OSABI_WINDOWS;
}
+static enum gdb_osabi
+amd64_cygwin_core_osabi_sniffer (bfd *abfd)
+{
+ const char *target_name = bfd_get_target (abfd);
+
+ /* Cygwin uses elf core dumps. Do not claim all ELF executables,
+ check whether there is a .reg section of proper size. */
+ if (strcmp (target_name, "elf64-x86-64") == 0)
+ {
+ asection *section = bfd_get_section_by_name (abfd, ".reg");
+ if (section != nullptr
+ && bfd_section_size (section) == AMD64_WINDOWS_SIZEOF_GREGSET)
+ return GDB_OSABI_CYGWIN;
+ }
+
+ return GDB_OSABI_UNKNOWN;
+}
+
void _initialize_amd64_windows_tdep ();
void
_initialize_amd64_windows_tdep ()
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
amd64_windows_osabi_sniffer);
+
+ /* Cygwin uses elf core dumps. */
+ gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
+ amd64_cygwin_core_osabi_sniffer);
+
}