lldb

package
v0.6.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lldb provides a minimal, cgo-free binding to the LLDB SB (scripting bridge) API. It loads LLDB.framework at runtime with purego and calls the public C++ SB API directly.

LLDB has no stable public C API; only the C++ SB API is exported. This package binds the small subset needed to attach to a process, set symbol breakpoints, inspect stopped threads and registers, evaluate expressions in the target, and patch register values. It is not a complete binding.

SB wrapper zero values are not usable. Start with Create and obtain other values through its debugger, targets, and processes.

Platform

macOS only (arm64 and amd64). Every SB value is a small C++ object returned by value; under the platform C++ ABI that return goes through an indirect-result buffer, so the Go binding models each SB value as a fixed 32-byte cell to route the return correctly.

Lifetime

Each returned SB wrapper owns a native object and must be closed, including invalid results and Error values. Copies of a wrapper share ownership: closing any copy invalidates them all. Close is safe on zero values and repeated calls. Other methods require an open handle; Close must not race with those methods. There is no finalizer: Go garbage collection does not release native objects.

Close transient handles at the end of each operation. Detach or kill processes before closing their handles, and close the debugger last. Debugger.Close also removes LLDB's global debugger registration. Closing a target or breakpoint handle does not remove the target or breakpoint from its debugger.

Usage

d, err := lldb.Create()
if err != nil {
	log.Fatal(err)
}
defer d.Close()
t := d.CreateTargetWithArch("/bin/sleep", "")
defer t.Close()
bp := t.BreakpointCreateByName("nanosleep")
defer bp.Close()
fmt.Println(bp.IsValid())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL