summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom de Vries <vries@gcc.gnu.org>2019-07-25 17:24:22 +0100
committerNick Clifton <nickc@redhat.com>2019-07-25 17:24:22 +0100
commit48467cb99b04c9d908ce2dd74422c9c3f322ccc3 (patch)
treeef603fc08d849d88c525532ef2b078ca1bc85af5
parentc7c860d2d29ca3e774c29f328d2af42eeb031958 (diff)
downloadbinutils-48467cb99b04c9d908ce2dd74422c9c3f322ccc3.tar.gz
binutils-48467cb99b04c9d908ce2dd74422c9c3f322ccc3.tar.xz
binutils-48467cb99b04c9d908ce2dd74422c9c3f322ccc3.zip
Have readelf and objdump display the contents of the DWARF augmentation data as a string, if it is printable.
PR 24809 * dwarf.c (display_debug_names): Display the contents of the augmentation string, if it is printable.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/dwarf.c22
2 files changed, 27 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 635f221871..84db1404a8 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2019-07-25 Tom de Vries <vries@gcc.gnu.org>
+
+ PR 24809
+ * dwarf.c (display_debug_names): Display the contents of the
+ augmentation string, if it is printable.
+
2019-07-25 Nick Clifton <nickc@redhat.com>
PR 24837
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 519f9cc4ff..94c8a03f40 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -29,6 +29,7 @@
#include "dwarf.h"
#include "gdb/gdb-index.h"
#include "filenames.h"
+#include "safe-ctype.h"
#include <assert.h>
#undef MAX
@@ -8543,6 +8544,8 @@ display_debug_names (struct dwarf_section *section, void *file)
uint32_t augmentation_string_size;
unsigned int i;
unsigned long sec_off;
+ bfd_boolean augmentation_printable;
+ const char *augmentation_string;
unit_start = hdrptr;
@@ -8606,15 +8609,32 @@ display_debug_names (struct dwarf_section *section, void *file)
augmentation_string_size);
augmentation_string_size += (-augmentation_string_size) & 3;
}
+
printf (_("Augmentation string:"));
+
+ augmentation_printable = TRUE;
+ augmentation_string = (const char *) hdrptr;
+
for (i = 0; i < augmentation_string_size; i++)
{
unsigned char uc;
SAFE_BYTE_GET_AND_INC (uc, hdrptr, 1, unit_end);
printf (" %02x", uc);
+
+ if (uc != 0 && !ISPRINT (uc))
+ augmentation_printable = FALSE;
+ }
+
+ if (augmentation_printable)
+ {
+ printf (" (\"");
+ for (i = 0;
+ i < augmentation_string_size && augmentation_string[i];
+ ++i)
+ putchar (augmentation_string[i]);
+ printf ("\")");
}
- putchar ('\n');
putchar ('\n');
printf (_("CU table:\n"));