xref: /freebsd/usr.bin/clang/lldb/lldb.1 (revision d7d962ead0b6e5e8a39202d0590022082bf5bfb6)
$FreeBSD$
Man page generated from reStructuredText.
. . .nr rst2man-indent-level 0 . \\$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] .. .rstReportMargin pre:
. RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .rstReportMargin post:
.. . 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]]
..
"LLDB" "1" "2021-06-07" "12" "LLDB"
NAME
lldb - LLDB Documentation
SYNOPSIS
lldb [options] executable
DESCRIPTION
lldb 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. lldb is the default debugger in Xcode on macOS and supports debugging C, Objective-C and C++ on the desktop and iOS devices and simulator. All of the code in the LLDB project is available under the Apache 2.0 License with LLVM exceptions.
ATTACHING
NDENT 0.0

--attach-name <name> Tells the debugger to attach to a process with the given name. NINDENT NDENT 0.0

--attach-pid <pid> Tells the debugger to attach to a process with the given pid. NINDENT NDENT 0.0

-n <value> Alias for --attach-name NINDENT NDENT 0.0

-p <value> Alias for --attach-pid NINDENT NDENT 0.0

--wait-for Tells the debugger to wait for a process with the given pid or name to launch before attaching. NINDENT NDENT 0.0

-w Alias for --wait-for NINDENT

COMMANDS
NDENT 0.0

--batch Tells the debugger to run the commands from -s, -S, -o & -O, and then quit. NINDENT NDENT 0.0

-b Alias for --batch NINDENT NDENT 0.0

-K <value> Alias for --source-on-crash NINDENT NDENT 0.0

-k <value> Alias for --one-line-on-crash NINDENT NDENT 0.0

--local-lldbinit Allow the debugger to parse the .lldbinit files in the current working directory, unless --no-lldbinit is passed. NINDENT NDENT 0.0

--no-lldbinit Do not automatically parse any \(aq.lldbinit\(aq files. NINDENT NDENT 0.0

--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. NINDENT NDENT 0.0

--one-line-on-crash <command> When in batch mode, tells the debugger to run this one-line lldb command if the target crashes. NINDENT NDENT 0.0

--one-line <command> Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded. NINDENT NDENT 0.0

-O <value> Alias for --one-line-before-file NINDENT NDENT 0.0

-o <value> Alias for --one-line NINDENT NDENT 0.0

-Q Alias for --source-quietly NINDENT NDENT 0.0

--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. NINDENT NDENT 0.0

--source-on-crash <file> When in batch mode, tells the debugger to source this file of lldb commands if the target crashes. NINDENT NDENT 0.0

--source-quietly Tells the debugger to execute this one-line lldb command before any file has been loaded. NINDENT NDENT 0.0

--source <file> Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded. NINDENT NDENT 0.0

-S <value> Alias for --source-before-file NINDENT NDENT 0.0

-s <value> Alias for --source NINDENT NDENT 0.0

-x Alias for --no-lldbinit NINDENT

OPTIONS
NDENT 0.0

--arch <architecture> Tells the debugger to use the specified architecture when starting and running the program. NINDENT NDENT 0.0

-a <value> Alias for --arch NINDENT NDENT 0.0

--capture-path <filename> Tells the debugger to use the given filename for the reproducer. NINDENT NDENT 0.0

--capture Tells the debugger to capture a reproducer. NINDENT NDENT 0.0

--core <filename> Tells the debugger to use the full path to <filename> as the core file. NINDENT NDENT 0.0

-c <value> Alias for --core NINDENT NDENT 0.0

--debug Tells the debugger to print out extra information for debugging itself. NINDENT NDENT 0.0

-d Alias for --debug NINDENT NDENT 0.0

--editor Tells the debugger to open source files using the host\(aqs "external editor" mechanism. NINDENT NDENT 0.0

-e Alias for --editor NINDENT NDENT 0.0

--file <filename> Tells the debugger to use the file <filename> as the program to be debugged. NINDENT NDENT 0.0

-f <value> Alias for --file NINDENT NDENT 0.0

--help Prints out the usage information for the LLDB debugger. NINDENT NDENT 0.0

-h Alias for --help NINDENT NDENT 0.0

--no-use-colors Do not use colors. NINDENT NDENT 0.0

--replay <filename> Tells the debugger to replay a reproducer from <filename>. NINDENT NDENT 0.0

--version Prints out the current version number of the LLDB debugger. NINDENT NDENT 0.0

-v Alias for --version NINDENT NDENT 0.0

-X Alias for --no-use-color NINDENT

REPL
NDENT 0.0

-r=<flags> Alias for --repl=<flags> NINDENT NDENT 0.0

--repl-language <language> Chooses the language for the REPL. NINDENT NDENT 0.0

--repl=<flags> Runs lldb in REPL mode with a stub process with the given flags. NINDENT NDENT 0.0

-R <value> Alias for --repl-language NINDENT

SCRIPTING
NDENT 0.0

-l <value> Alias for --script-language NINDENT NDENT 0.0

--python-path Prints out the path to the lldb.py file for this version of lldb. NINDENT NDENT 0.0

-P Alias for --python-path NINDENT NDENT 0.0

--script-language <language> Tells the debugger to use the specified scripting language for user-defined scripts. NINDENT

EXAMPLES
The debugger can be started in several modes. 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 --. NDENT 0.0 NDENT 3.5 lldb --arch x86_64 /path/to/program program argument -- --arch arvm7 NINDENT NINDENT For convenience, passing the executable after -- is also supported. NDENT 0.0 NDENT 3.5 lldb --arch x86_64 -- /path/to/program program argument --arch arvm7 NINDENT NINDENT Passing one of the attach options causes lldb to immediately attach to the given process. NDENT 0.0 NDENT 3.5 lldb -p <pid> lldb -n <process-name> NINDENT NINDENT Passing --repl starts lldb in REPL mode. NDENT 0.0 NDENT 3.5 lldb -r NINDENT NINDENT Passing --core causes lldb to debug the core file. NDENT 0.0 NDENT 3.5 lldb -c /path/to/core NINDENT NINDENT Command options can be combined with these modes and cause lldb to run the specified commands before or after events, like loading the file or crashing, in the order provided on the command line. NDENT 0.0 NDENT 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 NINDENT NINDENT Note: In REPL mode no file is loaded, so commands specified to run after loading the file (via -o or -s) will be ignored.
USING LLDB
In lldb there is a help command which can be used to find descriptions and examples of all lldb commands. To get help on "breakpoint set" you would type "help breakpoint set". 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.
CONFIGURATION FILES
lldb reads things like settings, aliases and commands from the .lldbinit file. First, lldb 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 lldb and ~/.lldbinit-Xcode for Xcode. If there is no application specific init file, lldb will look for an init file in the home directory. If launched with a \%REPL option, it will first look for a REPL configuration file, specific to the REPL language. The init file should be named as follow: .lldbinit-<language>-repl (i.e. .lldbinit-swift-repl). If this file doesn\(aqt exist, or lldb wasn\(aqt launch with \%REPL, meaning there is neither a REPL init file nor an application specific init file, lldb will fallback to the global ~/.lldbinit. Secondly, it will look for an .lldbinit file in the current working directory. For security reasons, lldb will print a warning and not source this file by default. This behavior can be changed by changing the target.load-cwd-lldbinit setting. To always load the .lldbinit file in the current working directory, add the following command to ~/.lldbinit: NDENT 0.0 NDENT 3.5 settings set target.load-cwd-lldbinit true NINDENT NINDENT To never load the .lldbinit file in the current working directory and silence the warning, add the following command to ~/.lldbinit: NDENT 0.0 NDENT 3.5 settings set target.load-cwd-lldbinit false NINDENT NINDENT
SEE ALSO
The LLDB project page \%https://lldb.llvm.org has many different resources for lldb users ‐‐ the gdb/lldb command equivalence page \%https://lldb.llvm.org/use/map.html can be especially helpful for users coming from gdb.
AUTHOR
LLVM project
COPYRIGHT
2007-2021, The LLDB Team Generated by docutils manpage writer.
.