Expand description
LLDB
This crate provides a safe binding to the public API for LLDB, the debugger provided by the LLVM project. LLDB provides a modern, high performance debugger framework and is the default debugger for macOS and iOS.
Installation
This crate works with Cargo and is on crates.io.
Add it to your Cargo.toml
like so:
lldb = "0.0.11"
macOS Installation Notes
On macOS, this library relies upon being able to find
the LLDB.framework
that is provided by Xcode.app.
In your own application, you will need to configure the
@rpath
for your executable to point to the location
of the LLDB.framework
that you are using. Doing this
automatically is not currently supported by Cargo.
For testing, you can use the version provided by Xcode.app by setting an environment variable:
export DYLD_FRAMEWORK_PATH=/Applications/Xcode.app/Contents/SharedFrameworks
Linux Installation Notes
Install the lldb
and lldb-dev
packages for your platform so that
you have both LLDB itself installed as well as the headers and
other support files required.
Windows Installation Notes
Support for building this has not yet been provided for Windows. Contributions are welcome!
Usage
The primary entry point is SBDebugger
. This will be how you
create a debug target and begin the actually interesting stuff.
Important Classes
The LLDB API provides many structs and a wide range of functionality. Some of the most common usages will involve these structs and their corresponding methods:
SBDebugger
: Manages the entire debug experience and createsSBTarget
s.SBTarget
: The target program running under the debugger.SBProcess
: The process associated with the target program.SBThread
: A thread of execution.SBProcess
containsSBThread
s.SBFrame
: One of the stack frames associated with a thread.SBThread
containsSBFrame
s.SBSymbolContext
: A container that stores various debugger related info.SBValue
: The value of a variable, a register, or an expression.SBModule
: An executable image and its associated object and symbol files.SBTarget
containsSBModule
s.SBBreakpoint
: A logical breakpoint and its associated settings.SBTarget
containsSBBreakpoint
s.SBSymbol
: The symbol possibly associated with a stack frame.SBCompileUnit
: A compilation unit, or compiled source file.SBFunction
: A generic function, which can be inlined or not.SBBlock
: A lexical block.SBFunction
containsSBBlock
s.SBLineEntry
: Specifies an association with a contiguous range of instructions and a source file location.SBCompileUnit
containsSBLineEntry
s.
Support and Maintenance
I am developing this library largely on my own so far. I am able to offer support and maintenance, but would very much appreciate donations via Patreon. I can also provide commercial support, so feel free to contact me.
Re-exports
pub extern crate lldb_sys as sys;
Structs
SBBreakpointList
.SBBreakpoint
.SBTarget
s, provides access to them and manages
the overall debugging experience.SBFileSpecList
.SBInstructionList
.SBModule
.libdispatch
(aka Grand Central Dispatch) queue.SBStringList
.SBTypeList
.SBValueList
.