* readelf.c (debug_str, debug_str_size): New.
(display_debug_abbrev): If no abbrevs were read, skip the CU. Call free_abbrevs. (read_and_display_addr): Handle DW_FORM_strp. (display_debug_info): Read .debug_str section if present, so that DW_FORM_strp can be handled. Fix test for non-existant .debug_abbrev section.
This commit is contained in:
parent
a4a7d16f8b
commit
ef5cdfc7dd
2 changed files with 57 additions and 1 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
2001-11-07 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* readelf.c (debug_str, debug_str_size): New.
|
||||||
|
(display_debug_abbrev): If no abbrevs were read, skip the CU.
|
||||||
|
Call free_abbrevs.
|
||||||
|
(read_and_display_addr): Handle DW_FORM_strp.
|
||||||
|
(display_debug_info): Read .debug_str section if present,
|
||||||
|
so that DW_FORM_strp can be handled.
|
||||||
|
Fix test for non-existant .debug_abbrev section.
|
||||||
|
|
||||||
2001-11-05 Jakub Jelinek <jakub@redhat.com>
|
2001-11-05 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
* arlex.l: Accept `\' in filenames. Patch by <earl_chew@agilent.com>.
|
* arlex.l: Accept `\' in filenames. Patch by <earl_chew@agilent.com>.
|
||||||
|
|
|
@ -6278,6 +6278,9 @@ get_FORM_name (form)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *debug_str;
|
||||||
|
static bfd_vma debug_str_size;
|
||||||
|
|
||||||
/* FIXME: There are better and more effiecint ways to handle
|
/* FIXME: There are better and more effiecint ways to handle
|
||||||
these structures. For now though, I just want something that
|
these structures. For now though, I just want something that
|
||||||
is simple to implement. */
|
is simple to implement. */
|
||||||
|
@ -6528,6 +6531,9 @@ display_debug_abbrev (section, start, file)
|
||||||
{
|
{
|
||||||
start = process_abbrev_section (start, end);
|
start = process_abbrev_section (start, end);
|
||||||
|
|
||||||
|
if (first_abbrev == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
printf (_(" Number TAG\n"));
|
printf (_(" Number TAG\n"));
|
||||||
|
|
||||||
for (entry = first_abbrev; entry; entry = entry->next)
|
for (entry = first_abbrev; entry; entry = entry->next)
|
||||||
|
@ -6546,6 +6552,8 @@ display_debug_abbrev (section, start, file)
|
||||||
get_FORM_name (attr->form));
|
get_FORM_name (attr->form));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free_abbrevs ();
|
||||||
}
|
}
|
||||||
while (start);
|
while (start);
|
||||||
|
|
||||||
|
@ -6921,6 +6929,11 @@ read_and_display_attr (attribute, form, data, cu_offset, pointer_size)
|
||||||
data += pointer_size;
|
data += pointer_size;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DW_FORM_strp:
|
||||||
|
uvalue = byte_get (data, /* offset_size */ 4);
|
||||||
|
data += /* offset_size */ 4;
|
||||||
|
break;
|
||||||
|
|
||||||
case DW_FORM_ref1:
|
case DW_FORM_ref1:
|
||||||
case DW_FORM_flag:
|
case DW_FORM_flag:
|
||||||
case DW_FORM_data1:
|
case DW_FORM_data1:
|
||||||
|
@ -7014,6 +7027,15 @@ read_and_display_attr (attribute, form, data, cu_offset, pointer_size)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DW_FORM_strp:
|
case DW_FORM_strp:
|
||||||
|
if (debug_str == NULL)
|
||||||
|
warn (_("DW_FORM_strp used but no .debug_str section"));
|
||||||
|
else if (uvalue >= debug_str_size)
|
||||||
|
warn (_("DW_FORM_strp %lx points outside of .debug_str section"),
|
||||||
|
uvalue);
|
||||||
|
else
|
||||||
|
printf (" %s", debug_str + uvalue);
|
||||||
|
break;
|
||||||
|
|
||||||
case DW_FORM_indirect:
|
case DW_FORM_indirect:
|
||||||
warn (_("Unable to handle FORM: %d"), form);
|
warn (_("Unable to handle FORM: %d"), form);
|
||||||
break;
|
break;
|
||||||
|
@ -7189,6 +7211,24 @@ display_debug_info (section, start, file)
|
||||||
|
|
||||||
printf (_("The section %s contains:\n\n"), SECTION_NAME (section));
|
printf (_("The section %s contains:\n\n"), SECTION_NAME (section));
|
||||||
|
|
||||||
|
{
|
||||||
|
Elf32_Internal_Shdr * sec;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* Locate the .debug_str section and read it. */
|
||||||
|
for (i = 0, sec = section_headers;
|
||||||
|
i < elf_header.e_shnum;
|
||||||
|
i ++, sec ++)
|
||||||
|
if (strcmp (SECTION_NAME (sec), ".debug_str") == 0 && sec->sh_size != 0)
|
||||||
|
{
|
||||||
|
debug_str = (const char *)
|
||||||
|
get_data (NULL, file, sec->sh_offset, sec->sh_size,
|
||||||
|
_("debug_str section data"));
|
||||||
|
debug_str_size = sec->sh_size;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (start < end)
|
while (start < end)
|
||||||
{
|
{
|
||||||
DWARF2_External_CompUnit * external;
|
DWARF2_External_CompUnit * external;
|
||||||
|
@ -7306,7 +7346,7 @@ display_debug_info (section, start, file)
|
||||||
if (strcmp (SECTION_NAME (sec), ".debug_abbrev") == 0)
|
if (strcmp (SECTION_NAME (sec), ".debug_abbrev") == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (i == -1 || sec->sh_size == 0)
|
if (i == elf_header.e_shnum || sec->sh_size == 0)
|
||||||
{
|
{
|
||||||
warn (_("Unable to locate .debug_abbrev section!\n"));
|
warn (_("Unable to locate .debug_abbrev section!\n"));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -7373,6 +7413,12 @@ display_debug_info (section, start, file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debug_str != NULL)
|
||||||
|
{
|
||||||
|
free ((char *) debug_str);
|
||||||
|
debug_str = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue