and return whilst displaying a warning message if the load failed.
(display_debug_loc): Likewise.
(display_debug_ranges): Likewise.
+ (DEBUG_INFO_UNAVAILABLE): Value stored in num_debug_info_entries
+ when the .debug_info section could not be loaded/parsed.
+ (process_debug_info): Display the length of the compilation unit
+ in hex, so that it corresponds with the offsets that will follow.
+ Tell the user if the length was 32-bit or 64-bit.
+ If a DIE abbreviation could not be found, tell the user the offset
+ of the DIE.
+ (free_debug_memory): Do not attempt to free any entries in the
+ debug_information array if num_debug_info_entries is set to
+ DEBUG_INFO_UNAVAILABLE.
2008-01-10 Andreas Schwab <schwab@suse.de>
static unsigned int num_debug_info_entries = 0;
static debug_info *debug_information = NULL;
+/* Special value for num_debug_info_entries to indicate
+ that the .debug_info section could not be loaded/parsed. */
+#define DEBUG_INFO_UNAVAILABLE (unsigned int) -1
dwarf_vma eh_addr_size;
if (!do_loc)
{
printf (_(" Compilation Unit @ offset 0x%lx:\n"), cu_offset);
- printf (_(" Length: %ld\n"), compunit.cu_length);
+ printf (_(" Length: 0x%lx (%s)\n"), compunit.cu_length,
+ initial_length_size == 8 ? "64-bit" : "32-bit");
printf (_(" Version: %d\n"), compunit.cu_version);
printf (_(" Abbrev Offset: %ld\n"), compunit.cu_abbrev_offset);
printf (_(" Pointer Size: %d\n"), compunit.cu_pointer_size);
printf ("\n");
fflush (stdout);
}
- warn (_("Unable to locate entry %lu in the abbreviation table\n"),
- abbrev_number);
+ warn (_("DIE at offset %lx refers to abbreviation number %lu which does not exist\n"),
+ die_offset, abbrev_number);
return 0;
}
/* If we have already tried and failed to load the .debug_info
section then do not bother to repear the task. */
- if (num_debug_info_entries == (unsigned) -1)
+ if (num_debug_info_entries == DEBUG_INFO_UNAVAILABLE)
return 0;
/* If we already have the information there is nothing else to do. */
&& process_debug_info (&debug_displays [info].section, file, 1))
return num_debug_info_entries;
- num_debug_info_entries = (unsigned) -1;
+ num_debug_info_entries = DEBUG_INFO_UNAVAILABLE;
return 0;
}
fc->ncols = 0;
fc->col_type = xmalloc (sizeof (short int));
fc->col_offset = xmalloc (sizeof (int));
- frame_need_space (fc, max_regs-1);
+ frame_need_space (fc, max_regs - 1);
version = *start++;
fc->cfa_reg = cie->cfa_reg;
fc->cfa_offset = cie->cfa_offset;
fc->ra = cie->ra;
- frame_need_space (fc, max_regs-1);
+ frame_need_space (fc, max_regs - 1);
fc->fde_encoding = cie->fde_encoding;
}
if (rs)
{
remembered_state = rs->next;
- frame_need_space (fc, rs->ncols-1);
+ frame_need_space (fc, rs->ncols - 1);
memcpy (fc->col_type, rs->col_type, rs->ncols);
memcpy (fc->col_offset, rs->col_offset,
rs->ncols * sizeof (int));
for (i = 0; i < max; i++)
free_debug_section (i);
- if (debug_information)
+ if (debug_information != NULL)
{
- for (i = 0; i < num_debug_info_entries; i++)
+ if (num_debug_info_entries != DEBUG_INFO_UNAVAILABLE)
{
- if (!debug_information [i].max_loc_offsets)
+ for (i = 0; i < num_debug_info_entries; i++)
{
- free (debug_information [i].loc_offsets);
- free (debug_information [i].have_frame_base);
+ if (!debug_information [i].max_loc_offsets)
+ {
+ free (debug_information [i].loc_offsets);
+ free (debug_information [i].have_frame_base);
+ }
+ if (!debug_information [i].max_range_lists)
+ free (debug_information [i].range_lists);
}
- if (!debug_information [i].max_range_lists)
- free (debug_information [i].range_lists);
}
+
free (debug_information);
debug_information = NULL;
num_debug_info_entries = 0;
}
-
}
struct dwarf_section_display debug_displays[] =