aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2005-09-30 14:57:52 +0000
committerH.J. Lu <hjl.tools@gmail.com>2005-09-30 14:57:52 +0000
commitbfe2612a1433668c85da535144ea3b045dd817f4 (patch)
tree575e73f7561200aa86fa8889e27c351a13551084 /binutils/objdump.c
parent365544c3f03d9fcd2557e653c56326c3440e0fad (diff)
downloadgdb-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/objdump.c')
-rw-r--r--binutils/objdump.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index e49f0ae..513308e 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -2055,6 +2055,51 @@ dump_dwarf_section (bfd *abfd, asection *section,
}
}
+static const char *mach_o_dwarf_sections [] = {
+ "LC_SEGMENT.__DWARFA.__debug_abbrev", /* .debug_abbrev */
+ "LC_SEGMENT.__DWARFA.__debug_aranges", /* .debug_aranges */
+ "LC_SEGMENT.__DWARFA.__debug_frame", /* .debug_frame */
+ "LC_SEGMENT.__DWARFA.__debug_info", /* .debug_info */
+ "LC_SEGMENT.__DWARFA.__debug_line", /* .debug_line */
+ "LC_SEGMENT.__DWARFA.__debug_pubnames", /* .debug_pubnames */
+ ".eh_frame", /* .eh_frame */
+ "LC_SEGMENT.__DWARFA.__debug_macinfo", /* .debug_macinfo */
+ "LC_SEGMENT.__DWARFA.__debug_str", /* .debug_str */
+ "LC_SEGMENT.__DWARFA.__debug_loc", /* .debug_loc */
+ "LC_SEGMENT.__DWARFA.__debug_pubtypes", /* .debug_pubtypes */
+ "LC_SEGMENT.__DWARFA.__debug_ranges", /* .debug_ranges */
+ "LC_SEGMENT.__DWARFA.__debug_static_func", /* .debug_static_func */
+ "LC_SEGMENT.__DWARFA.__debug_static_vars", /* .debug_static_vars */
+ "LC_SEGMENT.__DWARFA.__debug_types", /* .debug_types */
+ "LC_SEGMENT.__DWARFA.__debug_weaknames" /* .debug_weaknames */
+};
+
+static const char *generic_dwarf_sections [max];
+
+static void
+check_mach_o_dwarf (bfd *abfd)
+{
+ static enum bfd_flavour old_flavour = bfd_target_unknown_flavour;
+ enum bfd_flavour current_flavour = bfd_get_flavour (abfd);
+ enum dwarf_section_display_enum i;
+
+ if (generic_dwarf_sections [0] == NULL)
+ for (i = 0; i < max; i++)
+ generic_dwarf_sections [i] = debug_displays[i].section.name;
+
+ if (old_flavour != current_flavour)
+ {
+ if (current_flavour == bfd_target_mach_o_flavour)
+ for (i = 0; i < max; i++)
+ debug_displays[i].section.name = mach_o_dwarf_sections [i];
+ else if (old_flavour == bfd_target_mach_o_flavour)
+ for (i = 0; i < max; i++)
+ debug_displays[i].section.name = generic_dwarf_sections [i];
+
+ old_flavour = current_flavour;
+ }
+}
+
/* Dump the dwarf debugging information. */
static void
@@ -2074,6 +2119,8 @@ dump_dwarf (bfd *abfd)
else
abort ();
+ check_mach_o_dwarf (abfd);
+
bfd_map_over_sections (abfd, dump_dwarf_section, NULL);
free_debug_memory ();