LLDB(1) | LLDB | LLDB(1) |
lldb - LLDB Documentation
lldb [options] executable
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 Swift, 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.
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 --.
For convenience, passing the executable after -- is also supported.
Passing one of the attach options causes lldb to immediately attach to the given process.
Passing --repl starts lldb in REPL mode.
Passing --core causes lldb to debug the core file.
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.
Note: In REPL mode no file is loaded, so commands specified to run after loading the file (via -o or -s) will be ignored.
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.
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't exist, or lldb wasn't 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:
To never load the .lldbinit file in the current working directory and silence the warning, add the following command to ~/.lldbinit:
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.
LLVM project
2007-2025, The LLDB Team
June 26, 2025 | 1703 |