This harness wraps the LLDB Python API into a Click-based CLI tool and debug adapter:
cli-anything-lldbfor JSON CLI / REPL workflowscli-anything-lldb-dapfor stdio Debug Adapter Protocol clients
It provides stateful debugging workflows for agent and script usage, with:
- direct
import lldbintegration - structured dict outputs for JSON mode
- interactive REPL with persistent debug session
- a formal single-session DAP server for AI/editor debugging
agent-harness/
├── HARNESS.md
├── LLDB.md
├── setup.py
└── cli_anything/
└── lldb/
├── lldb_cli.py
├── dap.py
├── core/
│ ├── session.py
│ ├── breakpoints.py
│ ├── inspect.py
│ └── threads.py
├── utils/
│ ├── lldb_backend.py
│ ├── output.py
│ ├── errors.py
│ └── repl_skin.py
├── skills/SKILL.md
└── tests/
--json: machine-readable output--debug: include traceback in errors--session-file: explicit persistent CLI session state path--version: show package version
target: create/show targetprocess: launch/attach/continue/interrupt/detach/infobreakpoint: set/list/delete/enable/disablethread: list/select/backtrace/infoframe: select/info/localsstep: over/into/outexpr: evaluate expressionmemory: read/findcore: load core dumpdap: run stdio DAP serversession: info/close persistent CLI sessionrepl: interactive mode (default)
cli-anything-lldb-dap is a stdio DAP server. It owns one in-process
LLDBSession and does not use the persistent CLI daemon. Stdout must contain
only DAP Content-Length frames; diagnostics go to stderr or --log-file.
Supported v1 requests:
- lifecycle:
initialize,launch,attach,configurationDone,disconnect - breakpoints:
setBreakpoints,setFunctionBreakpoints - inspection:
threads,stackTrace,scopes,variables,setVariable,evaluate,source,loadedSources,readMemory,modules,exceptionInfo,disassemble - execution:
continue,pause,next,stepIn,stepOut
DAP uses protocol-native pending breakpoint semantics: unresolved breakpoints
return verified: false, and later resolution is reported with breakpoint
events.
Variable references are adapter-local and reset on resume. This keeps stopped
frame state honest for AI agents and avoids reusing stale LLDB SBValue
objects after execution continues.
Long-running GUI targets can provide DAP stop-rule profiles either with
cli-anything-lldb-dap --profile PATH, cli-anything-lldb dap --profile PATH,
or launch/attach arguments such as stopRuleProfile and inline stopRules.
Rules match structured stop context (reason, module, function, regex)
and either classify the stop or auto-continue it. Stopped events expose
body.cliAnythingStop.origin so clients can distinguish manual pauses,
debugger-internal traps, and ordinary debuggee stops. Profiles are loaded by the
current adapter process only; running DAP sessions must restart and re-attach or
re-launch before new code/profile contents take effect.
- Lazy import of LLDB: LLDB bindings are imported only when a command actually needs a session.
- Session object:
LLDBSessionowns debugger/target/process lifecycle. - Dict-first API: Core methods return JSON-serializable dict/list structures.
- Honest breakpoint state:
Breakpoint payloads include
resolvedandlocation_details; CLI unresolved breakpoints fail unless--allow-pendingis explicit. - Dual output mode:
_output()chooses JSON or human-friendly formatting. - Boundary errors: Command layer converts exceptions into structured error payloads.
- Secure persistent daemon: CLI session auth state is written under a per-user directory with restrictive permissions and RPC dispatch uses an explicit method allowlist.
- Structured stop classification:
DAP stop handling uses profile-driven rules instead of ad hoc substring
checks, while preserving
autoContinueInternalBreakpointsas a compatibility shortcut for common NVIDIA/Windows internal traps.
LLDB is a required backend dependency:
- macOS:
xcode-select --install - Ubuntu:
sudo apt install lldb python3-lldb - Windows:
winget install LLVM.LLVM
The harness auto-discovers LLDB Python bindings with lldb -P.