<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.8">
<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="nlmconv.html#nlmconv" title="nlmconv">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
@import url("../raisonance.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">
<p>
<a name="addr2line"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="nlmconv.html#nlmconv">nlmconv</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="c_002b_002bfilt.html#c_002b_002bfilt">c++filt</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>

<h2 class="chapter">10 addr2line</h2>

<p><a name="index-addr2line-115"></a><a name="index-address-to-file-name-and-line-number-116"></a>
<!-- man title addr2line convert addresses into file names and line numbers. -->

<pre class="smallexample">     <!-- man begin SYNOPSIS addr2line -->
     addr2line [<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">-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">-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>'.  The file name and
line number for each address is printed on a separate line.  If the
<samp><span class="command">-f</span></samp> option is used, then each `<samp><span class="samp">FILENAME:LINENO</span></samp>' line is
preceded by a `<samp><span class="samp">FUNCTIONNAME</span></samp>' line which is the name of the function
containing the address.

   <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">-b </span><var>bfdname</var></samp><dt><samp><span class="env">--target=</span><var>bfdname</var></samp><dd><a name="index-object-code-format-117"></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-118"></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. 
</dl>

<!-- man end -->
</body></html>

