aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/clang/lldb/lldb.1
blob: d3a85ff554e2ce6a60d819d3e5839dc5f7879a54 (plain) (blame)
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
.\" $FreeBSD$
.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "LLDB" "1" "2021-06-07" "12" "LLDB"
.SH NAME
lldb \- LLDB Documentation
.SH SYNOPSIS
.nf
\fBlldb\fP [\fIoptions\fP] \fIexecutable\fP
.fi
.sp
.SH DESCRIPTION
.sp
\fBlldb\fP is a next generation, high\-performance debugger. It is built as
a set of reusable components which highly leverage existing libraries in the
larger LLVM Project, such as the Clang expression parser and LLVM disassembler.
.sp
\fBlldb\fP is the default debugger in Xcode on macOS and supports
debugging C, Objective\-C and C++ on the desktop and iOS devices and simulator.
.sp
All of the code in the LLDB project is available under the Apache 2.0 License
with LLVM exceptions.
.SH ATTACHING
.INDENT 0.0
.TP
.B \-\-attach\-name <name>
Tells the debugger to attach to a process with the given name.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-attach\-pid <pid>
Tells the debugger to attach to a process with the given pid.
.UNINDENT
.INDENT 0.0
.TP
.B \-n <value>
Alias for \-\-attach\-name
.UNINDENT
.INDENT 0.0
.TP
.B \-p <value>
Alias for \-\-attach\-pid
.UNINDENT
.INDENT 0.0
.TP
.B \-\-wait\-for
Tells the debugger to wait for a process with the given pid or name to launch before attaching.
.UNINDENT
.INDENT 0.0
.TP
.B \-w
Alias for \-\-wait\-for
.UNINDENT
.SH COMMANDS
.INDENT 0.0
.TP
.B \-\-batch
Tells the debugger to run the commands from \-s, \-S, \-o & \-O, and then quit.
.UNINDENT
.INDENT 0.0
.TP
.B \-b
Alias for \-\-batch
.UNINDENT
.INDENT 0.0
.TP
.B \-K <value>
Alias for \-\-source\-on\-crash
.UNINDENT
.INDENT 0.0
.TP
.B \-k <value>
Alias for \-\-one\-line\-on\-crash
.UNINDENT
.INDENT 0.0
.TP
.B \-\-local\-lldbinit
Allow the debugger to parse the .lldbinit files in the current working directory, unless \-\-no\-lldbinit is passed.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-no\-lldbinit
Do not automatically parse any \(aq.lldbinit\(aq files.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-one\-line\-before\-file <command>
Tells the debugger to execute this one\-line lldb command before any file provided on the command line has been loaded.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-one\-line\-on\-crash <command>
When in batch mode, tells the debugger to run this one\-line lldb command if the target crashes.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-one\-line <command>
Tells the debugger to execute this one\-line lldb command after any file provided on the command line has been loaded.
.UNINDENT
.INDENT 0.0
.TP
.B \-O <value>
Alias for \-\-one\-line\-before\-file
.UNINDENT
.INDENT 0.0
.TP
.B \-o <value>
Alias for \-\-one\-line
.UNINDENT
.INDENT 0.0
.TP
.B \-Q
Alias for \-\-source\-quietly
.UNINDENT
.INDENT 0.0
.TP
.B \-\-source\-before\-file <file>
Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-source\-on\-crash <file>
When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-source\-quietly
Tells the debugger to execute this one\-line lldb command before any file has been loaded.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-source <file>
Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.
.UNINDENT
.INDENT 0.0
.TP
.B \-S <value>
Alias for \-\-source\-before\-file
.UNINDENT
.INDENT 0.0
.TP
.B \-s <value>
Alias for \-\-source
.UNINDENT
.INDENT 0.0
.TP
.B \-x
Alias for \-\-no\-lldbinit
.UNINDENT
.SH OPTIONS
.INDENT 0.0
.TP
.B \-\-arch <architecture>
Tells the debugger to use the specified architecture when starting and running the program.
.UNINDENT
.INDENT 0.0
.TP
.B \-a <value>
Alias for \-\-arch
.UNINDENT
.INDENT 0.0
.TP
.B \-\-capture\-path <filename>
Tells the debugger to use the given filename for the reproducer.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-capture
Tells the debugger to capture a reproducer.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-core <filename>
Tells the debugger to use the full path to <filename> as the core file.
.UNINDENT
.INDENT 0.0
.TP
.B \-c <value>
Alias for \-\-core
.UNINDENT
.INDENT 0.0
.TP
.B \-\-debug
Tells the debugger to print out extra information for debugging itself.
.UNINDENT
.INDENT 0.0
.TP
.B \-d
Alias for \-\-debug
.UNINDENT
.INDENT 0.0
.TP
.B \-\-editor
Tells the debugger to open source files using the host\(aqs "external editor" mechanism.
.UNINDENT
.INDENT 0.0
.TP
.B \-e
Alias for \-\-editor
.UNINDENT
.INDENT 0.0
.TP
.B \-\-file <filename>
Tells the debugger to use the file <filename> as the program to be debugged.
.UNINDENT
.INDENT 0.0
.TP
.B \-f <value>
Alias for \-\-file
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
Prints out the usage information for the LLDB debugger.
.UNINDENT
.INDENT 0.0
.TP
.B \-h
Alias for \-\-help
.UNINDENT
.INDENT 0.0
.TP
.B \-\-no\-use\-colors
Do not use colors.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-replay <filename>
Tells the debugger to replay a reproducer from <filename>.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
Prints out the current version number of the LLDB debugger.
.UNINDENT
.INDENT 0.0
.TP
.B \-v
Alias for \-\-version
.UNINDENT
.INDENT 0.0
.TP
.B \-X
Alias for \-\-no\-use\-color
.UNINDENT
.SH REPL
.INDENT 0.0
.TP
.B \-r=<flags>
Alias for \-\-repl=<flags>
.UNINDENT
.INDENT 0.0
.TP
.B \-\-repl\-language <language>
Chooses the language for the REPL.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-repl=<flags>
Runs lldb in REPL mode with a stub process with the given flags.
.UNINDENT
.INDENT 0.0
.TP
.B \-R <value>
Alias for \-\-repl\-language
.UNINDENT
.SH SCRIPTING
.INDENT 0.0
.TP
.B \-l <value>
Alias for \-\-script\-language
.UNINDENT
.INDENT 0.0
.TP
.B \-\-python\-path
Prints out the path to the lldb.py file for this version of lldb.
.UNINDENT
.INDENT 0.0
.TP
.B \-P
Alias for \-\-python\-path
.UNINDENT
.INDENT 0.0
.TP
.B \-\-script\-language <language>
Tells the debugger to use the specified scripting language for user\-defined scripts.
.UNINDENT
.SH EXAMPLES
.sp
The debugger can be started in several modes.
.sp
Passing an executable as a positional argument prepares lldb to debug the given
executable. To disambiguate between arguments passed to lldb and arguments
passed to the debugged executable, arguments starting with a \- must be passed
after \-\-.
.INDENT 0.0
.INDENT 3.5
lldb \-\-arch x86_64 /path/to/program program argument \-\- \-\-arch arvm7
.UNINDENT
.UNINDENT
.sp
For convenience, passing the executable after \-\- is also supported.
.INDENT 0.0
.INDENT 3.5
lldb \-\-arch x86_64 \-\- /path/to/program program argument \-\-arch arvm7
.UNINDENT
.UNINDENT
.sp
Passing one of the attach options causes \fBlldb\fP to immediately attach
to the given process.
.INDENT 0.0
.INDENT 3.5
lldb \-p <pid>
lldb \-n <process\-name>
.UNINDENT
.UNINDENT
.sp
Passing \-\-repl starts \fBlldb\fP in REPL mode.
.INDENT 0.0
.INDENT 3.5
lldb \-r
.UNINDENT
.UNINDENT
.sp
Passing \-\-core causes \fBlldb\fP to debug the core file.
.INDENT 0.0
.INDENT 3.5
lldb \-c /path/to/core
.UNINDENT
.UNINDENT
.sp
Command options can be combined with these modes and cause \fBlldb\fP to
run the specified commands before or after events, like loading the file or
crashing, in the order provided on the command line.
.INDENT 0.0
.INDENT 3.5
lldb \-O \(aqsettings set stop\-disassembly\-count 20\(aq \-o \(aqrun\(aq \-o \(aqbt\(aq
lldb \-S /source/before/file \-s /source/after/file
lldb \-K /source/before/crash \-k /source/after/crash
.UNINDENT
.UNINDENT
.sp
Note: In REPL mode no file is loaded, so commands specified to run after
loading the file (via \-o or \-s) will be ignored.
.SH USING LLDB
.sp
In \fBlldb\fP there is a help command which can be used to find
descriptions and examples of all \fBlldb\fP commands.  To get help on
"breakpoint set" you would type "help breakpoint set".
.sp
There is also an apropos command which will search the help text of all
commands for a given term ‐‐ this is useful for locating a command by topic.
For instance, "apropos breakpoint" will list any command that has the word
"breakpoint" in its help text.
.SH CONFIGURATION FILES
.sp
\fBlldb\fP reads things like settings, aliases and commands from the
\&.lldbinit file.
.sp
First, \fBlldb\fP will try to read the application specific init file
whose name is ~/.lldbinit followed by a "\-" and the name of the current
program. This would be ~/.lldbinit\-lldb for the command line \fBlldb\fP
and ~/.lldbinit\-Xcode for Xcode. If there is no application specific init
file, \fBlldb\fP will look for an init file in the home directory.
If launched with a \fI\%REPL\fP option, it will first look for a REPL configuration
file, specific to the REPL language. The init file should be named as follow:
\fB\&.lldbinit\-<language>\-repl\fP (i.e. \fB\&.lldbinit\-swift\-repl\fP). If this file doesn\(aqt
exist, or \fBlldb\fP wasn\(aqt launch with \fI\%REPL\fP, meaning there is neither
a REPL init file nor an application specific init file, \fBlldb\fP will fallback to
the global ~/.lldbinit.
.sp
Secondly, it will look for an .lldbinit file in the current working directory.
For security reasons, \fBlldb\fP will print a warning and not source this
file by default. This behavior can be changed by changing the
target.load\-cwd\-lldbinit setting.
.sp
To always load the .lldbinit file in the current working directory, add the
following command to ~/.lldbinit:
.INDENT 0.0
.INDENT 3.5
settings set target.load\-cwd\-lldbinit true
.UNINDENT
.UNINDENT
.sp
To never load the .lldbinit file in the current working directory and silence
the warning, add the following command to ~/.lldbinit:
.INDENT 0.0
.INDENT 3.5
settings set target.load\-cwd\-lldbinit false
.UNINDENT
.UNINDENT
.SH SEE ALSO
.sp
The LLDB project page \fI\%https://lldb.llvm.org\fP has many different resources
for \fBlldb\fP users ‐‐ the gdb/lldb command equivalence page
\fI\%https://lldb.llvm.org/use/map.html\fP can be especially helpful for users
coming from gdb.
.SH AUTHOR
LLVM project
.SH COPYRIGHT
2007-2021, The LLDB Team
.\" Generated by docutils manpage writer.
.