LLDB(1)

πŸ’– LLDB(1) πŸ’–

okay bestie, welcome to the lldb manual page β€” like, the actual LLDB(1) page, but make it cute. everything's here, nothing's missing, and yes we're doing this in group-chat voice because you deserve it. 🫢


✨ NAME ✨

lldb β€” LLDB Documentation. that's it, that's the name. short, iconic, slays. πŸ‘‘


🌈 SYNOPSIS 🌈

lldb [options] executable

πŸ’… DESCRIPTION πŸ’…

lldb is a next generation, high-performance debugger. periodt. it's built as a set of reusable components which highly leverage existing libraries in the larger LLVM Project β€” think the Clang expression parser and the LLVM disassembler. it's giving "standing on the shoulders of giants" energy. πŸ”₯

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. main character behaviour honestly. πŸ“±

all of the code in the LLDB project is available under the Apache 2.0 License with LLVM exceptions. legal but make it fashion. βš–οΈ


🫢 ATTACHING 🫢

want lldb to just, like, grab a running process? these are your girlies.

  • --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. patience is a virtue bestie. ⏳
  • -w β€” alias for --wait-for

πŸŽ€ COMMANDS πŸŽ€

the "run these things at these moments" section. lowkey the most powerful part of the whole page ngl.

  • --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 .lldbinit files in the current working directory, unless --no-lldbinit is passed.
  • --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. πŸ’€ (literally)
  • --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. no yapping mode. 🀫
  • --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 ⭐

the whole menu, every single item, no skips. πŸ“

  • --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. πŸŒ€
  • -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 🧚

for when you want to make lldb do your custom bidding. iykyk. ✨

  • -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 the lldb.py file 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. let's go mode by mode 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 -o or -s) will be ignored. 😭 that's just how it is, don't fight it.

πŸ’œ 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. it's giving "google but for your debugger". πŸ”


🌸 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.

πŸ”₯ security girlies, listen up: that cwd .lldbinit is not sourced by default. don't @ me, that's just the rules.

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. if you're a gdb refugee, that second link is your safe space. πŸ«‚


πŸŽ€ AUTHOR πŸŽ€

LLVM project


2007-2025, The LLDB Team


okay that's the whole page, nothing skipped, every flag accounted for, we ate and left no crumbs. πŸ’… and a lil shoutout to the footer bestie at the very bottom: this manual is stamped LLDB(1), dated Sep 03, 2025, and carries the number 20. slay, go debug something. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from