aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-04-25 14:53:27 +0000
committerTom Tromey <tromey@redhat.com>2011-04-25 14:53:27 +0000
commit664f90a33173273f8b2d43508b48150ade0a1694 (patch)
treec06cb3af54f44ca84b01f5d948c32b0d529b58bd
parent918c9108e82d31a95364061785752e8d070e1daf (diff)
downloadgdb-664f90a33173273f8b2d43508b48150ade0a1694.zip
gdb-664f90a33173273f8b2d43508b48150ade0a1694.tar.gz
gdb-664f90a33173273f8b2d43508b48150ade0a1694.tar.bz2
* readelf.c (print_gnu_note): New function.
(process_note): Use it.
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c59
2 files changed, 64 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 74dd853..4db8572 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-21 Tom Tromey <tromey@redhat.com>
+
+ * readelf.c (print_gnu_note): New function.
+ (process_note): Use it.
+
2011-04-21 Jie Zhang <jzhang918@gmail.com>
* MAINTAINERS: Update my email address.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 7ac9914..2cc8cf3 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12231,6 +12231,63 @@ get_gnu_elf_note_type (unsigned e_type)
return buff;
}
+static int
+print_gnu_note (Elf_Internal_Note *pnote)
+{
+ switch (pnote->type)
+ {
+ case NT_GNU_BUILD_ID:
+ {
+ unsigned long i;
+
+ printf (_(" Build ID: "));
+ for (i = 0; i < pnote->descsz; ++i)
+ printf ("%02x", pnote->descdata[i] & 0xff);
+ printf (_("\n"));
+ }
+ break;
+
+ case NT_GNU_ABI_TAG:
+ {
+ unsigned long os, major, minor, subminor;
+ const char *osname;
+
+ os = byte_get ((unsigned char *) pnote->descdata, 4);
+ major = byte_get ((unsigned char *) pnote->descdata + 4, 4);
+ minor = byte_get ((unsigned char *) pnote->descdata + 8, 4);
+ subminor = byte_get ((unsigned char *) pnote->descdata + 12, 4);
+
+ switch (os)
+ {
+ case GNU_ABI_TAG_LINUX:
+ osname = "Linux";
+ break;
+ case GNU_ABI_TAG_HURD:
+ osname = "Hurd";
+ break;
+ case GNU_ABI_TAG_SOLARIS:
+ osname = "Solaris";
+ break;
+ case GNU_ABI_TAG_FREEBSD:
+ osname = "FreeBSD";
+ break;
+ case GNU_ABI_TAG_NETBSD:
+ osname = "NetBSD";
+ break;
+ default:
+ osname = "Unknown";
+ break;
+ }
+
+ printf (_(" OS: %s, ABI: %ld.%ld.%ld\n"), osname,
+ major, minor, subminor);
+ }
+ break;
+ }
+
+ return 1;
+}
+
static const char *
get_netbsd_elfcore_note_type (unsigned e_type)
{
@@ -12448,6 +12505,8 @@ process_note (Elf_Internal_Note * pnote)
if (const_strneq (pnote->namedata, "IPF/VMS"))
return print_ia64_vms_note (pnote);
+ else if (const_strneq (pnote->namedata, "GNU"))
+ return print_gnu_note (pnote);
else
return 1;
}