This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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;
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]