This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] Improve ELF OSABI detection
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Sat, 15 Jun 2002 14:34:24 +0200 (CEST)
- Subject: [RFA] Improve ELF OSABI detection
This adds code to our generic ELF sniffer for detecting FreeBSD 3.x
ELF files.
OK to check this in?
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* osabi.c (generic_elf_osabi_sniffer): Add check for FreeBSD 3.x's
traditonal string branding within the ELF header.
2002-06-15 Mark Kettenis <kettenis@gnu.org>
Index: osabi.c
===================================================================
RCS file: /cvs/src/src/gdb/osabi.c,v
retrieving revision 1.3
diff -u -p -r1.3 osabi.c
--- osabi.c 15 Jun 2002 12:26:31 -0000 1.3
+++ osabi.c 15 Jun 2002 12:27:38 -0000
@@ -408,6 +408,14 @@ generic_elf_osabi_sniffer (bfd *abfd)
break;
}
+ if (osabi == GDB_OSABI_UNKNOWN)
+ {
+ /* The FreeBSD folks have been naughty; they stored the string
+ "FreeBSD" in the padding of the e_ident field of the ELF
+ header to "brand" their ELF binaries in FreeBSD 3.x. */
+ if (strcmp (&elf_elfheader (abfd)->e_ident[8], "FreeBSD") == 0)
+ osabi = GDB_OSABI_FREEBSD_ELF;
+ }
return osabi;
}