Crate lldb

source · []
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:

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

A section + offset based address class.
Configuration for attaching to a process.
A lexical block.
A logical breakpoint and its associated settings.
One unique instance (by address) of a logical breakpoint.
An entity which can broadcast events.
A compilation unit or compiled source file.
A block of data.
Creates SBTargets, provides access to them and manages the overall debugging experience.
Iterate over the targets known to a debugger.
A container for holding any error code and an error message.
An event.
Represents a file.
A file specification that divides the path into a directory and basename.
An iterator over the filespecs in an SBFileSpecList.
One of the stack frames associated with a thread.
A generic function, which can be inlined or not.
A machine instruction.
Configuration for launching a process.
Specifies an association with a contiguous range of instructions and a source file location.
Listen for debugger events.
An executable image and its associated object and symbol files.
Iterate over the sections in a module.
A description of an SBModule.
A platform that can represent the current host or a remote host debug platform.
The process associated with the target program.
Iterate over the restart reasons in a process event.
Iterate over the queues in a process.
Iterate over the threads in a process.
A libdispatch (aka Grand Central Dispatch) queue.
A work item enqueued on a libdispatch aka Grand Central Dispatch (GCD) queue.
Iterate over the queue items in a queue.
Iterate over the threads associated with a queue.
A destination for streaming data output. By default, this is a string stream, but it can be redirected to a file.
A list of strings.
An iterator over an SBStringList.
The value of a variable, register or expression.
The symbol possibly associated with a stack frame.
A container that stores various debugger related info.
The target program running under the debugger.
Iterate over the modules referenced from a target event.
Iterate over the modules in a target.
A thread of execution.
A thread event.
Iterate over the frames in a thread.
A list of types.
An iterator over the types in an SBTypeList.
The value of a variable, register or expression.
An iterator over the values in an SBValueList.
An instance of a watch point for a specific target program.
These mask bits allow a common interface for queries that can limit the amount of information that gets parsed to only the information that is requested. These bits also can indicate what actually did get resolved during query function calls.

Enums

Type Definitions

Storage for the value of an address.
Storage for an offset between 2 addresses in memory.
Storage for an OS process ID.
Storage for an OS thread ID.
Storage for an OS user ID.