1ADDR2LINE(1) GNU Development Tools ADDR2LINE(1)
2
3
4
6 addr2line - convert addresses or symbol+offset into file names and line
7 numbers
8
10 addr2line [-a|--addresses]
11 [-b bfdname|--target=bfdname]
12 [-C|--demangle[=style]]
13 [-r|--no-recurse-limit]
14 [-R|--recurse-limit]
15 [-e filename|--exe=filename]
16 [-f|--functions] [-s|--basename]
17 [-i|--inlines]
18 [-p|--pretty-print]
19 [-j|--section=name]
20 [-H|--help] [-V|--version]
21 [addr addr ...]
22
24 addr2line translates addresses or symbol+offset into file names and
25 line numbers. Given an address or symbol+offset in an executable or an
26 offset in a section of a relocatable object, it uses the debugging
27 information to figure out which file name and line number are
28 associated with it.
29
30 The executable or relocatable object to use is specified with the -e
31 option. The default is the file a.out. The section in the relocatable
32 object to use is specified with the -j option.
33
34 addr2line has two modes of operation.
35
36 In the first, hexadecimal addresses or symbol+offset are specified on
37 the command line, and addr2line displays the file name and line number
38 for each address.
39
40 In the second, addr2line reads hexadecimal addresses or symbol+offset
41 from standard input, and prints the file name and line number for each
42 address on standard output. In this mode, addr2line may be used in a
43 pipe to convert dynamically chosen addresses.
44
45 The format of the output is FILENAME:LINENO. By default each input
46 address generates one line of output.
47
48 Two options can generate additional lines before each FILENAME:LINENO
49 line (in that order).
50
51 If the -a option is used then a line with the input address is
52 displayed.
53
54 If the -f option is used, then a line with the FUNCTIONNAME is
55 displayed. This is the name of the function containing the address.
56
57 One option can generate additional lines after the FILENAME:LINENO
58 line.
59
60 If the -i option is used and the code at the given address is present
61 there because of inlining by the compiler then additional lines are
62 displayed afterwards. One or two extra lines (if the -f option is
63 used) are displayed for each inlined function.
64
65 Alternatively if the -p option is used then each input address
66 generates a single, long, output line containing the address, the
67 function name, the file name and the line number. If the -i option has
68 also been used then any inlined functions will be displayed in the same
69 manner, but on separate lines, and prefixed by the text (inlined by).
70
71 If the file name or function name can not be determined, addr2line will
72 print two question marks in their place. If the line number can not be
73 determined, addr2line will print 0.
74
75 When symbol+offset is used, +offset is optional, except when the symbol
76 is ambigious with a hex number. The resolved symbols can be mangled or
77 unmangled, except unmangled symbols with + are not allowed.
78
80 The long and short forms of options, shown here as alternatives, are
81 equivalent.
82
83 -a
84 --addresses
85 Display the address before the function name, file and line number
86 information. The address is printed with a 0x prefix to easily
87 identify it.
88
89 -b bfdname
90 --target=bfdname
91 Specify that the object-code format for the object files is
92 bfdname.
93
94 -C
95 --demangle[=style]
96 Decode (demangle) low-level symbol names into user-level names.
97 Besides removing any initial underscore prepended by the system,
98 this makes C++ function names readable. Different compilers have
99 different mangling styles. The optional demangling style argument
100 can be used to choose an appropriate demangling style for your
101 compiler.
102
103 -e filename
104 --exe=filename
105 Specify the name of the executable for which addresses should be
106 translated. The default file is a.out.
107
108 -f
109 --functions
110 Display function names as well as file and line number information.
111
112 -s
113 --basenames
114 Display only the base of each file name.
115
116 -i
117 --inlines
118 If the address belongs to a function that was inlined, the source
119 information for all enclosing scopes back to the first non-inlined
120 function will also be printed. For example, if "main" inlines
121 "callee1" which inlines "callee2", and address is from "callee2",
122 the source information for "callee1" and "main" will also be
123 printed.
124
125 -j
126 --section
127 Read offsets relative to the specified section instead of absolute
128 addresses.
129
130 -p
131 --pretty-print
132 Make the output more human friendly: each location are printed on
133 one line. If option -i is specified, lines for all enclosing
134 scopes are prefixed with (inlined by).
135
136 -r
137 -R
138 --recurse-limit
139 --no-recurse-limit
140 --recursion-limit
141 --no-recursion-limit
142 Enables or disables a limit on the amount of recursion performed
143 whilst demangling strings. Since the name mangling formats allow
144 for an infinite level of recursion it is possible to create strings
145 whose decoding will exhaust the amount of stack space available on
146 the host machine, triggering a memory fault. The limit tries to
147 prevent this from happening by restricting recursion to 2048 levels
148 of nesting.
149
150 The default is for this limit to be enabled, but disabling it may
151 be necessary in order to demangle truly complicated names. Note
152 however that if the recursion limit is disabled then stack
153 exhaustion is possible and any bug reports about such an event will
154 be rejected.
155
156 The -r option is a synonym for the --no-recurse-limit option. The
157 -R option is a synonym for the --recurse-limit option.
158
159 Note this option is only effective if the -C or --demangle option
160 has been enabled.
161
162 @file
163 Read command-line options from file. The options read are inserted
164 in place of the original @file option. If file does not exist, or
165 cannot be read, then the option will be treated literally, and not
166 removed.
167
168 Options in file are separated by whitespace. A whitespace
169 character may be included in an option by surrounding the entire
170 option in either single or double quotes. Any character (including
171 a backslash) may be included by prefixing the character to be
172 included with a backslash. The file may itself contain additional
173 @file options; any such options will be processed recursively.
174
176 Info entries for binutils.
177
179 Copyright (c) 1991-2023 Free Software Foundation, Inc.
180
181 Permission is granted to copy, distribute and/or modify this document
182 under the terms of the GNU Free Documentation License, Version 1.3 or
183 any later version published by the Free Software Foundation; with no
184 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
185 Texts. A copy of the license is included in the section entitled "GNU
186 Free Documentation License".
187
188
189
190binutils-2.40.00 2023-07-30 ADDR2LINE(1)