lldb(1)
LLDB is a next-generation debugger that debugs programs, attaches to running processes, and inspects core dumps.
Synopsis
lldb [OPTIONS] [PROGRAM] [ARGS...]Description
LLDB (Low Level Debugger) is a modern debugger built on top of LLVM/Clang libraries. It provides debugging capabilities for C, C++, Objective-C, and Swift programs on Linux, macOS, and other platforms. LLDB can launch programs, attach to running processes, inspect memory, set breakpoints, and step through code.
LLDB uses a command-line interface similar to GDB but with improved performance and architecture. It supports Python scripting for automation and customization of debugging workflows.
Common options
| Flag | What it does |
|---|---|
-f <file> | Specify the executable file to debug |
-c <file> | Debug a core dump from the specified file |
-p <pid> | Attach to the process with the given process ID |
-n <name> | Attach to the process with the given name |
-x | Exit LLDB after running the command file (use with -s) |
-s <file> | Execute LLDB commands from the specified file at startup |
-o <command> | Execute a single LLDB command and continue |
--help | Display help message and exit |
Examples
Launch and debug the executable 'myprogram'; drops into the (lldb) prompt for interactive debugging
lldb ./myprogramAttach LLDB to the running process with PID 1234
lldb -p 1234Analyze a core dump file from a crashed program
lldb -c ./core.dump ./myprogramRun 'myprogram' with arguments, execute commands from 'breakpoints.lldb', then exit
lldb -s breakpoints.lldb -x ./myprogram arg1 arg2Set a breakpoint at main and run the program immediately
lldb -o 'b main' -o 'run' ./myprogramAttach LLDB to the running process named 'firefox'
lldb -n firefox