[PATCH 4/7] Add sniffer for Cygwin x86_64 core dumps
Simon Marchi
simark@simark.ca
Thu Jul 2 23:59:44 GMT 2020
> @@ -1276,6 +1278,24 @@ amd64_windows_osabi_sniffer (bfd *abfd)
> 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;
The obvious question here is, what happens if we are loading the core for
another architecture, and it happens by bad luck that the .reg section is
of that size, even though it's not a Cygwin core. Will this give a false
positive?
I presume that since this is copied on the i386, that discussion already
happened in the past for i386, and it was concluded that there was no better
way to identify a Cygwin core. But I thought I'd ask just to be sure.
Simon
More information about the Gdb-patches
mailing list