cli-anything-lldb

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

LLDB CLI Skill

LLDB CLI 调试工具

Use this CLI to run structured LLDB debugging workflows with JSON output.
使用该CLI工具以JSON输出形式运行结构化的LLDB调试工作流。

Capabilities

功能特性

  • Create debug target from executable path
  • Launch process or attach by pid/name
  • Manage breakpoints (set/list/delete/enable/disable)
  • Inspect threads, frames, locals, and backtrace
  • Evaluate expressions in current frame
  • Read/find process memory
  • Load core dumps
  • Interactive REPL with persistent session state
  • Formal stdio Debug Adapter Protocol server for AI/editor clients
  • 从可执行文件路径创建调试目标
  • 启动进程或通过进程ID/名称附加进程
  • 管理断点(设置/列出/删除/启用/禁用)
  • 检查线程、栈帧、局部变量和回溯信息
  • 在当前栈帧中计算表达式
  • 读取/查找进程内存
  • 加载核心转储文件
  • 具有持久会话状态的交互式REPL环境
  • 面向AI/编辑器客户端的标准stdio Debug Adapter Protocol服务器

Quick Commands

快速命令

bash
cli-anything-lldb --json target create --exe /path/to/exe
cli-anything-lldb --json process launch --arg foo --arg bar
cli-anything-lldb --json breakpoint set --function main
cli-anything-lldb --json breakpoint set --function PluginEntry --allow-pending
cli-anything-lldb --json process continue
cli-anything-lldb --json process interrupt
cli-anything-lldb --json thread backtrace --limit 20
cli-anything-lldb --json frame locals
cli-anything-lldb --json expr "myVar"
cli-anything-lldb --json memory read --address 0x1000 --size 64
cli-anything-lldb --json session close
bash
cli-anything-lldb --json target create --exe /path/to/exe
cli-anything-lldb --json process launch --arg foo --arg bar
cli-anything-lldb --json breakpoint set --function main
cli-anything-lldb --json breakpoint set --function PluginEntry --allow-pending
cli-anything-lldb --json process continue
cli-anything-lldb --json process interrupt
cli-anything-lldb --json thread backtrace --limit 20
cli-anything-lldb --json frame locals
cli-anything-lldb --json expr "myVar"
cli-anything-lldb --json memory read --address 0x1000 --size 64
cli-anything-lldb --json session close

Debug Adapter Protocol

Debug Adapter Protocol(调试适配器协议)

Use the DAP entry point when an AI client needs a real debug adapter lifecycle instead of shelling out separate CLI commands:
bash
cli-anything-lldb-dap
cli-anything-lldb-dap --profile /path/to/stop-rules.json
or:
bash
cli-anything-lldb dap
cli-anything-lldb dap --profile /path/to/stop-rules.json
The DAP server speaks stdio
Content-Length
frames and must have exclusive stdout. Do not print logs to stdout around it. Supported requests include
initialize
,
launch
,
attach
,
configurationDone
,
setBreakpoints
,
setFunctionBreakpoints
,
threads
,
stackTrace
,
scopes
,
variables
,
setVariable
,
evaluate
,
continue
,
pause
,
next
,
stepIn
,
stepOut
,
source
,
loadedSources
,
readMemory
,
modules
,
exceptionInfo
,
disassemble
, and
disconnect
.
DAP variables can expose child references for structs/classes/arrays. Use
setVariable
only while stopped; LLDB may reject writes to optimized-out or read-only values.
For long-running GUI debuggees, DAP
continue
is non-blocking from the client's point of view: the adapter sends the response and
continued
event first, then waits for LLDB on a background thread. DAP
pause
uses LLDB async interrupt. If an agent needs to change breakpoints while the debuggee is running, the adapter interrupts first and waits for a stopped state before mutating LLDB breakpoints; if the target does not stop in time, retry after an explicit
pause
/
stopped
cycle.
For GUI apps that stop on debugger-internal startup or shader-JIT breakpoints,
launch
and
attach
accept the non-standard boolean argument
autoContinueInternalBreakpoints
. Enable it only when those internal stops are noise for the task; the adapter emits an
output
event before auto-continuing. For target-specific noise, prefer structured stop rules through inline
stopRules
or an external
stopRuleProfile
/
--profile
JSON file. Rules can match by
reason
,
module
,
function
, and/or
regex
, then either
stop
with clear
cliAnythingStop.origin
metadata or
continue
automatically. Use profiles for apps such as C4D so their NVIDIA shader-JIT/startup traps live outside the generic adapter.
DAP
stopped
events include
body.cliAnythingStop.origin
:
manualPause
for a client pause request,
internalTrap
for a matched internal rule, and
debuggee
for ordinary program stops. Existing
cli-anything-lldb-dap
processes do not hot-load new code or profile contents; restart the adapter and re-attach or re-launch before expecting new rules to apply.
当AI客户端需要完整的调试适配器生命周期,而非单独执行CLI命令时,请使用DAP入口:
bash
cli-anything-lldb-dap
cli-anything-lldb-dap --profile /path/to/stop-rules.json
或:
bash
cli-anything-lldb dap
cli-anything-lldb dap --profile /path/to/stop-rules.json
DAP服务器采用stdio
Content-Length
帧通信,必须独占标准输出。请勿在其周围向标准输出打印日志。支持的请求包括
initialize
launch
attach
configurationDone
setBreakpoints
setFunctionBreakpoints
threads
stackTrace
scopes
variables
setVariable
evaluate
continue
pause
next
stepIn
stepOut
source
loadedSources
readMemory
modules
exceptionInfo
disassemble
disconnect
DAP变量可暴露结构体/类/数组的子引用。仅在进程暂停时使用
setVariable
;LLDB可能会拒绝写入已优化掉或只读的值。
对于长期运行的GUI调试目标,从客户端角度来看,DAP
continue
是非阻塞的:适配器先发送响应和
continued
事件,然后在后台线程等待LLDB。DAP
pause
使用LLDB异步中断。如果Agent需要在调试目标运行时修改断点,适配器会先中断进程,等待进入暂停状态后再修改LLDB断点;如果目标未及时暂停,请在显式执行
pause
/
stopped
循环后重试。
对于在调试器内部启动或着色器JIT断点处暂停的GUI应用,
launch
attach
接受非标准布尔参数
autoContinueInternalBreakpoints
。仅当这些内部暂停对任务来说是干扰时才启用该参数;适配器会在自动继续前发出
output
事件。针对特定目标的干扰,建议通过内联
stopRules
或外部
stopRuleProfile
/
--profile
JSON文件使用结构化暂停规则。规则可通过
reason
module
function
和/或
regex
进行匹配,然后要么带着清晰的
cliAnythingStop.origin
元数据
stop
(暂停),要么自动
continue
(继续)。对于C4D等应用,请使用配置文件,使其NVIDIA着色器JIT/启动陷阱独立于通用适配器。
DAP
stopped
事件包含
body.cliAnythingStop.origin
字段:
manualPause
表示客户端暂停请求,
internalTrap
表示匹配到内部规则,
debuggee
表示普通程序暂停。已运行的
cli-anything-lldb-dap
进程不会热加载新代码或配置文件内容;在期望新规则生效前,请重启适配器并重新附加或重新启动调试目标。

Command Groups

命令组

target

target(目标)

bash
cli-anything-lldb --json target create --exe /path/to/exe [--arch x86_64]
cli-anything-lldb --json target info
bash
cli-anything-lldb --json target create --exe /path/to/exe [--arch x86_64]
cli-anything-lldb --json target info

process

process(进程)

bash
cli-anything-lldb --json process launch [--arg ARG ...] [--env KEY=VALUE ...] [--cwd DIR] [--stop-at-entry]
cli-anything-lldb --json process attach --pid 1234
cli-anything-lldb --json process attach --name myapp --wait-for
cli-anything-lldb --json process continue
cli-anything-lldb --json process interrupt
cli-anything-lldb --json process detach
cli-anything-lldb --json process info
bash
cli-anything-lldb --json process launch [--arg ARG ...] [--env KEY=VALUE ...] [--cwd DIR] [--stop-at-entry]
cli-anything-lldb --json process attach --pid 1234
cli-anything-lldb --json process attach --name myapp --wait-for
cli-anything-lldb --json process continue
cli-anything-lldb --json process interrupt
cli-anything-lldb --json process detach
cli-anything-lldb --json process info

breakpoint

breakpoint(断点)

bash
cli-anything-lldb --json breakpoint set --function main
cli-anything-lldb --json breakpoint set --file main.c --line 42 --condition "i > 10"
cli-anything-lldb --json breakpoint set --function LateLoadedSymbol --allow-pending
cli-anything-lldb --json breakpoint list
cli-anything-lldb --json breakpoint delete --id 1
cli-anything-lldb --json breakpoint enable --id 1
cli-anything-lldb --json breakpoint disable --id 1
bash
cli-anything-lldb --json breakpoint set --function main
cli-anything-lldb --json breakpoint set --file main.c --line 42 --condition "i > 10"
cli-anything-lldb --json breakpoint set --function LateLoadedSymbol --allow-pending
cli-anything-lldb --json breakpoint list
cli-anything-lldb --json breakpoint delete --id 1
cli-anything-lldb --json breakpoint enable --id 1
cli-anything-lldb --json breakpoint disable --id 1

thread / frame / step

thread / frame / step(线程/栈帧/单步调试)

bash
cli-anything-lldb --json thread list
cli-anything-lldb --json thread select --id 11111
cli-anything-lldb --json thread backtrace --limit 50
cli-anything-lldb --json frame select --index 0
cli-anything-lldb --json frame info
cli-anything-lldb --json frame locals
cli-anything-lldb --json step over
cli-anything-lldb --json step into
cli-anything-lldb --json step out
bash
cli-anything-lldb --json thread list
cli-anything-lldb --json thread select --id 11111
cli-anything-lldb --json thread backtrace --limit 50
cli-anything-lldb --json frame select --index 0
cli-anything-lldb --json frame info
cli-anything-lldb --json frame locals
cli-anything-lldb --json step over
cli-anything-lldb --json step into
cli-anything-lldb --json step out

expr / memory / core

expr / memory / core(表达式/内存/核心转储)

bash
cli-anything-lldb --json expr "argc"
cli-anything-lldb --json memory read --address 0x1000 --size 128
cli-anything-lldb --json memory find "needle" --start 0x1000 --size 4096
cli-anything-lldb --json core load --path /path/to/core
bash
cli-anything-lldb --json expr "argc"
cli-anything-lldb --json memory read --address 0x1000 --size 128
cli-anything-lldb --json memory find "needle" --start 0x1000 --size 4096
cli-anything-lldb --json core load --path /path/to/core

Agent Usage Notes

Agent 使用注意事项

  • Prefer
    --json
    for all automated flows.
  • Separate non-REPL invocations share a persistent session daemon by default.
  • Use
    --session-file PATH
    or
    CLI_ANYTHING_LLDB_SESSION_FILE
    to pin an explicit session for a task.
  • Run
    cli-anything-lldb --json session close
    when finished so attached processes detach and launched debuggees are cleaned up.
  • Use REPL when a human-like interactive shell is more convenient, not because persistence requires it.
  • Unresolved CLI breakpoints fail by default; pass
    --allow-pending
    only when a future module/symbol load is expected.
  • DAP unresolved breakpoints use protocol semantics:
    verified: false
    until resolved.
  • DAP
    continue
    is non-blocking for long-running GUI processes, and DAP
    pause
    uses async interrupt.
  • DAP breakpoint changes during an active continue first interrupt and wait for a stopped state before mutating LLDB.
  • Use DAP stop-rule profiles for app-specific internal traps; restart and re-attach/re-launch after profile changes.
  • memory find
    uses a chunked scan capped at 1 MiB per call.
  • Call
    target create
    before process or core commands.
  • Expect structured errors:
    {"error": "...", "type": "..."}
  • 所有自动化流程优先使用
    --json
    参数。
  • 默认情况下,非REPL模式的独立调用会共享一个持久会话守护进程。
  • 使用
    --session-file PATH
    或环境变量
    CLI_ANYTHING_LLDB_SESSION_FILE
    为任务指定明确的会话。
  • 调试完成后运行
    cli-anything-lldb --json session close
    ,以便附加的进程分离,启动的调试目标被清理。
  • 当类人交互式shell更方便时使用REPL,而非因为需要持久化而使用。
  • 未解析的CLI断点默认会失败;仅当预期未来会加载模块/符号时才传递
    --allow-pending
    参数。
  • DAP未解析的断点使用协议语义:在解析前
    verified: false
  • 对于长期运行的GUI进程,DAP
    continue
    是非阻塞的,DAP
    pause
    使用异步中断。
  • 在进程持续运行期间修改DAP断点时,适配器会先中断进程,等待进入暂停状态后再修改LLDB断点。
  • 针对特定应用的内部陷阱使用DAP暂停规则配置文件;修改配置文件后请重启适配器并重新附加/启动调试目标。
  • memory find
    使用分块扫描,每次调用上限为1 MiB。
  • 在执行进程或核心转储命令前调用
    target create
  • 预期会收到结构化错误:
    {"error": "...", "type": "..."}