binutils-gdb/binutils/doc/ctf.options.texi
Nick Alcock 6364617120 binutils, objdump: Add --ctf-parent-section
This lets you examine CTF where the parent and child dicts are in entirely
different sections, rather than in a CTF archive with members with different
names.  The linker doesn't emit ELF objects structured like this, but some
third-party linkers may; it's also useful for objcopy-constructed files
in some cases.

(This is what the objdump --ctf-parent option used to do before commit
80b56fad5c in 2021.  The new semantics of that option are much more
useful, but that doesn't mean the old ones are never useful at all, so let's
bring them back.)

(I was specifically driven to add this by DTrace's obscure "ctypes" and
"dtypes" options, which dump its internal, dynamically-generated dicts out
to files for debugging purposes: there are two, one the parent of the other.
Since they're in two separate files rather than a CTF archive and we have no
tools that paste files together into archives, objdump wouldn't show them --
and even pasting them together into an ELF executable with objcopy didn't
help, since objdump had no options that could be used to look in specific
sections for the parent dict.  With --ctf-parent-section, this sort of
obscure use case becomes possible again.  You'll never need it for the
output of the normal linker.)

binutils/

	* doc/ctf.options.texi: Add --ctf-parent-section=.
	* objdump.c (dump_ctf): Implement it.
	(dump_bfd): Likewise.
	(main): Likewise.
2024-04-19 16:14:45 +01:00

35 lines
1.5 KiB
Plaintext

@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.
By default, display the name of the section named @var{.ctf}, which is the
name emitted by @command{ld}.
@item --ctf-parent=@var{member}
If the CTF section contains ambiguously-defined types, it will consist
of an archive of many CTF dictionaries, all inheriting from one
dictionary containing unambiguous types. This member is by default
named @var{.ctf}, like the section containing it, but it is possible to
change this name using the @code{ctf_link_set_memb_name_changer}
function at link time. When looking at CTF archives that have been
created by a linker that uses the name changer to rename the parent
archive member, @option{--ctf-parent} can be used to specify the name
used for the parent.
@item --ctf-parent-section=@var{section}
This option lets you pick a completely different section for the CTF
parent dictionary containing unambiguous types than for the child
dictionaries that contain the ambiguous remainder. The linker does
not emit ELF objects structured like this, but some third-party linkers
may. It's also convenient to inspect CTF written out as multiple raw
files to compose them with objcopy, which can put them in different
ELF sections but not in different members of a single CTF dict.