NAME
dwarfdump - dumps DWARF debug information of an ELF object
SYNOPSIS
dwarfdump [-abcdefilmoprsvy] [-ka] [-t{afv}] [-ucuname]
objectfilename
DESCRIPTION
The dwarfdump command prints DWARF sections as requested by
specific options. With no options (but with the required
objectfilename ) all sections print.
The format is intended to be human readable. If a script is
to parse the output, the -d option is useful.
Not all sections actually exist in any given object file.
The format may change from release to release, so it is
unwise to depend too heavily on the format.
Frame information (.debug_frame and .eh_frame) is heavily
dependent on the ABI/ISA of the object file.
The '-R' option uses a built-in generic register name set
handling up to 1200 registers named r0-r1199.
The '-x abi=abi' description below shows how to name an ABI
and use that to guide the -f or -F processing.
Unless the cpu for the object file being dumped has many
registers, do not use -R or -x abi=generic as those will be
needlessly slow dumping frame sections. Instead, use the
correct ABI (if it exists in dwarfdump.conf) or a generic
such as '-x abi=generic100' or '-x abi=generic500'.
Without '-R' or '-x abi=abi' dwarfdump ignores the
dwarfdump.conf file and uses compiled-in MIPS/IRIX conven-
tions.
If no '-x name=path' is given, dwarfdump looks for
"./dwarfdump.conf", "$HOME/.dwarfdump.conf",
"installpath/lib/dwarfdump.conf" and takes the first it
finds. If one or more '-x name=path' is given the last of
these is used and all other such files ignored.
The dwarfdump command accepts one or more of the following
options:
-a Dumps most sections. Same as -bcfilmoprsy -tfv.
-b Dumps the .debug_abbrev section.
-c Dumps the .debug_loc section.
-C Activate warnings about some common extensions to
DWARF in the .debug_info section.
-d Dense mode. Each die information of the
.debug_info section is printed in one-line format.
This option does not imply -i.
-e Ellipsis mode. Short names for DW_TAG_* and
DW_ATTR_* are used in the output for the
.debug_info section.
-f Dumps the .debug_frame section.
-i Dumps the .debug_info section.
-ka Adds all available error checks to whatever sec-
tions are being read. At the end of the run prints
the instances inspected and the number of errors
for each type of check. If there are more than
zero errors the compiler has emitted invalid
DWARF.
-l Dumps the .debug_line information.
-m Dumps the .debug_macinfo section.
-M Dumps the form name for each attribute in each die
entry printed, and if the form is the indirect
form notes that too. If combined with -v it also
prints the form number.
-n Supress function name lookup for the .debug_frame
and .eh_frame sections. This can speed up print-
ing of these sections.
-N Dumps the .debug_ranges section. There is no
guarantee in the DWARF standard that just scanning
the bytes like this will print the section
correctly, only the -i output is really guaranteed
by DWARF to find ranges correctly. But it will
normally work and the output may be of value to
compiler-writers. This section is not dumped by
-a, but -a and -i dump the ranges data applicable
to each DW_AT_ranges attribute.
-o Dumps the .reloc_debug_* sections.
-p Dumps the .debug_pubnames section.
-r Dumps the .debug_aranges section.
-s Dumps .debug_string section.
-S match=string
Examines the .debug_info section and for each die
with an attribute containing exactly that string
(case matters) it prints the die-owner-tree from
the compilation unit to the die containing the
string.
The string matching is done on the printable form,
so addresses are matched as strings. So
"dwarfdump -S match=main a.out" will print the
main program die and the compilation unit die
(assuming there is a "main" in a.out). Previously
printed dies are not reprinted.
-S any=string
Examines the .debug_info section and for each die
with an attribute containing that substring (case
is ignored) it prints the die-owner-tree from the
compilation unit to the die containing the string.
The string matching is done on the printable form,
so addresses are matched as strings. So "dwarf-
dump -S any=main a.out" will print the each die
with an attribute with the letters "main" (and the
die tree owning this die). Previously printed
dies are not reprinted.
-S regex=string
If POSIX regular expressions are present at build
time and detected by the build, this examines the
.debug_info section and for each die with an
attribute that matches the regular expression
presented it prints the die-owner-tree from the
compilation unit to the die containing the string.
The string matching is done on the printable form,
so addresses are matched as strings. So
"dwarfdump -S regex=ma.n a.out" will print the
each die with an attribute containing a string
such as "main" or "maxn" ( any string matching the
regular expression) (and the die tree owning this
die).
You may find it necessary to quote the
"regex=string" so that your shell will not
transform the expression. Previously printed dies
are not reprinted.
-ta Same as -tfv.
-tf Dumps the .debug_static_funcs section.
-tv Dumps the .debug_static_vars section.
-ucuname
Restricts the dumping of sections to dump only
sections of the named compilation unit.
-v Verbose mode. Shows more detailed information.
Prints the abbreviation index for each DIE (on its
DW_TAG line). More detailed information about the
.debug_frame section prints if 2 or 3 -v options
are given.
-w Dumps the .debug_weaknames section.
-x abi=abiname
where abiname is an ABI in dwarfdump.conf (see the
abiname: command in dwarfdump.conf). The abinames
defined at this time in dwarfdump.conf are
mips ia64 x86 x86_64 m68k ppc
If the cpu has relatively few registers use of -x
abi=generic (or the -R option, see above) will
needlessly slow down printing of the frame sec-
tions, so use the correct abi or generic100 (or
for a machine with more than 100 registers but
under 500 use generic500).
-x name=conf
where conf is the full pathname of a dwarfdump
configuration file. Default install location is
/usr/local/lib/dwarfdump.conf. dwarfdump looks
first for local ./dwarfdump.conf, then for
$HOME/.dwarfdump.conf then for
/usr/local/lib/dwarfdump.conf.
-y Dumps the .debug_types section.
FILES
dwarfdump
$(HOME)/.dwarfdump.conf
installpath/lib/dwarfdump.conf
NOTES
In some cases compilers use DW_FORM_data1 (for example) and
in such cases the signedness of the value must be taken from
context. Rather than attempt to determine the context,
dwarfdump prints the value with both signednesses whenever
there is ambiguity about the correct interpretation.
For example,
"DW_AT_const_value 176(as signed = -80)"
For normal DWARF consumers that correctly and fully evaluate
all attributes there is no ambiguity of signedness: the
ambiguity for dwarfdump is due to dwarfdump evaluating DIEs
in a simple order and not keeping track of much context.