LLDB is the debugger of the LLVM project, designed as a next-generation, high-performance counterpart to GDB. Its defining idea, as the project’s documentation states, is that it is built as a set of reusable components which highly leverage existing libraries in the larger LLVM Project. Rather than reimplementing the machinery a debugger needs, LLDB borrows it directly from the compiler infrastructure it sits alongside.
The most consequential piece of reuse is the expression evaluator. LLDB uses the Clang expression parser and the LLVM disassembler, and it converts a program’s debug information into Clang types. Because Clang is a complete, current C, C++, Objective-C, and Objective-C++ front end, LLDB can parse and evaluate expressions involving the very latest language features without having to maintain its own parser. When a developer types an expression at the LLDB prompt, that expression is compiled the same way the program itself was compiled, which keeps the debugger in step with the languages it debugs.
LLDB is built to be scriptable. Its documentation explains that the entire API is exposed through Python script bindings, allowing the API to be used within LLDB’s embedded script interpreter and also from any external Python script. This turns the debugger into a programmable platform: developers can write custom commands, automate repetitive debugging sessions, format complex data structures, and drive entire test and analysis workflows in Python. The same C++ API that the command-line tool is built on is available to other programs that want to embed debugging capabilities.
The tool is released under the Apache 2.0 License with LLVM exceptions and runs on many platforms and processor architectures. It is best known as the default debugger shipped inside Xcode on macOS, where it backs both the command-line lldb program and the graphical debugging experience in the IDE. Like GDB, it offers the standard repertoire of breakpoints, watchpoints, stack inspection, stepping, and post-mortem analysis of core files, but it presents them through a command structure and a scripting model of its own.
LLDB’s arrival gave the LLVM and Clang toolchain a debugger that matched its compiler in modernity and licensing, and on Apple platforms it largely displaced GDB. Together with GCC-and-GDB on the GNU side, LLDB-and-Clang forms one of the two dominant open compiler-and-debugger ecosystems in contemporary software development.