LLDB(1)

πŸ“¦
version 13.0.1 Β· 3 versions
, in ubuntu jammy

πŸ¦‹ NAME πŸ¦‹

lldb β€” manual page for lldb 13. That's her, that's the whole intro, she's living in the User Commands part of the manual and she's on version 13. Periodt. πŸ’…


✨ DESCRIPTION ✨

OVERVIEW: LLDB

USAGE:

lldb [options]

Okay so bestie, this is the debugger. She has so many options and she wants you to know all of them, so let's go, no skipping, we're reading the whole menu. πŸ“

πŸ’– ATTACHING:

Attaching is when you don't launch a program, you just slide into one that's already running. Main character energy, honestly.

  • --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. She's patient, she'll wait. 🫢
  • -w β€” alias for --wait-for

πŸŽ€ COMMANDS:

This is the "what should I run and when" section, and honestly it's giving choreography.

  • --batch β€” tells the debugger to run the commands from -s, -S, -o & -O, and then quit. In, out, done, no lingering.
  • -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. Hands off, she's not reading your config.
  • --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. πŸ’€ (affectionate)
  • --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 to execute this one-line lldb command before any file has been loaded.
  • --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 big one. Forty-ish little guys. Grab a snack, we're going through every single one, because none of them are getting left behind on my watch. πŸ‘‘

  • --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. Monochrome era. πŸ–€)
  • --replay <filename> β€” tells the debugger to replay a reproducer from <filename>.
  • --reproducer-generate-on-exit β€” generate reproducer on exit.
  • --reproducer-no-generate-on-signal β€” don't generate reproducer when a signal is received.
  • --reproducer-no-verify β€” disable the reproducer verification.
  • --reproducer-no-version-check β€” disable the reproducer version check.
  • --version β€” prints out the current version number of the LLDB debugger.
  • -v β€” alias for --version
  • -X β€” alias for --no-use-color
Heads up bestie, that last alias really is spelled --no-use-color in the original, no trailing s. Not me fixing it, that's just how she is. πŸ™ˆ

πŸ’œ REPL:

Read-eval-print loop hours. Type stuff, get answers, feel powerful. ✨

  • -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.
  • --repl β€” runs lldb in REPL mode with a stub process.
  • -R <value> β€” alias for --repl-language
  • -r β€” alias for --repl

🧚 SCRIPTING:

For when you want to script the debugger itself. Very coder of you.

  • -l <value> β€” alias for --script-language
  • --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. (Iconic of her.)

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.

Okay that's literally the entire page, you read all of it, I'm so proud of you. πŸ₯ΉπŸ’– This was lldb 13, dated July 2023 β€” that's the footer, bestie, and now you know the whole thing top to bottom. Go debug something. Slay. πŸŽ€

πŸ“¦ where this page comes from