aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binutils/ChangeLog7
-rw-r--r--binutils/dwarf.c32
2 files changed, 28 insertions, 11 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 758dfdb..da24027 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,10 @@
+2021-03-05 Nick Clifton <nickc@redhat.com>
+
+ PR 27387
+ * dwarf.c (display_debug_macro): Handle the displaying of
+ DW_MACRO_define_strp and DW_MACRO_undef_strp in v4
+ .debug_macro.dwo sections.
+
2021-03-04 Nick Clifton <nickc@redhat.com>
PR 27478
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 15f0bd0..74f28f5 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -690,7 +690,7 @@ fetch_indirect_string (dwarf_vma offset)
if (offset >= section->size)
{
- warn (_("DW_FORM_strp offset too big: %s\n"),
+ warn (_("DW_FORM_strp offset too big: 0x%s\n"),
dwarf_vmatoa ("x", offset));
return (const unsigned char *) _("<offset is too big>");
}
@@ -718,7 +718,7 @@ fetch_indirect_line_string (dwarf_vma offset)
if (offset >= section->size)
{
- warn (_("DW_FORM_line_strp offset too big: %s\n"),
+ warn (_("DW_FORM_line_strp offset too big: 0x%s\n"),
dwarf_vmatoa ("x", offset));
return (const unsigned char *) _("<offset is too big>");
}
@@ -803,7 +803,7 @@ fetch_indexed_string (dwarf_vma idx, struct cu_tu_set *this_set,
if (index_offset >= length)
{
- warn (_("DW_FORM_GNU_str_index offset too big: %s vs %s\n"),
+ warn (_("DW_FORM_GNU_str_index offset too big: 0x%s vs 0x%s\n"),
dwarf_vmatoa ("x", index_offset),
dwarf_vmatoa ("x", length));
return _("<index offset is too big>");
@@ -813,7 +813,7 @@ fetch_indexed_string (dwarf_vma idx, struct cu_tu_set *this_set,
str_offset -= str_section->address;
if (str_offset >= str_section->size)
{
- warn (_("DW_FORM_GNU_str_index indirect offset too big: %s\n"),
+ warn (_("DW_FORM_GNU_str_index indirect offset too big: 0x%s\n"),
dwarf_vmatoa ("x", str_offset));
return _("<indirect index offset is too big>");
}
@@ -839,7 +839,7 @@ fetch_indexed_value (dwarf_vma offset, dwarf_vma bytes)
if (offset + bytes > section->size)
{
- warn (_("Offset into section %s too big: %s\n"),
+ warn (_("Offset into section %s too big: 0x%s\n"),
section->name, dwarf_vmatoa ("x", offset));
return "<offset too big>";
}
@@ -6045,17 +6045,22 @@ display_debug_macro (struct dwarf_section *section,
unsigned char *end = start + section->size;
unsigned char *curr = start;
unsigned char *extended_op_buf[256];
+ bfd_boolean is_dwo = FALSE;
+ const char *suffix = strrchr (section->name, '.');
+
+ if (suffix && strcmp (suffix, ".dwo") == 0)
+ is_dwo = TRUE;
load_debug_section_with_follow (str, file);
load_debug_section_with_follow (line, file);
load_debug_section_with_follow (str_index, file);
-
+
introduce (section, FALSE);
while (curr < end)
{
unsigned int lineno, version, flags;
- unsigned int offset_size = 4;
+ unsigned int offset_size;
const unsigned char *string;
dwarf_vma line_offset = 0, sec_offset = curr - start, offset;
unsigned char **extended_ops = NULL;
@@ -6069,8 +6074,7 @@ display_debug_macro (struct dwarf_section *section,
}
SAFE_BYTE_GET_AND_INC (flags, curr, 1, end);
- if (flags & 1)
- offset_size = 8;
+ offset_size = (flags & 1) ? 8 : 4;
printf (_(" Offset: 0x%lx\n"),
(unsigned long) sec_offset);
printf (_(" Version: %d\n"), version);
@@ -6202,7 +6206,10 @@ display_debug_macro (struct dwarf_section *section,
case DW_MACRO_define_strp:
READ_ULEB (lineno, curr, end);
- SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
+ if (version == 4 && is_dwo)
+ READ_ULEB (offset, curr, end);
+ else
+ SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
string = fetch_indirect_string (offset);
printf (_(" DW_MACRO_define_strp - lineno : %d macro : %s\n"),
lineno, string);
@@ -6210,7 +6217,10 @@ display_debug_macro (struct dwarf_section *section,
case DW_MACRO_undef_strp:
READ_ULEB (lineno, curr, end);
- SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
+ if (version == 4 && is_dwo)
+ READ_ULEB (offset, curr, end);
+ else
+ SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
string = fetch_indirect_string (offset);
printf (_(" DW_MACRO_undef_strp - lineno : %d macro : %s\n"),
lineno, string);