diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2005-09-30 14:57:52 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2005-09-30 14:57:52 +0000 |
commit | bfe2612a1433668c85da535144ea3b045dd817f4 (patch) | |
tree | 575e73f7561200aa86fa8889e27c351a13551084 /binutils/dwarf.c | |
parent | 365544c3f03d9fcd2557e653c56326c3440e0fad (diff) | |
download | gdb-bfe2612a1433668c85da535144ea3b045dd817f4.zip gdb-bfe2612a1433668c85da535144ea3b045dd817f4.tar.gz gdb-bfe2612a1433668c85da535144ea3b045dd817f4.tar.bz2 |
2005-09-30 H.J. Lu <hongjiu.lu@intel.com>
* dwarf.c (fetch_indirect_string): Adjust for section address.
(process_debug_info): Likewise.
(display_debug_loc): Likewise.
(display_debug_ranges): Likewise.
* objdump.c (mach_o_dwarf_sections): New.
(generic_dwarf_sections): Likewise.
(check_mach_o_dwarf): Likewise.
(dump_dwarf): Call check_mach_o_dwarf.
Diffstat (limited to 'binutils/dwarf.c')
-rw-r--r-- | binutils/dwarf.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c index a874d84..b47a5bb 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -287,6 +287,8 @@ fetch_indirect_string (unsigned long offset) if (section->start == NULL) return _("<no .debug_str section>"); + /* DWARF sections under Mach-O have non-zero addresses. */ + offset -= section->address; if (offset > section->size) { warn (_("DW_FORM_strp offset too big: %lx\n"), offset); @@ -1645,10 +1647,11 @@ process_debug_info (struct dwarf_section *section, void *file, free_abbrevs (); - /* Process the abbrevs used by this compilation unit. */ + /* Process the abbrevs used by this compilation unit. DWARF + sections under Mach-O have non-zero addresses. */ process_abbrev_section ((unsigned char *) debug_displays [abbrev].section.start - + compunit.cu_abbrev_offset, + + compunit.cu_abbrev_offset - debug_displays [abbrev].section.address, (unsigned char *) debug_displays [abbrev].section.start + debug_displays [abbrev].section.size); @@ -2371,7 +2374,8 @@ display_debug_loc (struct dwarf_section *section, void *file) if (!seen_first_offset) error (_("No location lists in .debug_info section!\n")); - if (debug_information [first].loc_offsets [0] != 0) + /* DWARF sections under Mach-O have non-zero addresses. */ + if (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]); @@ -2397,7 +2401,8 @@ display_debug_loc (struct dwarf_section *section, void *file) for (j = 0; j < debug_information [i].num_loc_offsets; j++) { has_frame_base = debug_information [i].have_frame_base [j]; - offset = debug_information [i].loc_offsets [j]; + /* DWARF sections under Mach-O have non-zero addresses. */ + offset = debug_information [i].loc_offsets [j] - section->address; next = section_begin + offset; base_address = debug_information [i].base_address; @@ -2726,7 +2731,8 @@ display_debug_ranges (struct dwarf_section *section, if (!seen_first_offset) error (_("No range lists in .debug_info section!\n")); - if (debug_information [first].range_lists [0] != 0) + /* DWARF sections under Mach-O have non-zero addresses. */ + if (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]); @@ -2746,7 +2752,8 @@ display_debug_ranges (struct dwarf_section *section, for (j = 0; j < debug_information [i].num_range_lists; j++) { - offset = debug_information [i].range_lists [j]; + /* DWARF sections under Mach-O have non-zero addresses. */ + offset = debug_information [i].range_lists [j] - section->address; next = section_begin + offset; base_address = debug_information [i].base_address; |