summaryrefslogtreecommitdiffstats
path: root/upstream/debian-unstable/man1/addr2line.1
blob: f8ebb85187d557512a18a4300865c1b51ec08459 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "ADDR2LINE 1"
.TH ADDR2LINE 1 2024-02-21 binutils-2.42 "GNU Development Tools"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
addr2line \- convert addresses or symbol+offset into file names and line numbers
.SH SYNOPSIS
.IX Header "SYNOPSIS"
addr2line [\fB\-a\fR|\fB\-\-addresses\fR]
          [\fB\-b\fR \fIbfdname\fR|\fB\-\-target=\fR\fIbfdname\fR]
          [\fB\-C\fR|\fB\-\-demangle\fR[=\fIstyle\fR]]
          [\fB\-r\fR|\fB\-\-no\-recurse\-limit\fR]
          [\fB\-R\fR|\fB\-\-recurse\-limit\fR]
          [\fB\-e\fR \fIfilename\fR|\fB\-\-exe=\fR\fIfilename\fR]
          [\fB\-f\fR|\fB\-\-functions\fR] [\fB\-s\fR|\fB\-\-basename\fR]
          [\fB\-i\fR|\fB\-\-inlines\fR]
          [\fB\-p\fR|\fB\-\-pretty\-print\fR]
          [\fB\-j\fR|\fB\-\-section=\fR\fIname\fR]
          [\fB\-H\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR]
          [addr addr ...]
.SH DESCRIPTION
.IX Header "DESCRIPTION"
\&\fBaddr2line\fR translates addresses or symbol+offset into file names and line numbers.
Given an address or symbol+offset in an executable or an offset in a section of a relocatable
object, it uses the debugging information to figure out which file name and
line number are associated with it.
.PP
The executable or relocatable object to use is specified with the \fB\-e\fR
option.  The default is the file \fIa.out\fR.  The section in the relocatable
object to use is specified with the \fB\-j\fR option.
.PP
\&\fBaddr2line\fR has two modes of operation.
.PP
In the first, hexadecimal addresses or symbol+offset are specified on the command line,
and \fBaddr2line\fR displays the file name and line number for each
address.
.PP
In the second, \fBaddr2line\fR reads hexadecimal addresses or symbol+offset from
standard input, and prints the file name and line number for each
address on standard output.  In this mode, \fBaddr2line\fR may be used
in a pipe to convert dynamically chosen addresses.
.PP
The format of the output is \fBFILENAME:LINENO\fR.  By default
each input address generates one line of output.
.PP
Two options can generate additional lines before each
\&\fBFILENAME:LINENO\fR line (in that order).
.PP
If the \fB\-a\fR option is used then a line with the input address
is displayed.
.PP
If the \fB\-f\fR option is used, then a line with the
\&\fBFUNCTIONNAME\fR is displayed.  This is the name of the function
containing the address.
.PP
One option can generate additional lines after the
\&\fBFILENAME:LINENO\fR line.
.PP
If the \fB\-i\fR option is used and the code at the given address is
present there because of inlining by the compiler then additional
lines are displayed afterwards.  One or two extra lines (if the
\&\fB\-f\fR option is used) are displayed for each inlined function.
.PP
Alternatively if the \fB\-p\fR option is used then each input
address generates a single, long, output line containing the address,
the function name, the file name and the line number.  If the
\&\fB\-i\fR option has also been used then any inlined functions will
be displayed in the same manner, but on separate lines, and prefixed
by the text \fB(inlined by)\fR.
.PP
If the file name or function name can not be determined,
\&\fBaddr2line\fR will print two question marks in their place.  If the
line number can not be determined, \fBaddr2line\fR will print 0.
.PP
When symbol+offset is used, +offset is optional, except when the symbol
is ambigious with a hex number. The resolved symbols can be mangled
or unmangled, except unmangled symbols with + are not allowed.
.SH OPTIONS
.IX Header "OPTIONS"
The long and short forms of options, shown here as alternatives, are
equivalent.
.IP \fB\-a\fR 4
.IX Item "-a"
.PD 0
.IP \fB\-\-addresses\fR 4
.IX Item "--addresses"
.PD
Display the address before the function name, file and line number
information.  The address is printed with a \fB0x\fR prefix to easily
identify it.
.IP "\fB\-b\fR \fIbfdname\fR" 4
.IX Item "-b bfdname"
.PD 0
.IP \fB\-\-target=\fR\fIbfdname\fR 4
.IX Item "--target=bfdname"
.PD
Specify that the object-code format for the object files is
\&\fIbfdname\fR.
.IP \fB\-C\fR 4
.IX Item "-C"
.PD 0
.IP \fB\-\-demangle[=\fR\fIstyle\fR\fB]\fR 4
.IX Item "--demangle[=style]"
.PD
Decode (\fIdemangle\fR) low-level symbol names into user-level names.
Besides removing any initial underscore prepended by the system, this
makes C++ function names readable.  Different compilers have different
mangling styles. The optional demangling style argument can be used to
choose an appropriate demangling style for your compiler.
.IP "\fB\-e\fR \fIfilename\fR" 4
.IX Item "-e filename"
.PD 0
.IP \fB\-\-exe=\fR\fIfilename\fR 4
.IX Item "--exe=filename"
.PD
Specify the name of the executable for which addresses should be
translated.  The default file is \fIa.out\fR.
.IP \fB\-f\fR 4
.IX Item "-f"
.PD 0
.IP \fB\-\-functions\fR 4
.IX Item "--functions"
.PD
Display function names as well as file and line number information.
.IP \fB\-s\fR 4
.IX Item "-s"
.PD 0
.IP \fB\-\-basenames\fR 4
.IX Item "--basenames"
.PD
Display only the base of each file name.
.IP \fB\-i\fR 4
.IX Item "-i"
.PD 0
.IP \fB\-\-inlines\fR 4
.IX Item "--inlines"
.PD
If the address belongs to a function that was inlined, the source
information for all enclosing scopes back to the first non-inlined
function will also be printed.  For example, if \f(CW\*(C`main\*(C'\fR inlines
\&\f(CW\*(C`callee1\*(C'\fR which inlines \f(CW\*(C`callee2\*(C'\fR, and address is from
\&\f(CW\*(C`callee2\*(C'\fR, the source information for \f(CW\*(C`callee1\*(C'\fR and \f(CW\*(C`main\*(C'\fR
will also be printed.
.IP \fB\-j\fR 4
.IX Item "-j"
.PD 0
.IP \fB\-\-section\fR 4
.IX Item "--section"
.PD
Read offsets relative to the specified section instead of absolute addresses.
.IP \fB\-p\fR 4
.IX Item "-p"
.PD 0
.IP \fB\-\-pretty\-print\fR 4
.IX Item "--pretty-print"
.PD
Make the output more human friendly: each location are printed on one line.
If option \fB\-i\fR is specified, lines for all enclosing scopes are
prefixed with \fB(inlined by)\fR.
.IP \fB\-r\fR 4
.IX Item "-r"
.PD 0
.IP \fB\-R\fR 4
.IX Item "-R"
.IP \fB\-\-recurse\-limit\fR 4
.IX Item "--recurse-limit"
.IP \fB\-\-no\-recurse\-limit\fR 4
.IX Item "--no-recurse-limit"
.IP \fB\-\-recursion\-limit\fR 4
.IX Item "--recursion-limit"
.IP \fB\-\-no\-recursion\-limit\fR 4
.IX Item "--no-recursion-limit"
.PD
Enables or disables a limit on the amount of recursion performed
whilst demangling strings.  Since the name mangling formats allow for
an infinite level of recursion it is possible to create strings whose
decoding will exhaust the amount of stack space available on the host
machine, triggering a memory fault.  The limit tries to prevent this
from happening by restricting recursion to 2048 levels of nesting.
.Sp
The default is for this limit to be enabled, but disabling it may be
necessary in order to demangle truly complicated names.  Note however
that if the recursion limit is disabled then stack exhaustion is
possible and any bug reports about such an event will be rejected.
.Sp
The \fB\-r\fR option is a synonym for the
\&\fB\-\-no\-recurse\-limit\fR option.  The \fB\-R\fR option is a
synonym for the \fB\-\-recurse\-limit\fR option.
.Sp
Note this option is only effective if the \fB\-C\fR or
\&\fB\-\-demangle\fR option has been enabled.
.IP \fB@\fR\fIfile\fR 4
.IX Item "@file"
Read command-line options from \fIfile\fR.  The options read are
inserted in place of the original @\fIfile\fR option.  If \fIfile\fR
does not exist, or cannot be read, then the option will be treated
literally, and not removed.
.Sp
Options in \fIfile\fR are separated by whitespace.  A whitespace
character may be included in an option by surrounding the entire
option in either single or double quotes.  Any character (including a
backslash) may be included by prefixing the character to be included
with a backslash.  The \fIfile\fR may itself contain additional
@\fIfile\fR options; any such options will be processed recursively.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Info entries for \fIbinutils\fR.
.SH COPYRIGHT
.IX Header "COPYRIGHT"
Copyright (c) 1991\-2024 Free Software Foundation, Inc.
.PP
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts.  A copy of the license is included in the
section entitled "GNU Free Documentation License".