mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 03:29:47 +08:00
Extend the DWARF decoder to display FORM names when operating in wide mode.
PR 26847 * dwarf.c (read_and_display_attr_value): In wide mode, display the name of the form.
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
2020-11-09 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR 26847
|
||||
* dwarf.c (read_and_display_attr_value): In wide mode, display the
|
||||
name of the form.
|
||||
|
||||
2020-11-09 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* elfedit (usage): Avoid false positive "may be used uninitialised".
|
||||
|
@ -2411,6 +2411,17 @@ read_and_display_attr_value (unsigned long attribute,
|
||||
return data;
|
||||
}
|
||||
|
||||
if (do_wide && ! do_loc)
|
||||
{
|
||||
/* PR 26847: Display the name of the form. */
|
||||
const char * name = get_FORM_name (form);
|
||||
|
||||
/* For convenience we skip the DW_FORM_ prefix to the name. */
|
||||
if (name[0] == 'D')
|
||||
name += 8; /* strlen ("DW_FORM_") */
|
||||
printf ("%c(%s)", delimiter, name);
|
||||
}
|
||||
|
||||
switch (form)
|
||||
{
|
||||
default:
|
||||
@ -2492,7 +2503,13 @@ read_and_display_attr_value (unsigned long attribute,
|
||||
|
||||
case DW_FORM_GNU_ref_alt:
|
||||
if (!do_loc)
|
||||
{
|
||||
if (do_wide)
|
||||
/* We have already printed the form name. */
|
||||
printf ("%c<0x%s>", delimiter, dwarf_vmatoa ("x", uvalue));
|
||||
else
|
||||
printf ("%c<alt 0x%s>", delimiter, dwarf_vmatoa ("x", uvalue));
|
||||
}
|
||||
/* FIXME: Follow the reference... */
|
||||
break;
|
||||
|
||||
@ -2620,16 +2637,32 @@ read_and_display_attr_value (unsigned long attribute,
|
||||
|
||||
case DW_FORM_strp:
|
||||
if (!do_loc)
|
||||
{
|
||||
if (do_wide)
|
||||
/* We have already displayed the form name. */
|
||||
printf (_("%c(offset: 0x%s): %s"), delimiter,
|
||||
dwarf_vmatoa ("x", uvalue),
|
||||
fetch_indirect_string (uvalue));
|
||||
else
|
||||
printf (_("%c(indirect string, offset: 0x%s): %s"), delimiter,
|
||||
dwarf_vmatoa ("x", uvalue),
|
||||
fetch_indirect_string (uvalue));
|
||||
}
|
||||
break;
|
||||
|
||||
case DW_FORM_line_strp:
|
||||
if (!do_loc)
|
||||
{
|
||||
if (do_wide)
|
||||
/* We have already displayed the form name. */
|
||||
printf (_("%c(offset: 0x%s): %s"), delimiter,
|
||||
dwarf_vmatoa ("x", uvalue),
|
||||
fetch_indirect_line_string (uvalue));
|
||||
else
|
||||
printf (_("%c(indirect line string, offset: 0x%s): %s"), delimiter,
|
||||
dwarf_vmatoa ("x", uvalue),
|
||||
fetch_indirect_line_string (uvalue));
|
||||
}
|
||||
break;
|
||||
|
||||
case DW_FORM_GNU_str_index:
|
||||
@ -2638,6 +2671,12 @@ read_and_display_attr_value (unsigned long attribute,
|
||||
const char * suffix = strrchr (section->name, '.');
|
||||
bfd_boolean dwo = (suffix && strcmp (suffix, ".dwo") == 0) ? TRUE : FALSE;
|
||||
|
||||
if (do_wide)
|
||||
/* We have already displayed the form name. */
|
||||
printf (_("%c(offset: 0x%s): %s"), delimiter,
|
||||
dwarf_vmatoa ("x", uvalue),
|
||||
fetch_indexed_string (uvalue, this_set, offset_size, dwo));
|
||||
else
|
||||
printf (_("%c(indexed string: 0x%s): %s"), delimiter,
|
||||
dwarf_vmatoa ("x", uvalue),
|
||||
fetch_indexed_string (uvalue, this_set, offset_size, dwo));
|
||||
@ -2647,6 +2686,12 @@ read_and_display_attr_value (unsigned long attribute,
|
||||
case DW_FORM_GNU_strp_alt:
|
||||
if (!do_loc)
|
||||
{
|
||||
if (do_wide)
|
||||
/* We have already displayed the form name. */
|
||||
printf (_("%c(offset: 0x%s) %s"), delimiter,
|
||||
dwarf_vmatoa ("x", uvalue),
|
||||
fetch_alt_indirect_string (uvalue));
|
||||
else
|
||||
printf (_("%c(alt indirect string, offset: 0x%s) %s"), delimiter,
|
||||
dwarf_vmatoa ("x", uvalue),
|
||||
fetch_alt_indirect_string (uvalue));
|
||||
@ -2664,6 +2709,11 @@ read_and_display_attr_value (unsigned long attribute,
|
||||
char buf[64];
|
||||
|
||||
SAFE_BYTE_GET64 (data, &high_bits, &uvalue, end);
|
||||
if (do_wide)
|
||||
/* We have already displayed the form name. */
|
||||
printf ("%c: 0x%s", delimiter,
|
||||
dwarf_vmatoa64 (high_bits, uvalue, buf, sizeof (buf)));
|
||||
else
|
||||
printf ("%csignature: 0x%s", delimiter,
|
||||
dwarf_vmatoa64 (high_bits, uvalue, buf, sizeof (buf)));
|
||||
}
|
||||
@ -2672,9 +2722,17 @@ read_and_display_attr_value (unsigned long attribute,
|
||||
|
||||
case DW_FORM_GNU_addr_index:
|
||||
if (!do_loc)
|
||||
{
|
||||
if (do_wide)
|
||||
/* We have already displayed the form name. */
|
||||
printf (_("%c(index: 0x%s): %s"), delimiter,
|
||||
dwarf_vmatoa ("x", uvalue),
|
||||
fetch_indexed_value (uvalue * pointer_size, pointer_size));
|
||||
else
|
||||
printf (_("%c(addr_index: 0x%s): %s"), delimiter,
|
||||
dwarf_vmatoa ("x", uvalue),
|
||||
fetch_indexed_value (uvalue * pointer_size, pointer_size));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -7369,7 +7427,6 @@ display_debug_ranges_list (unsigned char *start, unsigned char *finish,
|
||||
break;
|
||||
SAFE_SIGNED_BYTE_GET_AND_INC (end, start, pointer_size, finish);
|
||||
|
||||
|
||||
printf (" %8.8lx ", offset);
|
||||
|
||||
if (begin == 0 && end == 0)
|
||||
@ -10643,7 +10700,6 @@ parse_gnu_debuglink (struct dwarf_section * section, void * data)
|
||||
The CRC value is stored after the filename, aligned up to 4 bytes. */
|
||||
name = (const char *) section->start;
|
||||
|
||||
|
||||
crc_offset = strnlen (name, section->size) + 1;
|
||||
crc_offset = (crc_offset + 3) & ~3;
|
||||
if (crc_offset + 4 > section->size)
|
||||
|
Reference in New Issue
Block a user