Skip to content

feat(debug): #1794 静音覆盖全部断点类型、内存读取窗口与标题栏运行/调试判断下沉到 Core - #21

Merged
xiaoyumuxi merged 1 commit into
mainfrom
feature/1794-debug-mute-memory-title
Nov 13, 2026
Merged

xiaoyumuxi merged 1 commit into
mainfrom
feature/1794-debug-mute-memory-title

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Contributor

背景

Lithe-IDEA #1837(标题栏运行/调试按钮、IntelliJ IDEA 样式的调试工具窗口)的评审意见指出三处问题:

  1. 桌面端“静音断点”只清空了源码、函数、指令、数据断点,异常断点仍会停;而且静音只对当时已有的会话生效。
  2. 内存视图的读取窗口(地址解析、64 字节对齐、高亮字节定位)写在 Go 里,属于双端都需要的规则。
  3. 标题栏 Run/Debug 的判断(等配置、先加载模型、模型加载失败后不再循环)写在 Go 里,同样应该放进 Core。

按 develop-lithe 的逻辑归属,三者都放进 Core,桌面端只负责传输和呈现。

改动

  • 新命令 debug.setBreakpointsMuted { sessionId, muted }(debug/engine.rs、debug/types.rs)
    • 会话新增 breakpoints_muted。静音期间 Core 照常保存、接受替换源码/异常/函数/指令/数据五类断点,但发给适配器的每一类都是空集合,所以适配器哪里都不停。
    • 切换时(收到 initialized 之后)只重发含有启用项的类别,源码按路径逐个重发;重复设置同一状态不发任何帧。
    • 子会话(startDebugging)创建时继承父会话的静音状态。
    • 所有 send_*_breakpoints 的过滤统一走 sends(enabled)。
    • 测试 muting_empties_every_breakpoint_kind_and_children_inherit_it:异常过滤器、函数、指令、源码都被清空;再次静音不发帧;静音时替换函数集合仍发空集合;子会话继承;取消静音按保存的集合恢复。
  • 新命令 debug.planMemoryWindow / debug.locateMemoryWindow(新文件 debug/memory_window.rs)
    • plan:地址去首尾空白后校验(非空、≤256 字符、无控制字符)。按 DAP 写法识别数字地址(0x 十六进制或十进制):显示为小写 0x,从不大于它的 64 字节边界开始读 1024 字节,这样 8/16/32/64 字节每行时目标字节都落在正确的列。其他引用不透明:原样读取,offset 为 0,不做解析。
    • locate:带回窗口原样(不匹配则拒绝)和回复的 address、字节数,返回 { base?, mark? }。base 是首字节地址(小写 0x),mark 是目标字节下标;回复不包含目标字节时省略。
    • 地址在协议里一律是字符串(64 位地址超出 JavaScript 安全整数范围)。
    • 共享 fixture:rust/fixtures/debug/memory-window-v1.json(6 个场景:十六进制、十进制、大写前缀与补零、不透明引用、地址 0、u64::MAX)。
  • 新命令 runConfig.decideTitleAction(新文件 execution/title_action.rs)
    • 输入 { action, trigger, currentFileChosen, settled, configuration? },configuration 为 unsupported / instanceMissing / modelNotLoaded{failed} / modelLoaded{debuggable}。
    • 返回 currentFile / wait / loadModel / unsupported / targetMissing / modelFailed / run / debug / notDebuggable。
    • 上次加载失败的模型只在用户按下时重新加载;settled 时再次失败返回 modelFailed,不会循环。
    • 共享 fixture:rust/fixtures/run-configuration/title-action-v1.json(14 个用例,带 run-configuration fixture 要求的 version/expected)。
  • 注册:protocol/command.rs(含命令名测试列表)、runtime/dispatcher.rs、debug/mod.rs、execution/mod.rs。
  • rust/contracts/rust-core-api.md:在断点、运行配置、新的 “Memory window” 小节补充三处说明。

验证

  • cargo test -p lithe-core:1748 passed。
  • cargo clippy -p lithe-core --all-targets:新增文件没有告警。
  • scripts/rust-core/verify-rust-core-comments.sh 通过(唯一的 rustdoc 警告在 plugins/capabilities.rs,改动前就有)。

消费者

  • Lithe-IDEA #1837 把 PINNED_CORE_REVISION 升到本 PR 的 commit,并把静音、内存窗口、标题栏判断切到这三个命令;fixture 已同步到 shared/fixtures/。本 PR 若 squash 合并,#1837 需要再把固定版本升到合并后的 commit。
  • 没有修改插件契约、能力版本或插件函数协议,所以不需要更新协议更新记录。

…memory window and decide title bar run/debug presses

- debug.setBreakpointsMuted keeps the stored sets and sends every kind (source,
  exception, function, instruction, data) empty while muted; a child session
  starts muted when its parent is.
- debug.planMemoryWindow / debug.locateMemoryWindow own the memory view's
  readMemory window: numeric addresses aligned to 64 bytes, opaque references
  read as given, and where the highlighted byte falls in the reply.
- runConfig.decideTitleAction decides what a title bar Run or Debug press does
  from the facts the host reports, so a failed model load ends instead of looping.
- Fixtures: rust/fixtures/debug/memory-window-v1.json,
  rust/fixtures/run-configuration/title-action-v1.json.
@xiaoyumuxi
xiaoyumuxi merged commit c001967 into main Nov 13, 2026
5 checks passed
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