aboutsummaryrefslogtreecommitdiff
path: root/contrib/gdb
diff options
context:
space:
mode:
authorJohn-Mark Gurney <jmg@FreeBSD.org>2014-02-12 02:03:37 +0000
committerJohn-Mark Gurney <jmg@FreeBSD.org>2014-02-12 02:03:37 +0000
commit85e5839202cb355b70bc0030010f96712570426e (patch)
tree3d8442ef9325c3ddbbd159886a1947ac7173d3a6 /contrib/gdb
parent42c8459bed0a06ec991ee8b06158595e2039ff73 (diff)
downloadsrc-85e5839202cb355b70bc0030010f96712570426e.tar.gz
src-85e5839202cb355b70bc0030010f96712570426e.zip
recognize the FreeBSD ARCH tag that is put on binaries like on armeb
EABI binaries... MFC after: 1 week
Notes
Notes: svn path=/head/; revision=261787
Diffstat (limited to 'contrib/gdb')
-rw-r--r--contrib/gdb/gdb/osabi.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/contrib/gdb/gdb/osabi.c b/contrib/gdb/gdb/osabi.c
index 2b31a6e17dd8..4fa844ee06de 100644
--- a/contrib/gdb/gdb/osabi.c
+++ b/contrib/gdb/gdb/osabi.c
@@ -365,11 +365,11 @@ check_note (bfd *abfd, asection *sect, const char *note,
const char *name, unsigned long descsz, unsigned long type)
{
unsigned long notesz;
+ unsigned long rdescsz;
/* Calculate the size of this note. */
- notesz = strlen (name) + 1;
- notesz = ((notesz + 3) & ~3);
- notesz += descsz;
+ notesz = 4 * 3; /* namelen, optlen, type */
+ notesz += strlen (name) + 1;
notesz = ((notesz + 3) & ~3);
/* If this assertion triggers, increase MAX_NOTESZ. */
@@ -385,7 +385,15 @@ check_note (bfd *abfd, asection *sect, const char *note,
return 0;
/* Check the descriptor size. */
- if (bfd_h_get_32 (abfd, note + 4) != descsz)
+ rdescsz = bfd_h_get_32 (abfd, note + 4);
+ if (descsz != (unsigned long)-1 && rdescsz != descsz)
+ return 0;
+
+ notesz += rdescsz;
+ notesz = ((notesz + 3) & ~3);
+
+ /* Check whether SECT is big enough to comtain the complete note. */
+ if (notesz > bfd_section_size (abfd, sect))
return 0;
/* Check the note type. */
@@ -480,6 +488,12 @@ generic_elf_osabi_sniff_abi_tag_sections: unknown OS number %d",
*osabi = GDB_OSABI_FREEBSD_ELF;
return;
}
+ if (check_note (abfd, sect, note, "FreeBSD", -1, NT_FREEBSD_ARCH_TAG))
+ {
+ /* There is no need to check the version yet. */
+ *osabi = GDB_OSABI_FREEBSD_ELF;
+ return;
+ }
return;
}