LLDB(1)

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

πŸ’– LLDB β€” the manual page for lldb (version 15, bestie) πŸ’–

okay so you opened the manual for LLDB and honestly? iconic choice. this is the User Commands girlie of the Unix world and she has a LOT to say. let's get into it 🫢


✨ NAME ✨

lldb β€” manual page for lldb 15


🌸 DESCRIPTION 🌸

OVERVIEW: LLDB

USAGE: lldb [options]

like... that's the whole vibe. now let's break down literally every flag because there are SO many and they're all kind of important ngl.


πŸŽ€ ATTACHING:

this section is for when you wanna slide into a process's DMs that's already running πŸ‘€

  • --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. patient queen energy ⏳
  • -w β€” alias for --wait-for

πŸ’… COMMANDS:

the "run these things for me" section. this is where the girlies script their whole session before they even sit down.

  • --batch β€” tells the debugger to run the commands from -s, -S, -o & -O, and then quit. no lingering, no small talk, she's out ✌️
  • -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 πŸ’€
  • --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. 🀫
  • --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 main character list, fr fr. every single one, 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 🎨🚫)
  • --reproducer-generate-on-exit β€” generate reproducer on exit.
  • --version β€” prints out the current version number of the LLDB debugger.
  • -v β€” alias for --version
  • -X β€” alias for --no-use-color πŸ‘€ (yep, exactly as written, no "s" β€” we don't make the rules)

πŸ¦‹ REPL:

read-eval-print-loop mode!! the interactive little hangout spot.

  • -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 the girlies who want to script the debugger itself. main character customization ✨

  • -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 language for user-defined scripts.

🌈 EXAMPLES:

the debugger can be started in several modes. let's go mode by mode, bestie:

mode one β€” positional executable. 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

mode two β€” attach. passing one of the attach options causes lldb to immediately attach to the given process.

lldb -p <pid>
lldb -n <process-name>

mode three β€” repl. passing --repl starts lldb in REPL mode.

lldb -r

mode four β€” core. 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. 😭 tragic but true.

and that's the whole page, no cap πŸ’– she's a lldb 15 girlie from July 2023, and this whole manual page is signed LLDB(1) β€” go forth and debug, bestie, you got this πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from