lldb

package module
v0.0.0-...-7e94837 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 8 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.

README

lldb

Status: experimental. This package exposes raw, generated SB API bindings. It has no repository consumer, and its bridge has not been validated against a retained LLDB installation receipt. Callers should use Load and Require before creating handles and must follow the explicit ownership rules below.

This directory is generated by gen-lldb. The Go bindings load a C++ bridge, not liblldb itself: liblldb exposes a C++ ABI and its symbols cannot safely be called directly from Go.

Compile bridge/lldb_bridge.cc with the headers and liblldb from the same LLVM installation. On macOS, for example:

clang++ -std=c++17 -fPIC -dynamiclib bridge/lldb_bridge.cc \
  -I"$LLVM_PREFIX/include" -L"$LLVM_PREFIX/lib" -llldb \
  -Wl,-rpath,"$LLVM_PREFIX/lib" -o liblldb_bridge.dylib

Set LIBLLDB_BRIDGE_PATH to the resulting shared library before using the package, or call Load with that path. The bridge and liblldb must come from one LLVM installation. Call LLDBSBDebuggerDestroy before deleting a debugger created with LLDBSBDebuggerCreateWithInitFiles.

To verify generated files and the bridge receipt have not drifted, run:

gen-lldb -check -output lldb -bridge-output lldb/bridge

Documentation

Overview

Package lldb provides low-level Go bindings for the liblldb bridge.

The bridge is compiled against one liblldb installation. Handles own C++ SB API values and must be released with their matching Delete function. Call LLDBSBDebuggerDestroy before deleting a debugger created with LLDBSBDebuggerCreateWithInitFiles.

Index

Examples

Constants

View Source
const LibraryPathEnv = "LIBLLDB_BRIDGE_PATH"

LibraryPathEnv names the environment variable that overrides where the bridge library is loaded from.

Variables

View Source
var LLDBLastError_fn func() string
View Source
var LLDBSBBreakpointDelete_fn func(LLDBSBBreakpointRef)
View Source
var LLDBSBBreakpointGetID_fn func(LLDBSBBreakpointRef) uint32
View Source
var LLDBSBBreakpointIsEnabled_fn func(LLDBSBBreakpointRef) bool
View Source
var LLDBSBBreakpointIsValid_fn func(LLDBSBBreakpointRef) bool
View Source
var LLDBSBBreakpointSetEnabled_fn func(LLDBSBBreakpointRef, bool)
View Source
var LLDBSBDebuggerClear_fn func(LLDBSBDebuggerRef)
View Source
var LLDBSBDebuggerCreateTargetSimple_fn func(LLDBSBDebuggerRef, string) LLDBSBTargetRef
View Source
var LLDBSBDebuggerCreateWithInitFiles_fn func(bool) LLDBSBDebuggerRef
View Source
var LLDBSBDebuggerDelete_fn func(LLDBSBDebuggerRef)
View Source
var LLDBSBDebuggerDestroy_fn func(LLDBSBDebuggerRef)
View Source
var LLDBSBDebuggerGetAsync_fn func(LLDBSBDebuggerRef) bool
View Source
var LLDBSBDebuggerGetNumTargets_fn func(LLDBSBDebuggerRef) uint32
View Source
var LLDBSBDebuggerGetSelectedTarget_fn func(LLDBSBDebuggerRef) LLDBSBTargetRef
View Source
var LLDBSBDebuggerGetVersionString_fn func() string
View Source
var LLDBSBDebuggerHandleCommand_fn func(LLDBSBDebuggerRef, string)
View Source
var LLDBSBDebuggerInitialize_fn func()
View Source
var LLDBSBDebuggerIsValid_fn func(LLDBSBDebuggerRef) bool
View Source
var LLDBSBDebuggerSetAsync_fn func(LLDBSBDebuggerRef, bool)
View Source
var LLDBSBDebuggerSkipAppInitFiles_fn func(LLDBSBDebuggerRef, bool)
View Source
var LLDBSBDebuggerSkipLLDBInitFiles_fn func(LLDBSBDebuggerRef, bool)
View Source
var LLDBSBDebuggerTerminate_fn func()
View Source
var LLDBSBErrorClear_fn func(LLDBSBErrorRef)
View Source
var LLDBSBErrorDelete_fn func(LLDBSBErrorRef)
View Source
var LLDBSBErrorFail_fn func(LLDBSBErrorRef) bool
View Source
var LLDBSBErrorGetCString_fn func(LLDBSBErrorRef) string
View Source
var LLDBSBErrorGetError_fn func(LLDBSBErrorRef) uint32
View Source
var LLDBSBErrorIsValid_fn func(LLDBSBErrorRef) bool
View Source
var LLDBSBErrorNew_fn func() LLDBSBErrorRef
View Source
var LLDBSBErrorSuccess_fn func(LLDBSBErrorRef) bool
View Source
var LLDBSBFrameDelete_fn func(LLDBSBFrameRef)
View Source
var LLDBSBFrameEvaluateExpressionSimple_fn func(LLDBSBFrameRef, string) LLDBSBValueRef
View Source
var LLDBSBFrameGetDisplayFunctionName_fn func(LLDBSBFrameRef) string
View Source
var LLDBSBFrameGetFunctionName_fn func(LLDBSBFrameRef) string
View Source
var LLDBSBFrameGetPC_fn func(LLDBSBFrameRef) uint64
View Source
var LLDBSBFrameIsValid_fn func(LLDBSBFrameRef) bool
View Source
var LLDBSBProcessContinue_fn func(LLDBSBProcessRef) LLDBSBErrorRef
View Source
var LLDBSBProcessDelete_fn func(LLDBSBProcessRef)
View Source
var LLDBSBProcessDetachSimple_fn func(LLDBSBProcessRef) LLDBSBErrorRef
View Source
var LLDBSBProcessGetNumThreads_fn func(LLDBSBProcessRef) uint32
View Source
var LLDBSBProcessGetProcessID_fn func(LLDBSBProcessRef) uint64
View Source
var LLDBSBProcessGetSTDERR_fn func(LLDBSBProcessRef, uintptr, uint) uint
View Source
var LLDBSBProcessGetSTDOUT_fn func(LLDBSBProcessRef, uintptr, uint) uint
View Source
var LLDBSBProcessGetSelectedThread_fn func(LLDBSBProcessRef) LLDBSBThreadRef
View Source
var LLDBSBProcessGetState_fn func(LLDBSBProcessRef) int32
View Source
var LLDBSBProcessGetThreadAtIndex_fn func(LLDBSBProcessRef, uint32) LLDBSBThreadRef
View Source
var LLDBSBProcessIsValid_fn func(LLDBSBProcessRef) bool
View Source
var LLDBSBProcessKill_fn func(LLDBSBProcessRef) LLDBSBErrorRef
View Source
var LLDBSBProcessPutSTDIN_fn func(LLDBSBProcessRef, uintptr, uint) uint
View Source
var LLDBSBProcessReadMemory_fn func(LLDBSBProcessRef, uint64, uintptr, uint, LLDBSBErrorRef) uint
View Source
var LLDBSBProcessSetSelectedThreadByID_fn func(LLDBSBProcessRef, uint64) bool
View Source
var LLDBSBProcessSignal_fn func(LLDBSBProcessRef, int32) LLDBSBErrorRef
View Source
var LLDBSBProcessStop_fn func(LLDBSBProcessRef) LLDBSBErrorRef
View Source
var LLDBSBProcessWriteMemory_fn func(LLDBSBProcessRef, uint64, uintptr, uint, LLDBSBErrorRef) uint
View Source
var LLDBSBTargetBreakpointCreateByLocationSimple_fn func(LLDBSBTargetRef, string, uint32) LLDBSBBreakpointRef
View Source
var LLDBSBTargetBreakpointCreateByNameSimple_fn func(LLDBSBTargetRef, string) LLDBSBBreakpointRef
View Source
var LLDBSBTargetDeleteAllBreakpoints_fn func(LLDBSBTargetRef)
View Source
var LLDBSBTargetDelete_fn func(LLDBSBTargetRef)
View Source
var LLDBSBTargetGetNumModules_fn func(LLDBSBTargetRef) uint32
View Source
var LLDBSBTargetGetProcess_fn func(LLDBSBTargetRef) LLDBSBProcessRef
View Source
var LLDBSBTargetIsValid_fn func(LLDBSBTargetRef) bool
View Source
var LLDBSBThreadDelete_fn func(LLDBSBThreadRef)
View Source
var LLDBSBThreadGetFrameAtIndex_fn func(LLDBSBThreadRef, uint32) LLDBSBFrameRef
View Source
var LLDBSBThreadGetIndexID_fn func(LLDBSBThreadRef) uint32
View Source
var LLDBSBThreadGetNumFrames_fn func(LLDBSBThreadRef) uint32
View Source
var LLDBSBThreadGetStopReason_fn func(LLDBSBThreadRef) int32
View Source
var LLDBSBThreadGetThreadID_fn func(LLDBSBThreadRef) uint64
View Source
var LLDBSBThreadIsValid_fn func(LLDBSBThreadRef) bool
View Source
var LLDBSBValueDelete_fn func(LLDBSBValueRef)
View Source
var LLDBSBValueGetChildAtIndex_fn func(LLDBSBValueRef, uint32) LLDBSBValueRef
View Source
var LLDBSBValueGetName_fn func(LLDBSBValueRef) string
View Source
var LLDBSBValueGetNumChildren_fn func(LLDBSBValueRef) uint32
View Source
var LLDBSBValueGetSummary_fn func(LLDBSBValueRef) string
View Source
var LLDBSBValueGetValue_fn func(LLDBSBValueRef) string
View Source
var LLDBSBValueIsValid_fn func(LLDBSBValueRef) bool

Functions

func Close

func Close() error

Close unloads the library and clears every bound function pointer.

The pointers are package-level state, so Close must not run concurrently with any other call into this package. It exists for test teardown, not for reclaiming a library still in use.

func Has

func Has(symbol string) bool

Has reports whether a symbol resolved in the loaded library, loading it first if necessary. It reports false when the library cannot be loaded. Use it to gate on capabilities before calling into them.

func LLDBLastError

func LLDBLastError() string

LLDBLastError Returns the message of the exception thrown by the most recent bridge call on this thread, or NULL.

func LLDBSBBreakpointDelete

func LLDBSBBreakpointDelete(self LLDBSBBreakpointRef)

func LLDBSBBreakpointGetID

func LLDBSBBreakpointGetID(self LLDBSBBreakpointRef) uint32

func LLDBSBBreakpointIsEnabled

func LLDBSBBreakpointIsEnabled(self LLDBSBBreakpointRef) bool

func LLDBSBBreakpointIsValid

func LLDBSBBreakpointIsValid(self LLDBSBBreakpointRef) bool

func LLDBSBBreakpointSetEnabled

func LLDBSBBreakpointSetEnabled(self LLDBSBBreakpointRef, enabled bool)

func LLDBSBDebuggerClear

func LLDBSBDebuggerClear(self LLDBSBDebuggerRef)

func LLDBSBDebuggerDelete

func LLDBSBDebuggerDelete(self LLDBSBDebuggerRef)

func LLDBSBDebuggerDestroy

func LLDBSBDebuggerDestroy(debugger LLDBSBDebuggerRef)

func LLDBSBDebuggerGetAsync

func LLDBSBDebuggerGetAsync(self LLDBSBDebuggerRef) bool

func LLDBSBDebuggerGetNumTargets

func LLDBSBDebuggerGetNumTargets(self LLDBSBDebuggerRef) uint32

func LLDBSBDebuggerGetVersionString

func LLDBSBDebuggerGetVersionString() string

func LLDBSBDebuggerHandleCommand

func LLDBSBDebuggerHandleCommand(self LLDBSBDebuggerRef, command string)

func LLDBSBDebuggerInitialize

func LLDBSBDebuggerInitialize()

func LLDBSBDebuggerIsValid

func LLDBSBDebuggerIsValid(self LLDBSBDebuggerRef) bool

func LLDBSBDebuggerSetAsync

func LLDBSBDebuggerSetAsync(self LLDBSBDebuggerRef, enabled bool)

func LLDBSBDebuggerSkipAppInitFiles

func LLDBSBDebuggerSkipAppInitFiles(self LLDBSBDebuggerRef, skip bool)

func LLDBSBDebuggerSkipLLDBInitFiles

func LLDBSBDebuggerSkipLLDBInitFiles(self LLDBSBDebuggerRef, skip bool)

func LLDBSBDebuggerTerminate

func LLDBSBDebuggerTerminate()

func LLDBSBErrorClear

func LLDBSBErrorClear(self LLDBSBErrorRef)

func LLDBSBErrorDelete

func LLDBSBErrorDelete(self LLDBSBErrorRef)

func LLDBSBErrorFail

func LLDBSBErrorFail(self LLDBSBErrorRef) bool

func LLDBSBErrorGetCString

func LLDBSBErrorGetCString(self LLDBSBErrorRef) string

func LLDBSBErrorGetError

func LLDBSBErrorGetError(self LLDBSBErrorRef) uint32

func LLDBSBErrorIsValid

func LLDBSBErrorIsValid(self LLDBSBErrorRef) bool

func LLDBSBErrorSuccess

func LLDBSBErrorSuccess(self LLDBSBErrorRef) bool

func LLDBSBFrameDelete

func LLDBSBFrameDelete(self LLDBSBFrameRef)

func LLDBSBFrameGetDisplayFunctionName

func LLDBSBFrameGetDisplayFunctionName(self LLDBSBFrameRef) string

func LLDBSBFrameGetFunctionName

func LLDBSBFrameGetFunctionName(self LLDBSBFrameRef) string

func LLDBSBFrameGetPC

func LLDBSBFrameGetPC(self LLDBSBFrameRef) uint64

func LLDBSBFrameIsValid

func LLDBSBFrameIsValid(self LLDBSBFrameRef) bool

func LLDBSBProcessDelete

func LLDBSBProcessDelete(self LLDBSBProcessRef)

func LLDBSBProcessGetNumThreads

func LLDBSBProcessGetNumThreads(self LLDBSBProcessRef) uint32

func LLDBSBProcessGetProcessID

func LLDBSBProcessGetProcessID(self LLDBSBProcessRef) uint64

func LLDBSBProcessGetSTDERR

func LLDBSBProcessGetSTDERR(self LLDBSBProcessRef, data []byte) uint

func LLDBSBProcessGetSTDOUT

func LLDBSBProcessGetSTDOUT(self LLDBSBProcessRef, data []byte) uint

func LLDBSBProcessGetState

func LLDBSBProcessGetState(self LLDBSBProcessRef) int32

func LLDBSBProcessIsValid

func LLDBSBProcessIsValid(self LLDBSBProcessRef) bool

func LLDBSBProcessPutSTDIN

func LLDBSBProcessPutSTDIN(self LLDBSBProcessRef, data []byte) uint

func LLDBSBProcessReadMemory

func LLDBSBProcessReadMemory(self LLDBSBProcessRef, address uint64, data []byte, error LLDBSBErrorRef) uint

func LLDBSBProcessSetSelectedThreadByID

func LLDBSBProcessSetSelectedThreadByID(self LLDBSBProcessRef, threadID uint64) bool

func LLDBSBProcessWriteMemory

func LLDBSBProcessWriteMemory(self LLDBSBProcessRef, address uint64, data []byte, error LLDBSBErrorRef) uint

func LLDBSBTargetDelete

func LLDBSBTargetDelete(self LLDBSBTargetRef)

func LLDBSBTargetDeleteAllBreakpoints

func LLDBSBTargetDeleteAllBreakpoints(self LLDBSBTargetRef)

func LLDBSBTargetGetNumModules

func LLDBSBTargetGetNumModules(self LLDBSBTargetRef) uint32

func LLDBSBTargetIsValid

func LLDBSBTargetIsValid(self LLDBSBTargetRef) bool

func LLDBSBThreadDelete

func LLDBSBThreadDelete(self LLDBSBThreadRef)

func LLDBSBThreadGetIndexID

func LLDBSBThreadGetIndexID(self LLDBSBThreadRef) uint32

func LLDBSBThreadGetNumFrames

func LLDBSBThreadGetNumFrames(self LLDBSBThreadRef) uint32

func LLDBSBThreadGetStopReason

func LLDBSBThreadGetStopReason(self LLDBSBThreadRef) int32

func LLDBSBThreadGetThreadID

func LLDBSBThreadGetThreadID(self LLDBSBThreadRef) uint64

func LLDBSBThreadIsValid

func LLDBSBThreadIsValid(self LLDBSBThreadRef) bool

func LLDBSBValueDelete

func LLDBSBValueDelete(self LLDBSBValueRef)

func LLDBSBValueGetName

func LLDBSBValueGetName(self LLDBSBValueRef) string

func LLDBSBValueGetNumChildren

func LLDBSBValueGetNumChildren(self LLDBSBValueRef) uint32

func LLDBSBValueGetSummary

func LLDBSBValueGetSummary(self LLDBSBValueRef) string

func LLDBSBValueGetValue

func LLDBSBValueGetValue(self LLDBSBValueRef) string

func LLDBSBValueIsValid

func LLDBSBValueIsValid(self LLDBSBValueRef) bool

func Load

func Load(path string) error

Load opens the bridge library from path, or from the default search list when path is empty, and binds every symbol.

Loading is otherwise lazy: the first call into this package loads the library. Call Load first only to choose the library or to surface a load failure at a point of your choosing.

Load is idempotent. Calling it again with the same path, or with an empty path, returns nil; calling it with a different path after a successful load returns an error rather than swapping the library underneath live handles. After a failed load, Load retries.

func Loaded

func Loaded() bool

Loaded reports whether the library is open. It never triggers a load.

func Path

func Path() string

Path reports where the library was loaded from, or "" if it is not loaded.

func Require

func Require(symbol string) error

Require reports whether symbol can be called.

Require loads the bridge if necessary. It returns the bridge load error or a SymbolError when the loaded bridge does not provide symbol. Use Require when a caller needs to distinguish an unavailable bridge from an older bridge; Has intentionally reports both cases as false.

Example
package main

import (
	"fmt"

	"github.com/tmc/lib/lldb"
)

func main() {
	err := lldb.Require("a_symbol_no_lldb_bridge_exports")
	fmt.Println(err != nil)
}
Output:
true

Types

type LLDBSBBreakpointRef

type LLDBSBBreakpointRef = uintptr

func LLDBSBTargetBreakpointCreateByLocationSimple

func LLDBSBTargetBreakpointCreateByLocationSimple(self LLDBSBTargetRef, file string, line uint32) LLDBSBBreakpointRef

func LLDBSBTargetBreakpointCreateByNameSimple

func LLDBSBTargetBreakpointCreateByNameSimple(self LLDBSBTargetRef, symbol string) LLDBSBBreakpointRef

type LLDBSBDebuggerRef

type LLDBSBDebuggerRef = uintptr

func LLDBSBDebuggerCreateWithInitFiles

func LLDBSBDebuggerCreateWithInitFiles(sourceInitFiles bool) LLDBSBDebuggerRef

type LLDBSBErrorRef

type LLDBSBErrorRef = uintptr

func LLDBSBErrorNew

func LLDBSBErrorNew() LLDBSBErrorRef

func LLDBSBProcessContinue

func LLDBSBProcessContinue(self LLDBSBProcessRef) LLDBSBErrorRef

func LLDBSBProcessDetachSimple

func LLDBSBProcessDetachSimple(self LLDBSBProcessRef) LLDBSBErrorRef

func LLDBSBProcessKill

func LLDBSBProcessKill(self LLDBSBProcessRef) LLDBSBErrorRef

func LLDBSBProcessSignal

func LLDBSBProcessSignal(self LLDBSBProcessRef, signal int32) LLDBSBErrorRef

func LLDBSBProcessStop

func LLDBSBProcessStop(self LLDBSBProcessRef) LLDBSBErrorRef

type LLDBSBFrameRef

type LLDBSBFrameRef = uintptr

func LLDBSBThreadGetFrameAtIndex

func LLDBSBThreadGetFrameAtIndex(self LLDBSBThreadRef, index uint32) LLDBSBFrameRef

type LLDBSBProcessRef

type LLDBSBProcessRef = uintptr

func LLDBSBTargetGetProcess

func LLDBSBTargetGetProcess(self LLDBSBTargetRef) LLDBSBProcessRef

type LLDBSBTargetRef

type LLDBSBTargetRef = uintptr

func LLDBSBDebuggerCreateTargetSimple

func LLDBSBDebuggerCreateTargetSimple(self LLDBSBDebuggerRef, filename string) LLDBSBTargetRef

func LLDBSBDebuggerGetSelectedTarget

func LLDBSBDebuggerGetSelectedTarget(self LLDBSBDebuggerRef) LLDBSBTargetRef

type LLDBSBThreadRef

type LLDBSBThreadRef = uintptr

func LLDBSBProcessGetSelectedThread

func LLDBSBProcessGetSelectedThread(self LLDBSBProcessRef) LLDBSBThreadRef

func LLDBSBProcessGetThreadAtIndex

func LLDBSBProcessGetThreadAtIndex(self LLDBSBProcessRef, index uint32) LLDBSBThreadRef

type LLDBSBValueRef

type LLDBSBValueRef = uintptr

func LLDBSBFrameEvaluateExpressionSimple

func LLDBSBFrameEvaluateExpressionSimple(self LLDBSBFrameRef, expression string) LLDBSBValueRef

func LLDBSBValueGetChildAtIndex

func LLDBSBValueGetChildAtIndex(self LLDBSBValueRef, index uint32) LLDBSBValueRef

type SymbolError

type SymbolError struct {
	Symbol string
}

SymbolError reports that a symbol is absent from the loaded library, which happens when the installed version predates it.

func (*SymbolError) Error

func (e *SymbolError) Error() string

Jump to

Keyboard shortcuts

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