LLDB(1)
π LLDB π
ok so like. bestie. you're about to meet lldb, aka the manual page for LLDB (that's the LLDB(1) situation, yes, we're doing this) and honestly? this is gonna be a whole journey. grab a snack. π
β¨ NAME β¨
lldb β LLDB Documentation
β¨ SYNOPSIS β¨
lldb [options] executable
πΈ DESCRIPTION πΈ
okay so lldb is a next generation, high-performance debugger and it is genuinely iconic. it's built as a set of reusable components that highly leverage existing libraries in the larger LLVM Project β like the Clang expression parser and the LLVM disassembler. slay, honestly. reuse is main character energy. π
lldb is the default debugger in Xcode on macOS, and it supports debugging C, Objective-C and C++ on the desktop and iOS devices and simulator. no cap, it does all of that. π¦
All of the code in the LLDB project is available under the Apache 2.0 License with LLVM exceptions. periodt.
π ATTACHING π
like, sometimes you don't wanna launch a thing, you wanna just. join the party that's already happening. that's this section. π
--attach-name <name>β tells the debugger to attach to a process with the given name.--attach-pid <pid>β tells the debugger to attach to a process with the given pid.-n <value>β alias for--attach-name-p <value>β alias for--attach-pid--wait-forβ tells the debugger to wait for a process with the given pid or name to launch before attaching. like, it'll literally just stand there. patiently. π«Ά-wβ alias for--wait-for
π¦ COMMANDS π¦
--batchβ tells the debugger to run the commands from-s,-S,-o&-O, and then quit.-bβ alias for--batch-K <value>β alias for--source-on-crash-k <value>β alias for--one-line-on-crash--local-lldbinitβ allow the debugger to parse the.lldbinitfiles in the current working directory, unless--no-lldbinitis passed. (permission granted, but only if nobody vetoes it π)--no-lldbinitβ do not automatically parse any'.lldbinit'files.--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.--one-line-on-crash <command>β when in batch mode, tells the debugger to run this one-line lldb command if the target crashes. π--one-line <command>β tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.-O <value>β alias for--one-line-before-file-o <value>β alias for--one-line-Qβ alias for--source-quietly--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.--source-on-crash <file>β when in batch mode, tells the debugger to source this file of lldb commands if the target crashes.--source-quietlyβ tells the debugger not to echo commands while sourcing files or one-line commands provided on the command line. shhh. π€«--source <file>β tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.-S <value>β alias for--source-before-file-s <value>β alias for--source-xβ alias for--no-lldbinit
π₯ OPTIONS π₯
--arch <architecture>β tells the debugger to use the specified architecture when starting and running the program.-a <value>β alias for--arch--capture-path <filename>β tells the debugger to use the given filename for the reproducer.--captureβ tells the debugger to capture a reproducer.--core <filename>β tells the debugger to use the full path to <filename> as the core file.-c <value>β alias for--core--debugβ tells the debugger to print out extra information for debugging itself. debugception, lowkey. π-dβ alias for--debug--editorβ tells the debugger to open source files using the host's "external editor" mechanism.-eβ alias for--editor--file <filename>β tells the debugger to use the file <filename> as the program to be debugged.-f <value>β alias for--file--helpβ prints out the usage information for the LLDB debugger.-hβ alias for--help--no-use-colorsβ do not use colors. (sad but valid π)--replay <filename>β tells the debugger to replay a reproducer from <filename>.--versionβ prints out the current version number of the LLDB debugger.-vβ alias for--version-Xβ alias for--no-use-color
π REPL π
-r=<flags>β alias for--repl=<flags>--repl-language <language>β chooses the language for the REPL.--repl=<flags>β runs lldb in REPL mode with a stub process with the given flags.-R <value>β alias for--repl-language
π SCRIPTING π
-l <value>β alias for--script-language--print-script-interpreter-infoβ prints out a json dictionary with information about the scripting language interpreter.--python-pathβ prints out the path to thelldb.pyfile for this version of lldb.-Pβ alias for--python-path--script-language <language>β tells the debugger to use the specified scripting language for user-defined scripts.
β EXAMPLES β
The debugger can be started in several modes. pick your fighter, bestie. π
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 --.
lldb --arch x86_64 /path/to/program program argument -- --arch armv7
For convenience, passing the executable after -- is also supported.
lldb --arch x86_64 -- /path/to/program program argument --arch armv7
Passing one of the attach options causes lldb to immediately attach to the given process.
lldb -p <pid> lldb -n <process-name>
Passing --repl starts lldb in REPL mode.
lldb -r
Passing --core causes lldb to debug the core file.
lldb -c /path/to/core
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.
lldb -O 'settings set stop-disassembly-count 20' -o 'run' -o 'bt'
lldb -S /source/before/file -s /source/after/file lldb -K
/source/before/crash -k /source/after/crash
Note: In REPL mode no file is loaded, so commands specified to run after loading the file (via-oor-s) will be ignored. π sucks but true.
π§ 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". it's giving built-in tutorial and we love that for us. β¨
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. search bar energy. iykyk. π
π 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'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.
β οΈ that "for security reasons" bit is not a vibe, it's a real warning β default is don't source it, and it warns you. respect the caveat bestie. π
To always load the .lldbinit file in the current working directory, add the following command to ~/.lldbinit:
settings set target.load-cwd-lldbinit true
To never load the .lldbinit file in the current working directory and silence the warning, add the following command to ~/.lldbinit:
settings set target.load-cwd-lldbinit false
π¦ 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. (gdb girlies, this one's for you π«Ά)
π Author
LLVM project
π Copyright
2007-2026, The LLDB Team
okay that's the whole thing, go debug something iconic bestie. πβ¨ππ¦πΈπ π«Άπ₯ππβπππ§
and for the sign-off credits moment: this masterpiece is page23, datedOct 20, 2026, from source/versionLLDB(1). slay. π
π¦ where this page comes from
- arch rolling: lldb 23.1.4-1 Β· Apache-2.0 WITH LLVM-exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms