+2006-10-10 Andreas Schwab <schwab@suse.de>
+
+ * dwarf.c (display_debug_loc): Don't dereference loc_offsets when
+ there are no location lists.
+ (display_debug_ranges): Similar for range_lists.
+
2006-10-04 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c (debug_apply_rela_addends): Don't ignore relocation
error (_("No location lists in .debug_info section!\n"));
/* DWARF sections under Mach-O have non-zero addresses. */
- if (debug_information [first].loc_offsets [0] != section->address)
+ if (debug_information [first].num_loc_offsets > 0
+ && debug_information [first].loc_offsets [0] != section->address)
warn (_("Location lists in %s section start at 0x%lx\n"),
section->name, debug_information [first].loc_offsets [0]);
error (_("No range lists in .debug_info section!\n"));
/* DWARF sections under Mach-O have non-zero addresses. */
- if (debug_information [first].range_lists [0] != section->address)
+ if (debug_information [first].num_range_lists > 0
+ && debug_information [first].range_lists [0] != section->address)
warn (_("Range lists in %s section start at 0x%lx\n"),
section->name, debug_information [first].range_lists [0]);