1<html lang="en"> 2<head> 3<title>addr2line - GNU Binary Utilities</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="GNU Binary Utilities"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="prev" href="c_002b_002bfilt.html#c_002b_002bfilt" title="c++filt"> 9<link rel="next" href="nlmconv.html#nlmconv" title="nlmconv"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1991-2013 Free Software Foundation, Inc. 13 14Permission is granted to copy, distribute and/or modify this document 15under the terms of the GNU Free Documentation License, Version 1.3 16or any later version published by the Free Software Foundation; 17with no Invariant Sections, with no Front-Cover Texts, and with no 18Back-Cover Texts. A copy of the license is included in the 19section entitled ``GNU Free Documentation License''. 20 21--> 22<meta http-equiv="Content-Style-Type" content="text/css"> 23<style type="text/css"><!-- 24 pre.display { font-family:inherit } 25 pre.format { font-family:inherit } 26 pre.smalldisplay { font-family:inherit; font-size:smaller } 27 pre.smallformat { font-family:inherit; font-size:smaller } 28 pre.smallexample { font-size:smaller } 29 pre.smalllisp { font-size:smaller } 30 span.sc { font-variant:small-caps } 31 span.roman { font-family:serif; font-weight:normal; } 32 span.sansserif { font-family:sans-serif; font-weight:normal; } 33--></style> 34<link rel="stylesheet" type="text/css" href="../cs.css"> 35</head> 36<body> 37<div class="node"> 38<a name="addr2line"></a> 39<p> 40Next: <a rel="next" accesskey="n" href="nlmconv.html#nlmconv">nlmconv</a>, 41Previous: <a rel="previous" accesskey="p" href="c_002b_002bfilt.html#c_002b_002bfilt">c++filt</a>, 42Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 43<hr> 44</div> 45 46<h2 class="chapter">10 addr2line</h2> 47 48<p><a name="index-addr2line-139"></a><a name="index-address-to-file-name-and-line-number-140"></a> 49<!-- man title addr2line convert addresses into file names and line numbers. --> 50 51<pre class="smallexample"> <!-- man begin SYNOPSIS addr2line --> 52 addr2line [<samp><span class="option">-a</span></samp>|<samp><span class="option">--addresses</span></samp>] 53 [<samp><span class="option">-b</span></samp> <var>bfdname</var>|<samp><span class="option">--target=</span></samp><var>bfdname</var>] 54 [<samp><span class="option">-C</span></samp>|<samp><span class="option">--demangle</span></samp>[=<var>style</var>]] 55 [<samp><span class="option">-e</span></samp> <var>filename</var>|<samp><span class="option">--exe=</span></samp><var>filename</var>] 56 [<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>] 57 [<samp><span class="option">-i</span></samp>|<samp><span class="option">--inlines</span></samp>] 58 [<samp><span class="option">-p</span></samp>|<samp><span class="option">--pretty-print</span></samp>] 59 [<samp><span class="option">-j</span></samp>|<samp><span class="option">--section=</span></samp><var>name</var>] 60 [<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>] 61 [addr addr ...] 62 <!-- man end --> 63</pre> 64 <!-- man begin DESCRIPTION addr2line --> 65 <p><samp><span class="command">addr2line</span></samp> translates addresses into file names and line numbers. 66Given an address in an executable or an offset in a section of a relocatable 67object, it uses the debugging information to figure out which file name and 68line number are associated with it. 69 70 <p>The executable or relocatable object to use is specified with the <samp><span class="option">-e</span></samp> 71option. The default is the file <samp><span class="file">a.out</span></samp>. The section in the relocatable 72object to use is specified with the <samp><span class="option">-j</span></samp> option. 73 74 <p><samp><span class="command">addr2line</span></samp> has two modes of operation. 75 76 <p>In the first, hexadecimal addresses are specified on the command line, 77and <samp><span class="command">addr2line</span></samp> displays the file name and line number for each 78address. 79 80 <p>In the second, <samp><span class="command">addr2line</span></samp> reads hexadecimal addresses from 81standard input, and prints the file name and line number for each 82address on standard output. In this mode, <samp><span class="command">addr2line</span></samp> may be used 83in a pipe to convert dynamically chosen addresses. 84 85 <p>The format of the output is ‘<samp><span class="samp">FILENAME:LINENO</span></samp>’. The file name and 86line number for each input address is printed on separate lines. 87 88 <p>If the <samp><span class="option">-f</span></samp> option is used, then each ‘<samp><span class="samp">FILENAME:LINENO</span></samp>’ 89line is preceded by ‘<samp><span class="samp">FUNCTIONNAME</span></samp>’ which is the name of the 90function containing the address. 91 92 <p>If the <samp><span class="option">-i</span></samp> option is used and the code at the given address is 93present there because of inlining by the compiler then the 94‘<samp><span class="samp">{FUNCTIONNAME} FILENAME:LINENO</span></samp>’ information for the inlining 95function will be displayed afterwards. This continues recursively 96until there is no more inlining to report. 97 98 <p>If the <samp><span class="option">-a</span></samp> option is used then the output is prefixed by the 99input address. 100 101 <p>If the <samp><span class="option">-p</span></samp> option is used then the output for each input 102address is displayed on one, possibly quite long, line. If 103<samp><span class="option">-p</span></samp> is not used then the output is broken up into multiple 104lines, based on the paragraphs above. 105 106 <p>If the file name or function name can not be determined, 107<samp><span class="command">addr2line</span></samp> will print two question marks in their place. If the 108line number can not be determined, <samp><span class="command">addr2line</span></samp> will print 0. 109 110<!-- man end --> 111<!-- man begin OPTIONS addr2line --> 112 <p>The long and short forms of options, shown here as alternatives, are 113equivalent. 114 115 <dl> 116<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 117information. The address is printed with a ‘<samp><span class="samp">0x</span></samp>’ prefix to easily 118identify it. 119 120 <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-141"></a>Specify that the object-code format for the object files is 121<var>bfdname</var>. 122 123 <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-142"></a>Decode (<dfn>demangle</dfn>) low-level symbol names into user-level names. 124Besides removing any initial underscore prepended by the system, this 125makes C++ function names readable. Different compilers have different 126mangling styles. The optional demangling style argument can be used to 127choose an appropriate demangling style for your compiler. See <a href="c_002b_002bfilt.html#c_002b_002bfilt">c++filt</a>, 128for more information on demangling. 129 130 <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 131translated. The default file is <samp><span class="file">a.out</span></samp>. 132 133 <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. 134 135 <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. 136 137 <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 138information for all enclosing scopes back to the first non-inlined 139function will also be printed. For example, if <code>main</code> inlines 140<code>callee1</code> which inlines <code>callee2</code>, and address is from 141<code>callee2</code>, the source information for <code>callee1</code> and <code>main</code> 142will also be printed. 143 144 <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. 145 146 <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. 147If option <samp><span class="option">-i</span></samp> is specified, lines for all enclosing scopes are 148prefixed with ‘<samp><span class="samp">(inlined by)</span></samp>’. 149</dl> 150 151<!-- man end --> 152 </body></html> 153 154