Communitygithub.com

cli-anything-lldb

透過 LLDB Python API 進行有狀態的 LLDB 偵錯

cli-anything-lldb 是什麼?

此技能提供一個基於命令列的 LLDB 偵錯工具,支援 JSON 輸出,適用於自動化工作流程或與 AI 代理程式整合。它涵蓋從建立偵錯目標、啟動或附加程序、管理中斷點、檢查執行緒與堆疊框架、到評估表達式與讀取記憶體等完整功能。此外,它還實作了標準的 Debug Adapter Protocol (DAP) 伺服器,讓 AI 用戶端或編輯器能夠以正式的生命週期進行偵錯,而非僅透過個別 CLI 指令。DAP 模式支援非同步繼續、中斷點熱更新、以及自訂停止規則配置,可過濾無關的內部中斷點(如 shader JIT 陷阱),非常適合圖形密集型應用程式的長期偵錯。此工具可在任何支援 LLDB Python API 的平台上運作,並透過持久化會話守護行程維持狀態,確保多個調用之間的一致性。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/HKUDS/CLI-Anything/tree/main/skills/cli-anything-lldb

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

LLDB 命令列技能

使用此命令列來執行結構化的 LLDB 偵錯工作流程,並輸出 JSON。

能力

  • 從可執行檔案路徑建立偵錯目標
  • 啟動程序或依 PID/名稱附加程序
  • 管理中斷點(設定/列出/刪除/啟用/停用)
  • 檢查執行緒、堆疊框架、區域變數與回溯追蹤
  • 在當前框架中評估表達式
  • 讀取/搜尋處理程序記憶體
  • 載入核心傾印
  • 具有持久化會話狀態的互動式 REPL
  • 供 AI/編輯器用戶端使用的正式 stdio Debug Adapter Protocol 伺服器

快速指令

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

當 AI 用戶端需要真正的偵錯配接器生命週期,而不是分別執行個別 CLI 指令時,請使用 DAP 進入點:

cli-anything-lldb-dap
cli-anything-lldb-dap --profile /path/to/stop-rules.json

或:

cli-anything-lldb dap
cli-anything-lldb dap --profile /path/to/stop-rules.json

DAP 伺服器會透過 stdio 傳送 Content-Length 框架,且必須獨佔 stdout。請勿在執行期間將日誌輸出到 stdout。支援的請求包括 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 的非同步中斷。如果代理程式需要在偵錯目標執行時更改中斷點,配接器會先中斷並等待暫停狀態,然後才修改 LLDB 中斷點;如果目標未及時停止,請在明確的 pause/stopped 循環之後重試。

對於因偵錯器內部啟動或 shader-JIT 中斷點而停止的 GUI 應用程式,launch 和 attach 接受非標準的布林參數 autoContinueInternalBreakpoints。僅在這些內部停止對任務來說是噪音時才啟用它;配接器會在自動繼續之前發出 output 事件。對於目標特定的噪音,建議透過內聯 stopRules 或外部 stopRuleProfile/--profile JSON 檔案使用結構化停止規則。規則可以根據 reason、module、function 和/或 regex 進行匹配,然後 stop(附帶清楚的 cliAnythingStop.origin 元資料)或自動 continue。對於像 C4D 這樣的應用程式,請使用設定檔,以便其 NVIDIA shader-JIT/啟動陷阱存在於通用配接器之外。

DAP stopped 事件包含 body.cliAnythingStop.origin:manualPause 表示用戶端暫停請求,internalTrap 表示匹配的內部規則,debuggee 表示一般的程序停止。現有的 cli-anything-lldb-dap 程序不會熱載入新程式碼或設定檔內容;在期望新規則生效之前,請重新啟動配接器並重新附加或重新啟動。

指令群組

target

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

process

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

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

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

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

代理程式使用注意事項

  • 對於所有自動化流程,建議使用 --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 使用非同步中斷。
  • 在活動的 continue 期間更改 DAP 中斷點時,會先中斷並等待暫停狀態,然後才修改 LLDB。
  • 使用 DAP 停止規則設定檔來處理應用程式特定的內部陷阱;更改設定檔後,重新啟動並重新附加/重新啟動。
  • memory find 使用分段掃描,每次調用上限為 1 MiB。
  • 在執行 process 或 core 指令之前,請先呼叫 target create。
  • 預期結構化錯誤:{"error": "...", "type": "..."}

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cli-anything-adguardhome

>-

cli-anything-anygen

>-

cli-anything-audacity

>-

cli-anything-blender

>-

cli-anything-browser

Browser automation CLI using DOMShell MCP server. Maps Chrome

cli-anything-calibre

>-

cli-anything-ccswitch

CLI interface for CC Switch — manage AI coding tool configurations from the terminal

cli-anything-chromadb

>-

cli-anything-cloudanalyzer

Command-line interface for CloudAnalyzer — Agent-friendly harness for CloudAnalyzer, a QA platform for mapping, localization, and perception outputs. Supports 27 commands across 8 groups: point cloud evaluation, trajectory evaluation, ground segmentation QA, config-driven quality gates, baseline evolution, processing, visualization, and interactive REPL.

cli-anything-cloudcompare

Command-line interface for CloudCompare — Agent-friendly harness for CloudCompare, the open-source 3D point cloud and mesh processing software. Supports 41 commands across 9 groups: project management, session control, point cloud operations (subsample, filter, segment, analyze), mesh operations, distance computation (C2C, C2M), transformations (ICP, matrix), export (LAS/LAZ/PLY/PCD/OBJ/STL/E57), and interactive REPL.

cli-anything-comfyui

>-

cli-anything-dify-workflow

Wrapper for the Dify workflow DSL CLI. Create, inspect, validate, edit, and export Dify workflow files through a CLI-Anything harness.

cli-anything-drawio

>-

cli-anything-eez-studio

Use EEZ Studio from the command line: inspect and modify native .eez-project files, edit LVGL screens/widgets, manage SCPI commands, and invoke the real EEZ Studio backend for LVGL builds.

cli-anything-eth2-quickstart

>-

cli-anything-exa

>-

cli-anything-firefly-iii

Firefly III CLI - Personal finance management via CLI-Anything

cli-anything-freecad

Complete CLI harness for FreeCAD parametric 3D CAD modeler (258 commands). Covers ALL workbenches: Part (29 primitives + boolean + mirror + loft + sweep), Sketcher (26 cmds: geometry + constraints + editing), PartDesign (38 cmds: pad/pocket/groove/fillet/chamfer/patterns/hole/datum), Assembly (11 cmds), Mesh (16 cmds), TechDraw (15 cmds: views + dimensions + PDF/SVG), Draft (33 cmds: 2D shapes + arrays + transforms), FEM (12 cmds), CAM/CNC (10 cmds), Surface (6 cmds), Spreadsheet (7 cmds), Import (13 formats), Export (17 formats), Measure (12 cmds), Materials (21 presets). Headless FreeCAD export to STEP/IGES/STL/OBJ/DXF/PDF/glTF/3MF.

cli-anything-gimp

>-

cli-anything-godot

>-

相關技能