aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c80
1 files changed, 41 insertions, 39 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 43cfb79..0bea4d0 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -4498,6 +4498,9 @@ dump_dwarf_section (bfd *abfd, asection *section,
else
match = name;
+ if (elf_section_type (section) == SHT_GNU_SFRAME)
+ match = ".sframe";
+
for (i = 0; i < max; i++)
if ((strcmp (debug_displays [i].section.uncompressed_name, match) == 0
|| strcmp (debug_displays [i].section.compressed_name, match) == 0
@@ -4551,8 +4554,8 @@ dump_dwarf (bfd *abfd, bool is_mainfile)
break;
}
- init_dwarf_regnames_by_bfd_arch_and_mach (bfd_get_arch (abfd),
- bfd_get_mach (abfd));
+ init_dwarf_by_bfd_arch_and_mach (bfd_get_arch (abfd),
+ bfd_get_mach (abfd));
bfd_map_over_sections (abfd, dump_dwarf_section, (void *) &is_mainfile);
}
@@ -4987,44 +4990,32 @@ dump_ctf (bfd *abfd ATTRIBUTE_UNUSED, const char *sect_name ATTRIBUTE_UNUSED,
#endif
static void
-dump_section_sframe (bfd *abfd ATTRIBUTE_UNUSED,
- const char * sect_name)
-{
- asection *sec;
- sframe_decoder_ctx *sfd_ctx = NULL;
- bfd_size_type sf_size;
- bfd_byte *sframe_data;
- bfd_vma sf_vma;
- int err = 0;
-
- if (sect_name == NULL)
- sect_name = ".sframe";
-
- sec = read_section (abfd, sect_name, &sframe_data);
- if (sec == NULL)
- {
- my_bfd_nonfatal (bfd_get_filename (abfd));
- return;
- }
- sf_size = bfd_section_size (sec);
- sf_vma = bfd_section_vma (sec);
+dump_sframe_section (bfd *abfd, const char *sect_name, bool is_mainfile)
- /* Decode the contents of the section. */
- sfd_ctx = sframe_decode ((const char*)sframe_data, sf_size, &err);
- if (!sfd_ctx)
+{
+ /* Error checking for user provided SFrame section name, if any. */
+ if (sect_name)
{
- my_bfd_nonfatal (bfd_get_filename (abfd));
- free (sframe_data);
- return;
+ asection *sec = bfd_get_section_by_name (abfd, sect_name);
+ if (sec == NULL)
+ {
+ printf (_("No %s section present\n\n"), sanitize_string (sect_name));
+ return;
+ }
+ /* Starting with Binutils 2.45, SFrame sections have section type
+ SHT_GNU_SFRAME. For SFrame sections from Binutils 2.44 or earlier,
+ check explcitly for SFrame sections of type SHT_PROGBITS and name
+ ".sframe" to allow them. */
+ else if (elf_section_type (sec) != SHT_GNU_SFRAME
+ && !(elf_section_type (sec) == SHT_PROGBITS
+ && strcmp (sect_name, ".sframe") == 0))
+ {
+ printf (_("Section %s does not contain SFrame data\n\n"),
+ sanitize_string (sect_name));
+ return;
+ }
}
-
- printf (_("Contents of the SFrame section %s:"),
- sanitize_string (sect_name));
- /* Dump the contents as text. */
- dump_sframe (sfd_ctx, sf_vma);
-
- sframe_decoder_free (&sfd_ctx);
- free (sframe_data);
+ dump_dwarf (abfd, is_mainfile);
}
@@ -5846,7 +5837,7 @@ dump_bfd (bfd *abfd, bool is_mainfile)
dump_ctf (abfd, dump_ctf_section_name, dump_ctf_parent_name,
dump_ctf_parent_section_name);
if (dump_sframe_section_info)
- dump_section_sframe (abfd, dump_sframe_section_name);
+ dump_sframe_section (abfd, dump_sframe_section_name, is_mainfile);
if (dump_stab_section_info)
dump_stabs (abfd);
if (dump_reloc_info && ! disassemble)
@@ -6310,7 +6301,9 @@ main (int argc, char **argv)
seenflag = true;
if (optarg)
{
- if (dwarf_select_sections_by_names (optarg))
+ if (strcmp (optarg, "sframe-internal-only") == 0)
+ warn (_("Unrecognized debug option 'sframe-internal-only'\n"));
+ else if (dwarf_select_sections_by_names (optarg))
dump_dwarf_section_info = true;
}
else
@@ -6351,8 +6344,17 @@ main (int argc, char **argv)
#endif
case OPTION_SFRAME:
dump_sframe_section_info = true;
+
if (optarg)
dump_sframe_section_name = xstrdup (optarg);
+ else
+ dump_sframe_section_name = ".sframe";
+
+ /* Error checking for dump_sframe_section_name is done in
+ dump_sframe_section (). Initialize for now with the default
+ internal name: "sframe-internal-only". */
+ dwarf_select_sections_by_names ("sframe-internal-only");
+
seenflag = true;
break;
case 'G':