You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 3 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1991-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3
  6. or any later version published by the Free Software Foundation;
  7. with no Invariant Sections, with no Front-Cover Texts, and with no
  8. Back-Cover Texts. A copy of the license is included in the
  9. section entitled "GNU Free Documentation License".
  10. -->
  11. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  12. <head>
  13. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  14. <title>addr2line (GNU Binary Utilities)</title>
  15. <meta name="description" content="addr2line (GNU Binary Utilities)">
  16. <meta name="keywords" content="addr2line (GNU Binary Utilities)">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <link href="index.html#Top" rel="start" title="Top">
  21. <link href="Binutils-Index.html#Binutils-Index" rel="index" title="Binutils Index">
  22. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  23. <link href="index.html#Top" rel="up" title="Top">
  24. <link href="windmc.html#windmc" rel="next" title="windmc">
  25. <link href="c_002b_002bfilt.html#c_002b_002bfilt" rel="prev" title="c++filt">
  26. <style type="text/css">
  27. <!--
  28. a.summary-letter {text-decoration: none}
  29. blockquote.indentedblock {margin-right: 0em}
  30. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smalllisp {margin-left: 3.2em}
  38. kbd {font-style: oblique}
  39. pre.display {font-family: inherit}
  40. pre.format {font-family: inherit}
  41. pre.menu-comment {font-family: serif}
  42. pre.menu-preformatted {font-family: serif}
  43. pre.smalldisplay {font-family: inherit; font-size: smaller}
  44. pre.smallexample {font-size: smaller}
  45. pre.smallformat {font-family: inherit; font-size: smaller}
  46. pre.smalllisp {font-size: smaller}
  47. span.nolinebreak {white-space: nowrap}
  48. span.roman {font-family: initial; font-weight: normal}
  49. span.sansserif {font-family: sans-serif; font-weight: normal}
  50. ul.no-bullet {list-style: none}
  51. -->
  52. </style>
  53. </head>
  54. <body lang="en">
  55. <a name="addr2line"></a>
  56. <div class="header">
  57. <p>
  58. 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> &nbsp; [<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>
  59. </div>
  60. <hr>
  61. <a name="addr2line-1"></a>
  62. <h2 class="chapter">10 addr2line</h2>
  63. <a name="index-addr2line"></a>
  64. <a name="index-address-to-file-name-and-line-number"></a>
  65. <div class="smallexample">
  66. <pre class="smallexample">addr2line [<samp>-a</samp>|<samp>--addresses</samp>]
  67. [<samp>-b</samp> <var>bfdname</var>|<samp>--target=</samp><var>bfdname</var>]
  68. [<samp>-C</samp>|<samp>--demangle</samp>[=<var>style</var>]]
  69. [<samp>-r</samp>|<samp>--no-recurse-limit</samp>]
  70. [<samp>-R</samp>|<samp>--recurse-limit</samp>]
  71. [<samp>-e</samp> <var>filename</var>|<samp>--exe=</samp><var>filename</var>]
  72. [<samp>-f</samp>|<samp>--functions</samp>] [<samp>-s</samp>|<samp>--basename</samp>]
  73. [<samp>-i</samp>|<samp>--inlines</samp>]
  74. [<samp>-p</samp>|<samp>--pretty-print</samp>]
  75. [<samp>-j</samp>|<samp>--section=</samp><var>name</var>]
  76. [<samp>-H</samp>|<samp>--help</samp>] [<samp>-V</samp>|<samp>--version</samp>]
  77. [addr addr &hellip;]
  78. </pre></div>
  79. <p><code>addr2line</code> translates addresses into file names and line numbers.
  80. Given an address in an executable or an offset in a section of a relocatable
  81. object, it uses the debugging information to figure out which file name and
  82. line number are associated with it.
  83. </p>
  84. <p>The executable or relocatable object to use is specified with the <samp>-e</samp>
  85. option. The default is the file <samp>a.out</samp>. The section in the relocatable
  86. object to use is specified with the <samp>-j</samp> option.
  87. </p>
  88. <p><code>addr2line</code> has two modes of operation.
  89. </p>
  90. <p>In the first, hexadecimal addresses are specified on the command line,
  91. and <code>addr2line</code> displays the file name and line number for each
  92. address.
  93. </p>
  94. <p>In the second, <code>addr2line</code> reads hexadecimal addresses from
  95. standard input, and prints the file name and line number for each
  96. address on standard output. In this mode, <code>addr2line</code> may be used
  97. in a pipe to convert dynamically chosen addresses.
  98. </p>
  99. <p>The format of the output is &lsquo;<samp>FILENAME:LINENO</samp>&rsquo;. By default
  100. each input address generates one line of output.
  101. </p>
  102. <p>Two options can generate additional lines before each
  103. &lsquo;<samp>FILENAME:LINENO</samp>&rsquo; line (in that order).
  104. </p>
  105. <p>If the <samp>-a</samp> option is used then a line with the input address
  106. is displayed.
  107. </p>
  108. <p>If the <samp>-f</samp> option is used, then a line with the
  109. &lsquo;<samp>FUNCTIONNAME</samp>&rsquo; is displayed. This is the name of the function
  110. containing the address.
  111. </p>
  112. <p>One option can generate additional lines after the
  113. &lsquo;<samp>FILENAME:LINENO</samp>&rsquo; line.
  114. </p>
  115. <p>If the <samp>-i</samp> option is used and the code at the given address is
  116. present there because of inlining by the compiler then additional
  117. lines are displayed afterwards. One or two extra lines (if the
  118. <samp>-f</samp> option is used) are displayed for each inlined function.
  119. </p>
  120. <p>Alternatively if the <samp>-p</samp> option is used then each input
  121. address generates a single, long, output line containing the address,
  122. the function name, the file name and the line number. If the
  123. <samp>-i</samp> option has also been used then any inlined functions will
  124. be displayed in the same manner, but on separate lines, and prefixed
  125. by the text &lsquo;<samp>(inlined by)</samp>&rsquo;.
  126. </p>
  127. <p>If the file name or function name can not be determined,
  128. <code>addr2line</code> will print two question marks in their place. If the
  129. line number can not be determined, <code>addr2line</code> will print 0.
  130. </p>
  131. <p>The long and short forms of options, shown here as alternatives, are
  132. equivalent.
  133. </p>
  134. <dl compact="compact">
  135. <dt><code>-a</code></dt>
  136. <dt><code>--addresses</code></dt>
  137. <dd><p>Display the address before the function name, file and line number
  138. information. The address is printed with a &lsquo;<samp>0x</samp>&rsquo; prefix to easily
  139. identify it.
  140. </p>
  141. </dd>
  142. <dt><code>-b <var>bfdname</var></code></dt>
  143. <dt><code>--target=<var>bfdname</var></code></dt>
  144. <dd><a name="index-object-code-format-4"></a>
  145. <p>Specify that the object-code format for the object files is
  146. <var>bfdname</var>.
  147. </p>
  148. </dd>
  149. <dt><code>-C</code></dt>
  150. <dt><code>--demangle[=<var>style</var>]</code></dt>
  151. <dd><a name="index-demangling-in-objdump-1"></a>
  152. <p>Decode (<em>demangle</em>) low-level symbol names into user-level names.
  153. Besides removing any initial underscore prepended by the system, this
  154. makes C++ function names readable. Different compilers have different
  155. mangling styles. The optional demangling style argument can be used to
  156. choose an appropriate demangling style for your compiler. See <a href="c_002b_002bfilt.html#c_002b_002bfilt">c++filt</a>,
  157. for more information on demangling.
  158. </p>
  159. </dd>
  160. <dt><code>-e <var>filename</var></code></dt>
  161. <dt><code>--exe=<var>filename</var></code></dt>
  162. <dd><p>Specify the name of the executable for which addresses should be
  163. translated. The default file is <samp>a.out</samp>.
  164. </p>
  165. </dd>
  166. <dt><code>-f</code></dt>
  167. <dt><code>--functions</code></dt>
  168. <dd><p>Display function names as well as file and line number information.
  169. </p>
  170. </dd>
  171. <dt><code>-s</code></dt>
  172. <dt><code>--basenames</code></dt>
  173. <dd><p>Display only the base of each file name.
  174. </p>
  175. </dd>
  176. <dt><code>-i</code></dt>
  177. <dt><code>--inlines</code></dt>
  178. <dd><p>If the address belongs to a function that was inlined, the source
  179. information for all enclosing scopes back to the first non-inlined
  180. function will also be printed. For example, if <code>main</code> inlines
  181. <code>callee1</code> which inlines <code>callee2</code>, and address is from
  182. <code>callee2</code>, the source information for <code>callee1</code> and <code>main</code>
  183. will also be printed.
  184. </p>
  185. </dd>
  186. <dt><code>-j</code></dt>
  187. <dt><code>--section</code></dt>
  188. <dd><p>Read offsets relative to the specified section instead of absolute addresses.
  189. </p>
  190. </dd>
  191. <dt><code>-p</code></dt>
  192. <dt><code>--pretty-print</code></dt>
  193. <dd><p>Make the output more human friendly: each location are printed on one line.
  194. If option <samp>-i</samp> is specified, lines for all enclosing scopes are
  195. prefixed with &lsquo;<samp>(inlined by)</samp>&rsquo;.
  196. </p>
  197. </dd>
  198. <dt><code>-r</code></dt>
  199. <dt><code>-R</code></dt>
  200. <dt><code>--recurse-limit</code></dt>
  201. <dt><code>--no-recurse-limit</code></dt>
  202. <dt><code>--recursion-limit</code></dt>
  203. <dt><code>--no-recursion-limit</code></dt>
  204. <dd><p>Enables or disables a limit on the amount of recursion performed
  205. whilst demangling strings. Since the name mangling formats allow for
  206. an inifinite level of recursion it is possible to create strings whose
  207. decoding will exhaust the amount of stack space available on the host
  208. machine, triggering a memory fault. The limit tries to prevent this
  209. from happening by restricting recursion to 2048 levels of nesting.
  210. </p>
  211. <p>The default is for this limit to be enabled, but disabling it may be
  212. necessary in order to demangle truly complicated names. Note however
  213. that if the recursion limit is disabled then stack exhaustion is
  214. possible and any bug reports about such an event will be rejected.
  215. </p>
  216. <p>The <samp>-r</samp> option is a synonym for the
  217. <samp>--no-recurse-limit</samp> option. The <samp>-R</samp> option is a
  218. synonym for the <samp>--recurse-limit</samp> option.
  219. </p>
  220. <p>Note this option is only effective if the <samp>-C</samp> or
  221. <samp>--demangle</samp> option has been enabled.
  222. </p>
  223. </dd>
  224. </dl>
  225. <hr>
  226. <div class="header">
  227. <p>
  228. 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> &nbsp; [<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>
  229. </div>
  230. </body>
  231. </html>