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