diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2019-04-24 12:04:33 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2019-05-28 17:09:45 +0100 |
commit | 7d9813f196bd1a98d49c2b9b7b90351cb2435b0d (patch) | |
tree | a98af01fd572cc1e662a1304c7c8f771e2b59873 /binutils/doc | |
parent | 0e65dfbaf3a0299e4837216a103c28625d4b4f1d (diff) | |
download | gdb-7d9813f196bd1a98d49c2b9b7b90351cb2435b0d.zip gdb-7d9813f196bd1a98d49c2b9b7b90351cb2435b0d.tar.gz gdb-7d9813f196bd1a98d49c2b9b7b90351cb2435b0d.tar.bz2 |
binutils: CTF support for objdump and readelf
This introduces CTF support for objdump and readelf. objdump has the
following new arguments:
--ctf=SECTION: display CTF in the given SECTION
--ctf-parent=SECTION: name of CTF section that is the parent of this section
readelf has the above, and these two as well:
--ctf-symbols=SECTION: name of symbol table section (optional)
--ctf-strings=SECTION: name of string table section (optional)
(objdump can always use BFD machinery to determine the applicable string
and symbol tables automatically, so these arguments are unnecessary.)
Nearly all the work is done by the ctf_dump machinery in libctf: most of
the remaining work is option-processing and section-reading, and thus is
different for objdump and readelf: the minimal amount of similar code
remaining is, in my view, too small to share, particularly given that
objdump uses ctf_bfdopen() and readelf uses ctf_simple_open() since it
doesn't have a bfd.
I am not particularly satisfied with the way resources are freed in
either of these (I was forced to do it at the top level, for lack of
anywhere else to free resources allocated during option processing), but
I can't see any better way to do it without introducing new
infrastructure for no other purpose.
There are essentially arbitrary ordering changes to the Makefile.in's
order of libtool-related stuff that I can't get rid of, but they have no
semantic effect. (It is possible that some hunks of these changes could
be dropped, but that seems a bit risky to me.)
binutils/
* objdump.c (ctf-api.h): New include.
(dump_ctf_section_info): New variable.
(dump_ctf_section_name): Likewise.
(usage): Describe new options.
(enum option_values): Add OPTION_CTF and OPTION_CTF_PARENT.
(main): Use them to add --ctf and --ctf-parent.
(read_section_stabs): Add new parameter, entsize_ptr.
(find_stabs_section): Adjust accordingly.
(make_ctfsect): New.
(dump_ctf_indent_lines): New.
(dump_ctf_archive_member): New.
(dump_ctf): New.
(dump_bfd): Call it. Free resources afterwards.
* readelf.c (ctf-api.h): New include.
(CTF_DUMP): New.
(static bfd_boolean do_ctf): Likewise.
(dump_ctf_parent_name): Likewise.
(dump_ctf_symtab_name): Likewise.
(dump_ctf_strtab_name): Likewise.
(OPTION_CTF_DUMP): Likewise.
(OPTION_CTF_PARENT): Likewise.
(OPTION_CTF_SYMBOLS): Likewise.
(OPTION_CTF_STRINGS): Likewise.
(options): Add them.
(usage): Likewise.
(parse_args): Handle the new options, requesting CTF_DUMP.
(process_section_contents): Handle CTF_DUMP.
(shdr_to_ctf_sect): New.
(dump_ctf_indent_lines): New.
(dump_section_as_ctf): New.
(main): Free resources.
* Makefile.am (LIBCTF): New variable.
(objdump_DEPENDENCIES): Use it.
(readelf_DEPENDENCIES): Likewise.
(objdump_LDADD): Likewise.
(readelf_LDADD): Likewise.
* aclocal.m4: Regenerated.
* Makefile.in: Likewise.
* doc/binutils.texi (objdump): Document the new options.
(readelf): Likewise.
* doc/ctf.options.texi: New.
* doc/Makefile.in: Regenerated.
* NEWS: Mention the new feature.
Diffstat (limited to 'binutils/doc')
-rw-r--r-- | binutils/doc/Makefile.in | 9 | ||||
-rw-r--r-- | binutils/doc/binutils.texi | 19 | ||||
-rw-r--r-- | binutils/doc/ctf.options.texi | 14 |
3 files changed, 38 insertions, 4 deletions
diff --git a/binutils/doc/Makefile.in b/binutils/doc/Makefile.in index a0777d8..7fa622a 100644 --- a/binutils/doc/Makefile.in +++ b/binutils/doc/Makefile.in @@ -108,7 +108,10 @@ host_triplet = @host@ target_triplet = @target@ subdir = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/../libtool.m4 \ + $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \ + $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \ + $(top_srcdir)/../bfd/acinclude.m4 \ $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \ $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \ @@ -124,9 +127,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ $(top_srcdir)/../config/plugins.m4 \ $(top_srcdir)/../config/po.m4 \ $(top_srcdir)/../config/progtest.m4 \ - $(top_srcdir)/../config/zlib.m4 $(top_srcdir)/../libtool.m4 \ - $(top_srcdir)/../ltoptions.m4 $(top_srcdir)/../ltsugar.m4 \ - $(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \ + $(top_srcdir)/../config/zlib.m4 \ $(top_srcdir)/../bfd/version.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index 4a7f0f9..f3c4eae 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -2110,6 +2110,7 @@ objdump [@option{-a}|@option{--archive-headers}] [@option{-s}|@option{--full-contents}] [@option{-W[lLiaprmfFsoRtUuTgAckK]}| @option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]] + [@option{--ctf=}@var{section}] [@option{-G}|@option{--stabs}] [@option{-t}|@option{--syms}] [@option{-T}|@option{--dynamic-syms}] @@ -2122,6 +2123,9 @@ objdump [@option{-a}|@option{--archive-headers}] [@option{--adjust-vma=}@var{offset}] [@option{--dwarf-depth=@var{n}}] [@option{--dwarf-start=@var{n}}] + [@option{--ctf-parent=}@var{section}] + [@option{--ctf-symbols=}@var{section}] + [@option{--ctf-strings=}@var{section}] [@option{--no-recurse-limit}|@option{--recurse-limit}] [@option{--special-syms}] [@option{--prefix=}@var{prefix}] @@ -2637,6 +2641,8 @@ instructions. @item --dwarf-check Enable additional checks for consistency of Dwarf information. +@include ctf.options.texi + @item -G @itemx --stabs @cindex stab @@ -4636,6 +4642,10 @@ readelf [@option{-a}|@option{--all}] @option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]] [@option{--dwarf-depth=@var{n}}] [@option{--dwarf-start=@var{n}}] + [@option{--ctf=}@var{section}] + [@option{--ctf-parent=}@var{section}] + [@option{--ctf-symbols=}@var{section}] + [@option{--ctf-strings=}@var{section}] [@option{-I}|@option{--histogram}] [@option{-v}|@option{--version}] [@option{-W}|@option{--wide}] @@ -4816,6 +4826,15 @@ command to @command{ar}, but without using the BFD library. @xref{ar}. @itemx --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links] @include debug.options.texi +@include ctf.options.texi +@item --ctf-symbols=@var{section} +@item --ctf-strings=@var{section} +Specify the name of another section from which the CTF file can inherit +strings and symbols. + +If either of @option{--ctf-symbols} or @option{--ctf-strings} is specified, the +other must be specified as well. + @item -I @itemx --histogram Display a histogram of bucket list lengths when displaying the contents diff --git a/binutils/doc/ctf.options.texi b/binutils/doc/ctf.options.texi new file mode 100644 index 0000000..cf05280 --- /dev/null +++ b/binutils/doc/ctf.options.texi @@ -0,0 +1,14 @@ +@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} +@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. + +@item --ctf-parent=@var{section} + +Specify the name of another section from which the CTF file can inherit +types. |