summaryrefslogtreecommitdiff
path: root/binutils/dwarf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-08-02 13:42:54 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-08-02 13:42:54 +0000
commitcb4d93d1684b8528dad382255c3c84220b228973 (patch)
treeb6fad3fafc83ff98d0767442e1c0147f35d99eb4 /binutils/dwarf.c
parentce27277af02b27b32bd556e21283f91f4f63ff1d (diff)
downloadbinutils-redhat-cb4d93d1684b8528dad382255c3c84220b228973.tar.gz
Display null bytes in DWARF debug info
binutils/ PR binutils/14420 * dwarf.c (process_abbrev_section): Add attribute terminator. Warn missing section terminator. (get_FORM_name): Special check for 0 value. (get_AT_name): Likewise. (process_debug_info): Display zero abbrev number. Check attribute terminator. binutils/testsuite/ PR binutils/14420 * binutils-all/i386/compressed-1a.d: Updated. * binutils-all/objdump.W: Likewise. * binutils-all/readelf.wa: Likewise. * binutils-all/x86-64/compressed-1a.d: Likewise. gas/testsuite/ PR binutils/14420 * gas/elf/dwarf2-1.d: Updated. * gas/elf/dwarf2-2.d: Likwise. * gas/i386/dw2-compress-1.d: Likwise.
Diffstat (limited to 'binutils/dwarf.c')
-rw-r--r--binutils/dwarf.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 6e93906af3..d8050faf98 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -647,12 +647,14 @@ process_abbrev_section (unsigned char *start, unsigned char *end)
form = read_leb128 (start, & bytes_read, 0);
start += bytes_read;
- if (attribute != 0)
- add_abbrev_attr (attribute, form);
+ add_abbrev_attr (attribute, form);
}
while (attribute != 0);
}
+ /* Report the missing single zero which ends the section. */
+ error (_(".debug_abbrev section not zero terminated\n"));
+
return NULL;
}
@@ -675,8 +677,12 @@ get_TAG_name (unsigned long tag)
static const char *
get_FORM_name (unsigned long form)
{
- const char *name = get_DW_FORM_name (form);
+ const char *name;
+
+ if (form == 0)
+ return "DW_FORM value: 0";
+ name = get_DW_FORM_name (form);
if (name == NULL)
{
static char buffer[100];
@@ -1860,6 +1866,9 @@ get_AT_name (unsigned long attribute)
{
const char *name;
+ if (attribute == 0)
+ return "DW_AT value: 0";
+
/* One value is shared by the MIPS and HP extensions: */
if (attribute == DW_AT_MIPS_fde)
return "DW_AT_MIPS_fde or DW_AT_HP_unmodifiable";
@@ -2161,6 +2170,10 @@ process_debug_info (struct dwarf_section *section,
break;
}
+ if (!do_loc && die_offset >= dwarf_start_die)
+ printf (_(" <%d><%lx>: Abbrev Number: 0\n"),
+ level, die_offset);
+
--level;
if (level < 0)
{
@@ -2238,7 +2251,9 @@ process_debug_info (struct dwarf_section *section,
break;
}
- for (attr = entry->first_attr; attr; attr = attr->next)
+ for (attr = entry->first_attr;
+ attr && attr->attribute;
+ attr = attr->next)
{
debug_info *arg;