man-pages/man1/addr2line.1.html
2021-03-31 01:06:50 +01:00

315 lines
9.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of ADDR2LINE</TITLE>
</HEAD><BODY>
<H1>ADDR2LINE</H1>
Section: GNU Development Tools (1)<BR>Updated: 2021-01-21<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
addr2line - convert addresses into file names and line numbers
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
addr2line [<B>-a</B>|<B>--addresses</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-b</B>&nbsp;<I>bfdname</I>|<B>--target=</B><I>bfdname</I>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-C</B>|<B>--demangle</B>[=<I>style</I>]]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-r</B>|<B>--no-recurse-limit</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-R</B>|<B>--recurse-limit</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-e</B>&nbsp;<I>filename</I>|<B>--exe=</B><I>filename</I>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-f</B>|<B>--functions</B>]&nbsp;[<B>-s</B>|<B>--basename</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-i</B>|<B>--inlines</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-p</B>|<B>--pretty-print</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-j</B>|<B>--section=</B><I>name</I>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-H</B>|<B>--help</B>]&nbsp;[<B>-V</B>|<B>--version</B>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[addr&nbsp;addr&nbsp;...]
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>addr2line</B> translates addresses into file names and line numbers.
Given an address in an executable or an offset in a section of a relocatable
object, it uses the debugging information to figure out which file name and
line number are associated with it.
<P>
The executable or relocatable object to use is specified with the <B>-e</B>
option. The default is the file <I>a.out</I>. The section in the relocatable
object to use is specified with the <B>-j</B> option.
<P>
<B>addr2line</B> has two modes of operation.
<P>
In the first, hexadecimal addresses are specified on the command line,
and <B>addr2line</B> displays the file name and line number for each
address.
<P>
In the second, <B>addr2line</B> reads hexadecimal addresses from
standard input, and prints the file name and line number for each
address on standard output. In this mode, <B>addr2line</B> may be used
in a pipe to convert dynamically chosen addresses.
<P>
The format of the output is <B></B><FONT SIZE="-1"><B>FILENAME:LINENO</B></FONT><B></B>. By default
each input address generates one line of output.
<P>
Two options can generate additional lines before each
<B></B><FONT SIZE="-1"><B>FILENAME:LINENO</B></FONT><B></B> line (in that order).
<P>
If the <B>-a</B> option is used then a line with the input address
is displayed.
<P>
If the <B>-f</B> option is used, then a line with the
<B></B><FONT SIZE="-1"><B>FUNCTIONNAME</B></FONT><B></B> is displayed. This is the name of the function
containing the address.
<P>
One option can generate additional lines after the
<B></B><FONT SIZE="-1"><B>FILENAME:LINENO</B></FONT><B></B> line.
<P>
If the <B>-i</B> option is used and the code at the given address is
present there because of inlining by the compiler then additional
lines are displayed afterwards. One or two extra lines (if the
<B>-f</B> option is used) are displayed for each inlined function.
<P>
Alternatively if the <B>-p</B> option is used then each input
address generates a single, long, output line containing the address,
the function name, the file name and the line number. If the
<B>-i</B> option has also been used then any inlined functions will
be displayed in the same manner, but on separate lines, and prefixed
by the text <B>(inlined by)</B>.
<P>
If the file name or function name can not be determined,
<B>addr2line</B> will print two question marks in their place. If the
line number can not be determined, <B>addr2line</B> will print 0.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
The long and short forms of options, shown here as alternatives, are
equivalent.
<DL COMPACT>
<DT id="1"><B>-a</B><DD>
<DT id="2"><B>--addresses</B><DD>
Display the address before the function name, file and line number
information. The address is printed with a <B>0x</B> prefix to easily
identify it.
<DT id="3"><B>-b</B> <I>bfdname</I><DD>
<DT id="4"><B>--target=</B><I>bfdname</I><DD>
Specify that the object-code format for the object files is
<I>bfdname</I>.
<DT id="5"><B>-C</B><DD>
<DT id="6"><B>--demangle[=</B><I>style</I><B>]</B><DD>
Decode (<I>demangle</I>) low-level symbol names into user-level names.
Besides removing any initial underscore prepended by the system, this
makes C<FONT SIZE="-2">++</FONT> function names readable. Different compilers have different
mangling styles. The optional demangling style argument can be used to
choose an appropriate demangling style for your compiler.
<DT id="7"><B>-e</B> <I>filename</I><DD>
<DT id="8"><B>--exe=</B><I>filename</I><DD>
Specify the name of the executable for which addresses should be
translated. The default file is <I>a.out</I>.
<DT id="9"><B>-f</B><DD>
<DT id="10"><B>--functions</B><DD>
Display function names as well as file and line number information.
<DT id="11"><B>-s</B><DD>
<DT id="12"><B>--basenames</B><DD>
Display only the base of each file name.
<DT id="13"><B>-i</B><DD>
<DT id="14"><B>--inlines</B><DD>
If the address belongs to a function that was inlined, the source
information for all enclosing scopes back to the first non-inlined
function will also be printed. For example, if <TT>&quot;main&quot;</TT> inlines
<TT>&quot;callee1&quot;</TT> which inlines <TT>&quot;callee2&quot;</TT>, and address is from
<TT>&quot;callee2&quot;</TT>, the source information for <TT>&quot;callee1&quot;</TT> and <TT>&quot;main&quot;</TT>
will also be printed.
<DT id="15"><B>-j</B><DD>
<DT id="16"><B>--section</B><DD>
Read offsets relative to the specified section instead of absolute addresses.
<DT id="17"><B>-p</B><DD>
<DT id="18"><B>--pretty-print</B><DD>
Make the output more human friendly: each location are printed on one line.
If option <B>-i</B> is specified, lines for all enclosing scopes are
prefixed with <B>(inlined by)</B>.
<DT id="19"><B>-r</B><DD>
<DT id="20"><B>-R</B><DD>
<DT id="21"><B>--recurse-limit</B><DD>
<DT id="22"><B>--no-recurse-limit</B><DD>
<DT id="23"><B>--recursion-limit</B><DD>
<DT id="24"><B>--no-recursion-limit</B><DD>
Enables or disables a limit on the amount of recursion performed
whilst demangling strings. Since the name mangling formats allow for
an inifinite level of recursion it is possible to create strings whose
decoding will exhaust the amount of stack space available on the host
machine, triggering a memory fault. The limit tries to prevent this
from happening by restricting recursion to 2048 levels of nesting.
<P>
The default is for this limit to be enabled, but disabling it may be
necessary in order to demangle truly complicated names. Note however
that if the recursion limit is disabled then stack exhaustion is
possible and any bug reports about such an event will be rejected.
<P>
The <B>-r</B> option is a synonym for the
<B>--no-recurse-limit</B> option. The <B>-R</B> option is a
synonym for the <B>--recurse-limit</B> option.
<P>
Note this option is only effective if the <B>-C</B> or
<B>--demangle</B> option has been enabled.
<DT id="25"><B>@</B><I>file</I><DD>
Read command-line options from <I>file</I>. The options read are
inserted in place of the original @<I>file</I> option. If <I>file</I>
does not exist, or cannot be read, then the option will be treated
literally, and not removed.
<P>
Options in <I>file</I> are separated by whitespace. A whitespace
character may be included in an option by surrounding the entire
option in either single or double quotes. Any character (including a
backslash) may be included by prefixing the character to be included
with a backslash. The <I>file</I> may itself contain additional
@<I>file</I> options; any such options will be processed recursively.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>
Info entries for <I>binutils</I>.
<A NAME="lbAG">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright (c) 1991-2020 Free Software Foundation, Inc.
<P>
Permission is granted to copy, distribute and/or modify this document
under the terms of the <FONT SIZE="-1">GNU</FONT> Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``<FONT SIZE="-1">GNU</FONT> Free Documentation License''.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="26"><A HREF="#lbAB">NAME</A><DD>
<DT id="27"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="28"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="29"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="30"><A HREF="#lbAF">SEE ALSO</A><DD>
<DT id="31"><A HREF="#lbAG">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:06 GMT, March 31, 2021
</BODY>
</HTML>