You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
250 lines
10 KiB
HTML
250 lines
10 KiB
HTML
4 years ago
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
|
<html>
|
||
|
<!-- 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".
|
||
|
-->
|
||
|
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
|
||
|
<head>
|
||
|
<title>addr2line (GNU Binary Utilities)</title>
|
||
|
|
||
|
<meta name="description" content="addr2line (GNU Binary Utilities)">
|
||
|
<meta name="keywords" content="addr2line (GNU Binary Utilities)">
|
||
|
<meta name="resource-type" content="document">
|
||
|
<meta name="distribution" content="global">
|
||
|
<meta name="Generator" content="makeinfo">
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<link href="index.html#Top" rel="start" title="Top">
|
||
|
<link href="Binutils-Index.html#Binutils-Index" rel="index" title="Binutils Index">
|
||
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
||
|
<link href="index.html#Top" rel="up" title="Top">
|
||
|
<link href="windmc.html#windmc" rel="next" title="windmc">
|
||
|
<link href="c_002b_002bfilt.html#c_002b_002bfilt" rel="prev" title="c++filt">
|
||
|
<style type="text/css">
|
||
|
<!--
|
||
|
a.summary-letter {text-decoration: none}
|
||
|
blockquote.indentedblock {margin-right: 0em}
|
||
|
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
|
||
|
blockquote.smallquotation {font-size: smaller}
|
||
|
div.display {margin-left: 3.2em}
|
||
|
div.example {margin-left: 3.2em}
|
||
|
div.lisp {margin-left: 3.2em}
|
||
|
div.smalldisplay {margin-left: 3.2em}
|
||
|
div.smallexample {margin-left: 3.2em}
|
||
|
div.smalllisp {margin-left: 3.2em}
|
||
|
kbd {font-style: oblique}
|
||
|
pre.display {font-family: inherit}
|
||
|
pre.format {font-family: inherit}
|
||
|
pre.menu-comment {font-family: serif}
|
||
|
pre.menu-preformatted {font-family: serif}
|
||
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
||
|
pre.smallexample {font-size: smaller}
|
||
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
||
|
pre.smalllisp {font-size: smaller}
|
||
|
span.nolinebreak {white-space: nowrap}
|
||
|
span.roman {font-family: initial; font-weight: normal}
|
||
|
span.sansserif {font-family: sans-serif; font-weight: normal}
|
||
|
ul.no-bullet {list-style: none}
|
||
|
-->
|
||
|
</style>
|
||
|
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body lang="en">
|
||
|
<a name="addr2line"></a>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
Next: <a href="windmc.html#windmc" accesskey="n" rel="next">windmc</a>, Previous: <a href="c_002b_002bfilt.html#c_002b_002bfilt" accesskey="p" rel="prev">c++filt</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Binutils-Index.html#Binutils-Index" title="Index" rel="index">Index</a>]</p>
|
||
|
</div>
|
||
|
<hr>
|
||
|
<a name="addr2line-1"></a>
|
||
|
<h2 class="chapter">10 addr2line</h2>
|
||
|
|
||
|
<a name="index-addr2line"></a>
|
||
|
<a name="index-address-to-file-name-and-line-number"></a>
|
||
|
|
||
|
|
||
|
<div class="smallexample">
|
||
|
<pre class="smallexample">addr2line [<samp>-a</samp>|<samp>--addresses</samp>]
|
||
|
[<samp>-b</samp> <var>bfdname</var>|<samp>--target=</samp><var>bfdname</var>]
|
||
|
[<samp>-C</samp>|<samp>--demangle</samp>[=<var>style</var>]]
|
||
|
[<samp>-r</samp>|<samp>--no-recurse-limit</samp>]
|
||
|
[<samp>-R</samp>|<samp>--recurse-limit</samp>]
|
||
|
[<samp>-e</samp> <var>filename</var>|<samp>--exe=</samp><var>filename</var>]
|
||
|
[<samp>-f</samp>|<samp>--functions</samp>] [<samp>-s</samp>|<samp>--basename</samp>]
|
||
|
[<samp>-i</samp>|<samp>--inlines</samp>]
|
||
|
[<samp>-p</samp>|<samp>--pretty-print</samp>]
|
||
|
[<samp>-j</samp>|<samp>--section=</samp><var>name</var>]
|
||
|
[<samp>-H</samp>|<samp>--help</samp>] [<samp>-V</samp>|<samp>--version</samp>]
|
||
|
[addr addr …]
|
||
|
</pre></div>
|
||
|
|
||
|
|
||
|
<p><code>addr2line</code> 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>
|
||
|
<p>The executable or relocatable object to use is specified with the <samp>-e</samp>
|
||
|
option. The default is the file <samp>a.out</samp>. The section in the relocatable
|
||
|
object to use is specified with the <samp>-j</samp> option.
|
||
|
</p>
|
||
|
<p><code>addr2line</code> has two modes of operation.
|
||
|
</p>
|
||
|
<p>In the first, hexadecimal addresses are specified on the command line,
|
||
|
and <code>addr2line</code> displays the file name and line number for each
|
||
|
address.
|
||
|
</p>
|
||
|
<p>In the second, <code>addr2line</code> reads hexadecimal addresses from
|
||
|
standard input, and prints the file name and line number for each
|
||
|
address on standard output. In this mode, <code>addr2line</code> may be used
|
||
|
in a pipe to convert dynamically chosen addresses.
|
||
|
</p>
|
||
|
<p>The format of the output is ‘<samp>FILENAME:LINENO</samp>’. By default
|
||
|
each input address generates one line of output.
|
||
|
</p>
|
||
|
<p>Two options can generate additional lines before each
|
||
|
‘<samp>FILENAME:LINENO</samp>’ line (in that order).
|
||
|
</p>
|
||
|
<p>If the <samp>-a</samp> option is used then a line with the input address
|
||
|
is displayed.
|
||
|
</p>
|
||
|
<p>If the <samp>-f</samp> option is used, then a line with the
|
||
|
‘<samp>FUNCTIONNAME</samp>’ is displayed. This is the name of the function
|
||
|
containing the address.
|
||
|
</p>
|
||
|
<p>One option can generate additional lines after the
|
||
|
‘<samp>FILENAME:LINENO</samp>’ line.
|
||
|
</p>
|
||
|
<p>If the <samp>-i</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>-f</samp> option is used) are displayed for each inlined function.
|
||
|
</p>
|
||
|
<p>Alternatively if the <samp>-p</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>-i</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>(inlined by)</samp>’.
|
||
|
</p>
|
||
|
<p>If the file name or function name can not be determined,
|
||
|
<code>addr2line</code> will print two question marks in their place. If the
|
||
|
line number can not be determined, <code>addr2line</code> will print 0.
|
||
|
</p>
|
||
|
|
||
|
|
||
|
<p>The long and short forms of options, shown here as alternatives, are
|
||
|
equivalent.
|
||
|
</p>
|
||
|
<dl compact="compact">
|
||
|
<dt><code>-a</code></dt>
|
||
|
<dt><code>--addresses</code></dt>
|
||
|
<dd><p>Display the address before the function name, file and line number
|
||
|
information. The address is printed with a ‘<samp>0x</samp>’ prefix to easily
|
||
|
identify it.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-b <var>bfdname</var></code></dt>
|
||
|
<dt><code>--target=<var>bfdname</var></code></dt>
|
||
|
<dd><a name="index-object-code-format-4"></a>
|
||
|
<p>Specify that the object-code format for the object files is
|
||
|
<var>bfdname</var>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-C</code></dt>
|
||
|
<dt><code>--demangle[=<var>style</var>]</code></dt>
|
||
|
<dd><a name="index-demangling-in-objdump-1"></a>
|
||
|
<p>Decode (<em>demangle</em>) 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.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-e <var>filename</var></code></dt>
|
||
|
<dt><code>--exe=<var>filename</var></code></dt>
|
||
|
<dd><p>Specify the name of the executable for which addresses should be
|
||
|
translated. The default file is <samp>a.out</samp>.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-f</code></dt>
|
||
|
<dt><code>--functions</code></dt>
|
||
|
<dd><p>Display function names as well as file and line number information.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-s</code></dt>
|
||
|
<dt><code>--basenames</code></dt>
|
||
|
<dd><p>Display only the base of each file name.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-i</code></dt>
|
||
|
<dt><code>--inlines</code></dt>
|
||
|
<dd><p>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.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-j</code></dt>
|
||
|
<dt><code>--section</code></dt>
|
||
|
<dd><p>Read offsets relative to the specified section instead of absolute addresses.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-p</code></dt>
|
||
|
<dt><code>--pretty-print</code></dt>
|
||
|
<dd><p>Make the output more human friendly: each location are printed on one line.
|
||
|
If option <samp>-i</samp> is specified, lines for all enclosing scopes are
|
||
|
prefixed with ‘<samp>(inlined by)</samp>’.
|
||
|
</p>
|
||
|
</dd>
|
||
|
<dt><code>-r</code></dt>
|
||
|
<dt><code>-R</code></dt>
|
||
|
<dt><code>--recurse-limit</code></dt>
|
||
|
<dt><code>--no-recurse-limit</code></dt>
|
||
|
<dt><code>--recursion-limit</code></dt>
|
||
|
<dt><code>--no-recursion-limit</code></dt>
|
||
|
<dd><p>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>
|
||
|
<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>
|
||
|
<p>The <samp>-r</samp> option is a synonym for the
|
||
|
<samp>--no-recurse-limit</samp> option. The <samp>-R</samp> option is a
|
||
|
synonym for the <samp>--recurse-limit</samp> option.
|
||
|
</p>
|
||
|
<p>Note this option is only effective if the <samp>-C</samp> or
|
||
|
<samp>--demangle</samp> option has been enabled.
|
||
|
</p>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
|
||
|
|
||
|
<hr>
|
||
|
<div class="header">
|
||
|
<p>
|
||
|
Next: <a href="windmc.html#windmc" accesskey="n" rel="next">windmc</a>, Previous: <a href="c_002b_002bfilt.html#c_002b_002bfilt" accesskey="p" rel="prev">c++filt</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Binutils-Index.html#Binutils-Index" title="Index" rel="index">Index</a>]</p>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|