diff options
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 7 | ||||
-rw-r--r-- | binutils/doc/ctf.options.texi | 4 | ||||
-rw-r--r-- | binutils/objdump.c | 9 |
3 files changed, 16 insertions, 4 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ea9cfe43146..efde928b3f0 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,5 +1,12 @@ 2021-10-25 Nick Alcock <nick.alcock@oracle.com> + * objdump.c (usage): --ctf now has an optional argument. + (main): Adjust accordingly. + (dump_ctf): Default it. + * doc/ctf.options.texi: Adjust. + +2021-10-25 Nick Alcock <nick.alcock@oracle.com> + * objdump.c (usage): --ctf-parent now takes a name, not a section. (dump_ctf): Don't open a separate section; use the parent_name in ctf_dict_open instead. Use ctf_archive_next, not ctf_archive_iter, diff --git a/binutils/doc/ctf.options.texi b/binutils/doc/ctf.options.texi index 34451f9221a..2820946f2c0 100644 --- a/binutils/doc/ctf.options.texi +++ b/binutils/doc/ctf.options.texi @@ -1,13 +1,15 @@ @c This file contains the entry for the --ctf, --ctf-parent, --ctf-symbols, -and @c --ctf-strings options that are common to both readelf and objdump. -@item --ctf=@var{section} +@item --ctf[=@var{section}] @cindex CTF @cindex Compact Type Format Display the contents of the specified CTF section. CTF sections themselves contain many subsections, all of which are displayed in order. +By default, display the name of the section named @var{.ctf}, which is the +name emitted by @command{ld}. @item --ctf-parent=@var{member} diff --git a/binutils/objdump.c b/binutils/objdump.c index 43472e19e25..356e3ecd853 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -273,7 +273,7 @@ usage (FILE *stream, int status) separate debuginfo files. (Implies -WK)\n")); #ifdef ENABLE_LIBCTF fprintf (stream, _("\ - --ctf=SECTION Display CTF info from SECTION\n")); + --ctf[=SECTION] Display CTF info from SECTION, (default `.ctf')\n")); #endif fprintf (stream, _("\ -t, --syms Display the contents of the symbol table(s)\n")); @@ -460,7 +460,7 @@ static struct option long_options[]= {"include", required_argument, NULL, 'I'}, {"dwarf", optional_argument, NULL, OPTION_DWARF}, #ifdef ENABLE_LIBCTF - {"ctf", required_argument, NULL, OPTION_CTF}, + {"ctf", optional_argument, NULL, OPTION_CTF}, {"ctf-parent", required_argument, NULL, OPTION_CTF_PARENT}, #endif {"stabs", no_argument, NULL, 'G'}, @@ -4218,6 +4218,8 @@ dump_ctf (bfd *abfd, const char *sect_name, const char *parent_name) size_t member = 0; int err; + if (sect_name == NULL) + sect_name = ".ctf"; if ((ctfdata = read_section_stabs (abfd, sect_name, &ctfsize, NULL)) == NULL) bfd_fatal (bfd_get_filename (abfd)); @@ -5449,7 +5451,8 @@ main (int argc, char **argv) #ifdef ENABLE_LIBCTF case OPTION_CTF: dump_ctf_section_info = true; - dump_ctf_section_name = xstrdup (optarg); + if (optarg) + dump_ctf_section_name = xstrdup (optarg); seenflag = true; break; case OPTION_CTF_PARENT: |