Skip to content

Install lldb-dap from the plugin details with Homebrew (0.1.0) - #7

Merged
xiaoyumuxi merged 1 commit into
mainfrom
feat/lldb-dap-installer
Nov 15, 2026
Merged

xiaoyumuxi merged 1 commit into
mainfrom
feat/lldb-dap-installer

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Contributor

代替 #6:改动相同,只是把两个提交合成一个,并去掉了提交里的 Co-Authored-By 署名。

变化

找不到 lldb-dap 时(PATH 和 xcrun --find lldb-dap 都没有),插件详情里调试能力的卡片上出现 安装 按钮。版本升到 0.1.0。

  • commandInstallers:lldb-dap 安装器运行 brew install lldb,只声明 toolDefault 目标(位置由 Homebrew 决定),目录探针是 brew --prefix lldb 加 bin,超时 3600 秒,mayUseNetwork: true。
  • toolDefinitions:插件限定 ID 的 io.github.lithe-idea.lldb-debug:homebrew(避免和别的插件的短 ID 互相争用),先找 PATH 里的 brew,再扫描 /opt/homebrew、/usr/local 的 bin/brew,版本探针 brew --version。
  • 清单新增 requires.commandInstallers、requires.toolDefinitions、requiresTools 和 commands.install 权限。
  • 选 Homebrew 的原因:xcode-select --install 是 GUI 安装器,没法作为安装命令;Homebrew 本身要求命令行工具,而 Homebrew 的 lldb 用 LLDB_USE_SYSTEM_DEBUGSERVER 构建,启动程序用的就是命令行工具里的 debugserver。
  • 为什么是 lldb 不是 llvm:Homebrew 的 llvm 已经不再包含 LLDB(它的 caveats 写着 LLD、LLDB 拆成了单独的 formula)。Install lldb-dap from the plugin details with Homebrew (0.1.0) #6 第一次 CI 用 brew install llvm,装完 $(brew --prefix llvm)/bin 里没有 lldb-dap,所以改成 lldb。
  • 代价:lldb 依赖 llvm 和 Python,会下载几百 MB,装好后超过 1 GB;lldb、llvm 都是 keg-only,不改 PATH,也不替换系统的 lldb、clang。Homebrew 只给 Apple Silicon 上的 macOS 15 及以上提供预编译包,Intel Mac 和更早的 macOS 会从源码编译,可能超过一小时的时限。这些 README 和发布说明里都写了。

验证

  • scripts/test.mjs(新):用 clang -g 编译 C 程序,按清单声明跑两次真实 DAP 会话:先用 xcrun 找到的 Xcode lldb-dap,再按安装器声明执行 brew install lldb、从目录探针给出的目录启动装好的 lldb-dap;每次都要命中断点、行号正确、读出局部变量 answer = 42、退出码 0。目录里找不到命令时会列出目录内容。CI 新增 commands job 在 macos-latest 上运行它。
  • 同一份代码在 Install lldb-dap from the plugin details with Homebrew (0.1.0) #6 的 run 43728568598 里通过:全新执行 brew install lldb(25.6 秒),lldb-dap 在 /opt/homebrew/opt/lldb/bin,用它的调试会话命中断点、读出变量并正常退出。本地 LITHE_TEST_INSTALL=0 通过(Xcode 的 lldb-dap);没有在本机执行 brew install lldb。
  • Rust Core(origin/main 9425469)的真实解析器:validate_manifest_value 通过;工具注册无冲突;macOS 发现计划扫描 /opt/homebrew、/usr/local;安装需求把 lldb-dap 安装器挂到 lldb 调试适配器;toolDefault 计划是 brew install lldb,managed 被拒绝(plugin.commandInstaller.targetUndeclared);默认目录对 /opt/homebrew/opt/lldb 给出 /opt/homebrew/opt/lldb/bin。
  • 宿主 e2e:e2e/host/lithe-host.json 固定到 1lck/Lithe-IDEA 4032c5ca0(含 #1954、#1964、#1971、#1975)。原来的测试用写死的能力表校验清单,改为用宿主的 pluginhost.Declared();node scripts/e2e-host.mjs 中 TestDebugRealLLDBLaunchTargetAndBreakpoints 通过。
  • node scripts/package.mjs 和 Lithe Store 规则检查通过(0 problems)。

兼容性

0.1.0 需要支持 commandInstallers 的桌面端(1lck/Lithe-IDEA#1971),更早的桌面端继续用 0.0.1。PRERELEASE_TAGS 加上 v0.1.0。合并后推送 v0.1.0 标签发布,再在 Lithe Store 提交 0.1.0 条目(requires 要加 commandInstallers、toolDefinitions,SHA-256 用 Release 上的实际值)。

When neither PATH nor `xcrun --find lldb-dap` has lldb-dap, the debug
capability card now offers an install button: a command installer runs
`brew install lldb` through a plugin-qualified Homebrew tool definition
(brew on PATH, /opt/homebrew or /usr/local) and reads the directory from
`brew --prefix lldb` plus bin. Only the toolDefault target is declared,
since Homebrew owns where LLDB goes. The manifest now requires
commandInstallers and toolDefinitions and asks for commands.install.

Homebrew's llvm formula no longer builds LLDB. The separate lldb formula
is keg-only, depends on llvm and Python, and is built with
LLDB_USE_SYSTEM_DEBUGSERVER, so it launches programs through the Command
Line Tools' debugserver. The docs say what the install downloads, that
Homebrew ships bottles only for Apple Silicon on macOS 15 and later
(elsewhere it builds from source and can run past the one-hour limit),
and how to remove it.

scripts/test.mjs builds a C program with clang -g and runs two real DAP
sessions as the manifest declares them: one with the lldb-dap Lithe finds
today and one after the declared install, each stopping on a breakpoint,
reading a local and exiting cleanly. CI runs it on macos-latest.

The host e2e pin moves to 1lck/Lithe-IDEA 4032c5ca0, which serves
commandInstallers, and the test validates with the host's declared
capabilities instead of a hard-coded list.
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 15, 2026 15:25
@xiaoyumuxi
xiaoyumuxi merged commit ac8fad9 into main Nov 15, 2026
2 checks passed
@xiaoyumuxi
xiaoyumuxi deleted the feat/lldb-dap-installer branch November 15, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant