Missing DAP OutputEvents for debuggee stdout/stderr

未关闭
#1,160 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
ruby
领域
devtools

调研方向

Reproduce the issue with the linked rdbg-stdout-issue example in Zed and inspect the DAP logs while running test.rb. Read the debug gem's DAP output handling and compare it with vscode-rdbg's extension.ts around line 994. Done means stdout and stderr appear in the Debug Console as OutputEvents with stdout and stderr categories, including output after the breakpoint.

由索引模型根据 Issue 内容生成。

描述

Your environment

  • ruby -v: ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [arm64-darwin25]
  • rdbg -v: rdbg 1.11.0

Describe the bug

When debugging a Ruby program with rdbg via DAP, the debuggee's stdout and stderr output is not sent as DAP OutputEvents. Instead, the output appears to be passed through to rdbg own stdout/stderr streams, which prevents it from viewing in the Debug Console of DAP clients that don't implement workarounds.

To Reproduce

The easiest way to reproduce is to debug any Ruby file with Zed (with installed Ruby extension):
I've created a small repo with an example: https://github.com/vitallium/rdbg-stdout-issue

Steps:

  1. Clone the repo
  2. Install gems with bundle install
  3. Open in Zed
  4. Open test.rb file
  5. Press F4 to start the debugging session, and in the popup choose Debug file
  6. Continue execution till the end.

According to the Debug Adapter Protocol specification, debug adapters should capture the debuggee's output streams and send them as OutputEvents with appropriate categories stdout and stderr

When a Ruby program prints to stdout/stderr, rdbg should send OutputEvent messages like:

{
  "type": "event",
  "event": "output",
  "body": {
    "category": "stdout",
    "output": "Hello from stdout\n"
  }
}

Expected behavior

The Console panel should print: Hello from stdout, Hello from stderr and After breakpoint when the execution continues. Currently, rdbg does not send these OutputEvents. The debuggee's stdout/stderr is passed through to rdbg own stdout/stderr streams, which can be seen in adapter logs but not in the Debug Console. You can check that by opening the DAP logs in Zed via the command palette dev: open debug adapter logs.

Additional context

The vscode-rdbg extension actually does that: https://github.com/ruby/vscode-rdbg/blob/master/src/extension.ts#L994

I think I can work on a fix if you consider this an issue (or a feature request) with the debug gem. Thanks!

主要语言
Ruby
星标
1.3k
派生
146
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ruby/debug 的其他 Issue

查看 ruby/debug 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。