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