`-n` and `-e` cannot be used together

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

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
ruby
领域
cli, devtools

调研方向

Start with rdbg's command-line handling for -n, -e, and -c, then run the provided OpenStruct reproduction to observe the current behavior. Done means the command stops at OpenStruct#initialize and opens the attached rdbg shell without requiring continue in -e.

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

描述

enhancement

Your environment

λ ruby -v 
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin22]
λ rdbg -v
rdbg 1.7.1

Describe the bug

I was trying to execute some command with -c and specify a break point using -e so that I don't need to write the script in the rdbg again.
It works but I still need to manually run continue, to avoid this, I thought -n could help. However, after some tests I turns out -n and -e cannot be used together.

My current workaround is to put continue in -e:

rdbg -c -e 'b OpenStruct#initialize'$'\n''continue' -- ruby -rostruct -e 'OpenStruct.new'

To Reproduce

rdbg -n -c -e 'b OpenStruct#initialize' -- ruby -rostruct -e 'OpenStruct.new'

Expected behavior

process won't exit and attached rdbg shell on OpenStruct#initialize, output should look like:

[122, 131] in /usr/local/Cellar/ruby/3.2.2/lib/ruby/3.2.0/ostruct.rb
   122|   #   data = OpenStruct.new(hash)
   123|   #
   124|   #   data   # => #<OpenStruct country="Australia", capital="Canberra">
   125|   #
   126|   def initialize(hash=nil)
=> 127|     if hash
   128|       update_to_values!(hash)
   129|     else
   130|       @table = {}
   131|     end
=>#0    OpenStruct#initialize(hash=nil) at /usr/local/Cellar/ruby/3.2.2/lib/ruby/3.2.0/ostruct.rb:127
  #1    [C] Class#new at -e:1
  # and 1 frames (use `bt' command for all frames)

Stop by #0  BP - Method  OpenStruct#initialize at /usr/local/Cellar/ruby/3.2.2/lib/ruby/3.2.0/ostruct.rb:126

Additional context

process exists and prints nothing.

主要语言
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 摘要。