The LLDB Debugger
LLDB is a next generation, high-performance debugger. It is built as a set of reusable components which highly leverage existing libraries in the larger LLVM Project, such as the Clang expression parser and LLVM disassembler.
LLDB is in early development, but is mature enough to support basic debugging scenarios on Mac OS X in C, Objective-C and C++.
All of the code in the LLDB project is available under the standard LLVM License, an open source "BSD-style" license.
Goals
The current state of the art in open source debuggers are that they work in the common cases for C applications, but don't handle many "hard cases" properly. For example, C++ expression parsing, handling overloading, templates, multi-threading, and other non-trivial scenarios all work in some base cases, but don't work reliably.
The goal of LLDB is to provide an amazing debugging experience that "just works". We aim to solve these long-standing problems where debuggers get confused, so that you can think about debugging your problem, not about deficiencies in the debugger.
With a long view, there is no good reason for a debugger to reinvent its own C/C++ parser, type system, know all the target calling convention details, implement its own disassembler, etc. By using the existing libraries vended by the LLVM project, we believe that many of these problems will be defined away, and the debugger can focus on important issues like process control, efficient symbol reading and indexing, thread management, and other debugger-specific problems.
Some more specific goals include:
- Build libraries for inclusion in IDEs, command line tools, and other analysis tools
- High performance and efficient memory use
- Extensible: Python scriptable and use a plug-in architecture
- Reuse existing compiler technology where it makes sense
- Excellent multi-threaded debugging support
- Great support for C, Objective-C and C++
- Retargetable to support multiple platforms
- Provide a base for debugger research and other innovation
Why a new debugger?
In order to achieve our goals we decided to start with a fresh architecture that would support modern multi-threaded programs, handle debugging symbols in an efficient manner, use compiler based code knowledge and have plug-in support for functionality and extensions. Additionally we want the debugger capabilities to be available to other analysis tools, be they scripts or compiled programs, without requiring them to be GPL.
Features
LLDB supports a broad variety of basic debugging features such as reading DWARF, supporting step, next, finish, backtraces, etc. Some more interested bits are:
- Plug-in architecture for portability and extensibility:
- Object file parsers for executable file formats. Support currently includes Mach-O (32 and 64-bit) & ELF (32-bit).
- Object container parsers to extract object files contained within a file. Support currently includes universal Mach-O files & BSD Archives.
- Debug symbol file parsers to incrementally extract debug information from object files. Support currently includes DWARF & Mach-O symbol tables.
- Symbol vendor plug-ins collect data from a variety of different sources for an executable object.
- Disassembly plug-ins for each architecture. Support currently includes an LLVM disassembler for i386, x86_64, & ARM/Thumb.
- Debugger plug-ins implement the host and target specific functions required to debug.
- SWIG-generated script bridging allows Python to access and control the public API of the debugger library.
- A remote protocol server, debugserver, implements Mac OS X debugging on i386 and x86_64.
- A command line debugger - the lldb executable itself.
- A framework API to the library.
Platform Support
LLDB is known to work on the following platforms, but ports to new platforms are welcome:
- Mac OS X i386 and X86-64
Current Status
LLDB is in early development and supports basic debugging scenarios on Mac OS X. The public API has not been finalized, and different parts are at different levels of maturity. We welcome any help fleshing out missing pieces and improving the code.
What works well:
- Process control, including external process control via debugserver (which is included as part of the lldb project)
- Breakpoints: Source-line, symbolic, C++ mangled names, module scoping
- Symbol reading and object file introspection
- Script bridging
- Thread inspection and stepping
- Disassembly of i386, x86_64, & ARM/Thumb machine code, and backtracing on i386 & x86_64
- The basic command line prompt system, shared library tracking, source listings.
What is still pretty new:
- The public API to the library
- Expression evaluation
- Objective-C support: stepping into/over, printing the description of an object ("po")
- Breakpoint actions & scripts
- Attaching to existing processes
What isn't there yet:
- Regression test suite
- Operating system support hasn't been fully modularized yet
- Blocks support
- Calling functions in expressions
- Objective-C 2.0 Support: Printing properties, synthetic properties, Objective-C expressions, KVO, dynamic types, dot syntax, runtime data
- C++ support: Method access, handling demangled names, dynamic types
- Exception support: Breaking by name, thrown object, thrower
Get it and get involved!
To check out the code, use:
- svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
Note that LLDB currently only builds out of the box on Darwin with Xcode, but patches to improve portability are definitely welcome.
Discussions about LLDB should go to the lldb-dev mailing list. Commit messages for the lldb SVN module are automatically sent to the lldb-commits mailing list, and this is also the preferred mailing list for patch submissions.