182 lines
11 KiB
HTML
182 lines
11 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>addr2line - GNU Binary Utilities</title>
|
|
<meta http-equiv="Content-Type" content="text/html">
|
|
<meta name="description" content="GNU Binary Utilities">
|
|
<meta name="generator" content="makeinfo 4.13">
|
|
<link title="Top" rel="start" href="index.html#Top">
|
|
<link rel="prev" href="c_002b_002bfilt.html#c_002b_002bfilt" title="c++filt">
|
|
<link rel="next" href="windmc.html#windmc" title="windmc">
|
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
|
<!--
|
|
Copyright (C) 1991-2019 Free Software Foundation, Inc.
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the GNU 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 ``GNU Free Documentation License''.
|
|
|
|
-->
|
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
<style type="text/css"><!--
|
|
pre.display { font-family:inherit }
|
|
pre.format { font-family:inherit }
|
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
|
pre.smallexample { font-size:smaller }
|
|
pre.smalllisp { font-size:smaller }
|
|
span.sc { font-variant:small-caps }
|
|
span.roman { font-family:serif; font-weight:normal; }
|
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
<div class="node">
|
|
<a name="addr2line"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="windmc.html#windmc">windmc</a>,
|
|
Previous: <a rel="previous" accesskey="p" href="c_002b_002bfilt.html#c_002b_002bfilt">c++filt</a>,
|
|
Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<h2 class="chapter">10 addr2line</h2>
|
|
|
|
<p><a name="index-addr2line-144"></a><a name="index-address-to-file-name-and-line-number-145"></a>
|
|
<!-- man title addr2line convert addresses into file names and line numbers -->
|
|
|
|
<pre class="smallexample"> <!-- man begin SYNOPSIS addr2line -->
|
|
addr2line [<samp><span class="option">-a</span></samp>|<samp><span class="option">--addresses</span></samp>]
|
|
[<samp><span class="option">-b</span></samp> <var>bfdname</var>|<samp><span class="option">--target=</span></samp><var>bfdname</var>]
|
|
[<samp><span class="option">-C</span></samp>|<samp><span class="option">--demangle</span></samp>[=<var>style</var>]]
|
|
[<samp><span class="option">-r</span></samp>|<samp><span class="option">--no-recurse-limit</span></samp>]
|
|
[<samp><span class="option">-R</span></samp>|<samp><span class="option">--recurse-limit</span></samp>]
|
|
[<samp><span class="option">-e</span></samp> <var>filename</var>|<samp><span class="option">--exe=</span></samp><var>filename</var>]
|
|
[<samp><span class="option">-f</span></samp>|<samp><span class="option">--functions</span></samp>] [<samp><span class="option">-s</span></samp>|<samp><span class="option">--basename</span></samp>]
|
|
[<samp><span class="option">-i</span></samp>|<samp><span class="option">--inlines</span></samp>]
|
|
[<samp><span class="option">-p</span></samp>|<samp><span class="option">--pretty-print</span></samp>]
|
|
[<samp><span class="option">-j</span></samp>|<samp><span class="option">--section=</span></samp><var>name</var>]
|
|
[<samp><span class="option">-H</span></samp>|<samp><span class="option">--help</span></samp>] [<samp><span class="option">-V</span></samp>|<samp><span class="option">--version</span></samp>]
|
|
[addr addr ...]
|
|
<!-- man end -->
|
|
</pre>
|
|
<!-- man begin DESCRIPTION addr2line -->
|
|
<p><samp><span class="command">addr2line</span></samp> 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 <samp><span class="option">-e</span></samp>
|
|
option. The default is the file <samp><span class="file">a.out</span></samp>. The section in the relocatable
|
|
object to use is specified with the <samp><span class="option">-j</span></samp> option.
|
|
|
|
<p><samp><span class="command">addr2line</span></samp> has two modes of operation.
|
|
|
|
<p>In the first, hexadecimal addresses are specified on the command line,
|
|
and <samp><span class="command">addr2line</span></samp> displays the file name and line number for each
|
|
address.
|
|
|
|
<p>In the second, <samp><span class="command">addr2line</span></samp> reads hexadecimal addresses from
|
|
standard input, and prints the file name and line number for each
|
|
address on standard output. In this mode, <samp><span class="command">addr2line</span></samp> may be used
|
|
in a pipe to convert dynamically chosen addresses.
|
|
|
|
<p>The format of the output is ‘<samp><span class="samp">FILENAME:LINENO</span></samp>’. By default
|
|
each input address generates one line of output.
|
|
|
|
<p>Two options can generate additional lines before each
|
|
‘<samp><span class="samp">FILENAME:LINENO</span></samp>’ line (in that order).
|
|
|
|
<p>If the <samp><span class="option">-a</span></samp> option is used then a line with the input address
|
|
is displayed.
|
|
|
|
<p>If the <samp><span class="option">-f</span></samp> option is used, then a line with the
|
|
‘<samp><span class="samp">FUNCTIONNAME</span></samp>’ is displayed. This is the name of the function
|
|
containing the address.
|
|
|
|
<p>One option can generate additional lines after the
|
|
‘<samp><span class="samp">FILENAME:LINENO</span></samp>’ line.
|
|
|
|
<p>If the <samp><span class="option">-i</span></samp> 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
|
|
<samp><span class="option">-f</span></samp> option is used) are displayed for each inlined function.
|
|
|
|
<p>Alternatively if the <samp><span class="option">-p</span></samp> 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
|
|
<samp><span class="option">-i</span></samp> 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 ‘<samp><span class="samp">(inlined by)</span></samp>’.
|
|
|
|
<p>If the file name or function name can not be determined,
|
|
<samp><span class="command">addr2line</span></samp> will print two question marks in their place. If the
|
|
line number can not be determined, <samp><span class="command">addr2line</span></samp> will print 0.
|
|
|
|
<!-- man end -->
|
|
<!-- man begin OPTIONS addr2line -->
|
|
<p>The long and short forms of options, shown here as alternatives, are
|
|
equivalent.
|
|
|
|
<dl>
|
|
<dt><samp><span class="env">-a</span></samp><dt><samp><span class="env">--addresses</span></samp><dd>Display the address before the function name, file and line number
|
|
information. The address is printed with a ‘<samp><span class="samp">0x</span></samp>’ prefix to easily
|
|
identify it.
|
|
|
|
<br><dt><samp><span class="env">-b </span><var>bfdname</var></samp><dt><samp><span class="env">--target=</span><var>bfdname</var></samp><dd><a name="index-object-code-format-146"></a>Specify that the object-code format for the object files is
|
|
<var>bfdname</var>.
|
|
|
|
<br><dt><samp><span class="env">-C</span></samp><dt><samp><span class="env">--demangle[=</span><var>style</var><span class="env">]</span></samp><dd><a name="index-demangling-in-objdump-147"></a>Decode (<dfn>demangle</dfn>) low-level symbol names into user-level names.
|
|
Besides removing any initial underscore prepended by the system, this
|
|
makes C++ 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. See <a href="c_002b_002bfilt.html#c_002b_002bfilt">c++filt</a>,
|
|
for more information on demangling.
|
|
|
|
<br><dt><samp><span class="env">-e </span><var>filename</var></samp><dt><samp><span class="env">--exe=</span><var>filename</var></samp><dd>Specify the name of the executable for which addresses should be
|
|
translated. The default file is <samp><span class="file">a.out</span></samp>.
|
|
|
|
<br><dt><samp><span class="env">-f</span></samp><dt><samp><span class="env">--functions</span></samp><dd>Display function names as well as file and line number information.
|
|
|
|
<br><dt><samp><span class="env">-s</span></samp><dt><samp><span class="env">--basenames</span></samp><dd>Display only the base of each file name.
|
|
|
|
<br><dt><samp><span class="env">-i</span></samp><dt><samp><span class="env">--inlines</span></samp><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 <code>main</code> inlines
|
|
<code>callee1</code> which inlines <code>callee2</code>, and address is from
|
|
<code>callee2</code>, the source information for <code>callee1</code> and <code>main</code>
|
|
will also be printed.
|
|
|
|
<br><dt><samp><span class="env">-j</span></samp><dt><samp><span class="env">--section</span></samp><dd>Read offsets relative to the specified section instead of absolute addresses.
|
|
|
|
<br><dt><samp><span class="env">-p</span></samp><dt><samp><span class="env">--pretty-print</span></samp><dd>Make the output more human friendly: each location are printed on one line.
|
|
If option <samp><span class="option">-i</span></samp> is specified, lines for all enclosing scopes are
|
|
prefixed with ‘<samp><span class="samp">(inlined by)</span></samp>’.
|
|
|
|
<br><dt><samp><span class="env">-r</span></samp><dt><samp><span class="env">-R</span></samp><dt><samp><span class="env">--recurse-limit</span></samp><dt><samp><span class="env">--no-recurse-limit</span></samp><dt><samp><span class="env">--recursion-limit</span></samp><dt><samp><span class="env">--no-recursion-limit</span></samp><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 <samp><span class="option">-r</span></samp> option is a synonym for the
|
|
<samp><span class="option">--no-recurse-limit</span></samp> option. The <samp><span class="option">-R</span></samp> option is a
|
|
synonym for the <samp><span class="option">--recurse-limit</span></samp> option.
|
|
|
|
<p>Note this option is only effective if the <samp><span class="option">-C</span></samp> or
|
|
<samp><span class="option">--demangle</span></samp> option has been enabled.
|
|
|
|
</dl>
|
|
|
|
<!-- man end -->
|
|
</body></html>
|
|
|