Skip to content

Weird stepping behaviour when used with puma 6.0 #799

@st0012

Description

@st0012

Your environment

Describe the bug

When using the latest ruby/debug with Puma 6.0+, stepping over (or next command) could enter weird places (e.g. zeitwerk's internal). For example:

[2, 11] in ~/projects/debug-issue/app/controllers/posts_controller.rb
     2|   before_action :set_post, only: %i[ show edit update destroy ]
     3|
     4|   # GET /posts or /posts.json
     5|   def index
     6|     binding.b
=>   7|     @posts = Post.all
     8|     a = 1
     9|     b = 2
    10|   end
    11|
=>#0    PostsController#index at ~/projects/debug-issue/app/controllers/posts_controller.rb:7
  #1    ActionController::BasicImplicitRender#send_action(method="index", args=[]) at ~/.gem/ruby/3.1.2/gems/actionpack-7.0.4/lib/action_controller/metal/basic_implicit_render.rb:6
  # and 76 frames (use `bt' command for all frames)
(rdbg) n    # next command
[23, 32] in ~/.gem/ruby/3.1.2/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb
    23|     alias_method :zeitwerk_original_require, :require
    24|   end
    25|
    26|   # @sig (String) -> true | false
    27|   def require(path)
=>  28|     if loader = Zeitwerk::Registry.loader_for(path)
    29|       if path.end_with?(".rb")
    30|         required = zeitwerk_original_require(path)
    31|         loader.on_file_autoloaded(path) if required
    32|         required
=>#0    Kernel#require(path="/Users/hung-wulo/projects/debug-issue/ap...) at ~/.gem/ruby/3.1.2/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:28
  #1    PostsController#index at ~/projects/debug-issue/app/controllers/posts_controller.rb:7
  # and 77 frames (use `bt' command for all frames)

To Reproduce

Please clone this vanilla Rails app and follow the instructions in the readme.

Expected behavior

Typing n should go to line 8 instead of entering zeitwerk's internal.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions