aboutsummaryrefslogtreecommitdiff
path: root/binutils/objdump.c
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/objdump.c')
-rw-r--r--binutils/objdump.c59
1 files changed, 22 insertions, 37 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 43cfb79..7bb6d76 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -4987,44 +4987,20 @@ 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";
+dump_sframe_section (bfd *abfd, const char *sect_name, bool is_mainfile)
- 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);
-
- /* 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;
+ }
}
-
- 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 +5822,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 +6286,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 +6329,15 @@ main (int argc, char **argv)
#endif
case OPTION_SFRAME:
dump_sframe_section_info = true;
+
if (optarg)
dump_sframe_section_name = xstrdup (optarg);
+
+ /* Error checking for user-provided 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':