Debugger stops at unexpected place when using `trace call`

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

还没有人认领这个 Issue。

评估

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

调研方向

Reproduce with the listed Ruby 3.1.0 and rdbg 1.7.1 steps using the testapp, then follow the trace call entry point and breakpoint at line 9 in app/controllers/students_controller.rb. Confirm the debugger stops at line 9 rather than line 7 after continuing; the issue has no named debugger source file or test.

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

描述

bug

Your environment

  • ruby -v:
  • ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin21]
  • rdbg -v:
  • rdbg 1.7.1

To Reproduce

  1. Clone https://github.com/ono-max/testapp
  2. bundle install
  3. rails db:create
  4. rails db:migrate
  5. bin/rails s
$ bin/rails s
=> Booting Puma
=> Rails 7.0.4.2 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.6.5 (ruby 3.0.3-p157) ("Birdie's Version")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 28208
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000
Use Ctrl-C to stop
  1. Go to localhost:3000, then it should stop as follows:
...
Use Ctrl-C to stop
Started GET "/" for ::1 at 2023-02-14 01:57:49 +0900
  ActiveRecord::SchemaMigration Pluck (0.1ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Processing by StudentsController#index as HTML
[1, 10] in ~/workspace/testapp/app/controllers/students_controller.rb
     1| class StudentsController < ApplicationController
     2|   before_action :set_student, only: %i[ show edit update destroy ]
     3|
     4|   # GET /students or /students.json
     5|   def index
=>   6|     binding.break
     7|     student1 = Student.first
     8|     student2 = Student.last
     9|   end
    10|
=>#0	StudentsController#index at ~/workspace/testapp/app/controllers/students_controller.rb:6
  #1	ActionController::BasicImplicitRender#send_action(method="index", args=[]) at ~/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/actionpack-7.0.4.2/lib/action_controller/metal/basic_implicit_render.rb:6
  # and 75 frames (use `bt' command for all frames)
  1. "trace call"
  2. Set a breakpoint at line 9
  3. Then continue.
  4. Stop at line 7
...
[2, 11] in ~/workspace/testapp/app/controllers/students_controller.rb
     2|   before_action :set_student, only: %i[ show edit update destroy ]
     3|
     4|   # GET /students or /students.json
     5|   def index
     6|     binding.break
=>   7|     student1 = Student.first
     8|     student2 = Student.last
     9|   end
    10|
    11|   # GET /students/1 or /students/1.json
=>#0	StudentsController#index at ~/workspace/testapp/app/controllers/students_controller.rb:7 #=> nil
  #1	ActionController::BasicImplicitRender#send_action(method="index", args=[]) at ~/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/actionpack-7.0.4.2/lib/action_controller/metal/basic_implicit_render.rb:6
  # and 75 frames (use `bt' command for all frames)
...

Expected behavior
It should stop at line 9.

Additional context
Add any other context about the problem here.

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