$linuxjunkies
>

lldb(1)

LLDB is a next-generation debugger that debugs programs, attaches to running processes, and inspects core dumps.

UbuntuDebianFedoraArch

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

FlagWhat 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
-xExit 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
--helpDisplay help message and exit

Examples

Launch and debug the executable 'myprogram'; drops into the (lldb) prompt for interactive debugging

lldb ./myprogram

Attach LLDB to the running process with PID 1234

lldb -p 1234

Analyze a core dump file from a crashed program

lldb -c ./core.dump ./myprogram

Run 'myprogram' with arguments, execute commands from 'breakpoints.lldb', then exit

lldb -s breakpoints.lldb -x ./myprogram arg1 arg2

Set a breakpoint at main and run the program immediately

lldb -o 'b main' -o 'run' ./myprogram

Attach LLDB to the running process named 'firefox'

lldb -n firefox

Related commands