lldb: Usage, Options & Common CI Errors
lldb is LLVM’s debugger, the default on macOS and a peer to gdb on Linux.
lldb is the debugger paired with clang and the standard one on macOS CI. Driven in batch mode it symbolizes crashes and core dumps; the platform-specific snags are macOS developer-mode prompts and Linux ptrace permissions.
What it does
lldb is the LLVM project debugger. Like gdb it runs programs under control, sets breakpoints, inspects state, and prints backtraces from live processes or core dumps. It uses its own command syntax (run, bt, thread backtrace all).
Common usage
lldb --batch -o run -o bt -- ./app arg1
lldb --batch -o bt -c core ./app # core dump
lldb --batch -o 'thread backtrace all' -c core ./app
lldb -p <pid> --batch -o bt
lldb -o 'target create ./app' -o runOptions
| Flag | What it does |
|---|---|
| --batch | Run -o commands then exit |
| -o <cmd> | Execute an lldb command |
| -- <prog> <args> | Program and its arguments |
| -c <core> | Load a core dump |
| -p <pid> | Attach to a process |
Common errors in CI
On macOS CI: "error: process launch failed: Operation not permitted" or a developer-mode prompt - run DevToolsSecurity -enable (needs sudo on the runner) so lldb can attach. On Linux: the same ptrace restriction as gdb ("Operation not permitted") needs SYS_PTRACE / ptrace_scope=0. "error: ‘bt’ is not a valid command" if you mix gdb syntax - lldb uses thread backtrace (bt is an alias but argument forms differ). Build with -g and avoid stripping for usable frames.