aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
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 ();