This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Recognise Solaris i386 binaries
- From: "Peter.Schauer" <Peter dot Schauer at regent dot e-technik dot tu-muenchen dot de>
- To: kettenis at chello dot nl (Mark Kettenis)
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sun, 7 Jul 2002 17:46:40 MET DST
- Subject: Re: [PATCH] Recognise Solaris i386 binaries
If we check for the Solaris compiler toolchain specific .stab.index section
in addition, we are also able to handle executables which are created by
GNU ld.
Any objections ?
*** gdb/i386-sol2-tdep.c.orig Sat Jul 6 18:12:06 2002
--- gdb/i386-sol2-tdep.c Sun Jul 7 13:43:56 2002
***************
*** 57,66 ****
static enum gdb_osabi
i386_sol2_osabi_sniffer (bfd *abfd)
{
! /* If we have a section named .SUNW_version, then it is almost
certainly Solaris 2. */
if (bfd_get_section_by_name (abfd, ".SUNW_version"))
return GDB_OSABI_SOLARIS;
return GDB_OSABI_UNKNOWN;
}
--- 57,68 ----
static enum gdb_osabi
i386_sol2_osabi_sniffer (bfd *abfd)
{
! /* If we have a section named .SUNW_version or .stab.index, then it is almost
certainly Solaris 2. */
if (bfd_get_section_by_name (abfd, ".SUNW_version"))
return GDB_OSABI_SOLARIS;
+ if (bfd_get_section_by_name (abfd, ".stab.index"))
+ return GDB_OSABI_SOLARIS;
return GDB_OSABI_UNKNOWN;
}
> This should recognise binaries created with the vendor tools.
> Probably doesn't cover stuff created with GNU ld.
>
> Checked in.
>
> Mark
>
> Index: ChangeLog
> from Mark Kettenis <kettenis@gnu.org>
>
> * i386-sol2-tdep.c (i386_sol2_osabi_sniffer): New function.
> (_initialize_i386_sol2_tdep): Register i386_sol2_osabi_sniffer.
>
> Index: i386-sol2-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/i386-sol2-tdep.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 i386-sol2-tdep.c
> --- i386-sol2-tdep.c 14 Jun 2002 19:42:19 -0000 1.1
> +++ i386-sol2-tdep.c 15 Jun 2002 18:45:43 -0000
> @@ -48,12 +48,27 @@ i386_sol2_init_abi (struct gdbarch_info
> }
>
>
> +static enum gdb_osabi
> +i386_sol2_osabi_sniffer (bfd *abfd)
> +{
> + /* If we have a section named .SUNW_version, then it is almost
> + certainly Solaris 2. */
> + if (bfd_get_section_by_name (abfd, ".SUNW_version"))
> + return GDB_OSABI_SOLARIS;
> +
> + return GDB_OSABI_UNKNOWN;
> +}
> +
> /* Provide a prototype to silence -Wmissing-prototypes. */
> void _initialize_i386_sol2_tdep (void);
>
> void
> _initialize_i386_sol2_tdep (void)
> {
> + /* Register and ELF OS ABI sniffer for Solaris 2 binaries. */
> + gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
> + i386_sol2_osabi_sniffer);
> +
> gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_SOLARIS,
> i386_sol2_init_abi);
> }
>
>
--
Peter Schauer pes@regent.e-technik.tu-muenchen.de