deivid-rodriguez / byebug

Debugging in Ruby 2
BSD 2-Clause "Simplified" License
3.34k stars 328 forks source link

Cannot step into require method in Ruby 3.0.0 #788

Open JunichiIto opened 3 years ago

JunichiIto commented 3 years ago

Problem description

I cannot step into require method in Ruby 3.0.0.

Here is a sample script.

require 'byebug/version'

puts RUBY_DESCRIPTION
puts Byebug::VERSION

Expected behavior

Run the script above in Ruby 2.7.2:

$ ruby sample.rb 
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
11.1.3

And I can step into require method:

$ byebug sample.rb

[1, 5] in /Users/jnito/Desktop/sample.rb
=> 1: require 'byebug/version'
   2: 
   3: puts RUBY_DESCRIPTION
   4: puts Byebug::VERSION
(byebug) s

[30, 39] in /Users/jnito/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb
   30:   #
   31:   # The normal <tt>require</tt> functionality of returning false if
   32:   # that file has already been loaded is preserved.
   33: 
   34:   def require(path)
=> 35:     if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
   36:       monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
   37:     end
   38:     RUBYGEMS_ACTIVATION_MONITOR.enter
   39: 
(byebug) s

[31, 40] in /Users/jnito/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb
   31:   # The normal <tt>require</tt> functionality of returning false if
   32:   # that file has already been loaded is preserved.
   33: 
   34:   def require(path)
   35:     if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
=> 36:       monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
   37:     end
   38:     RUBYGEMS_ACTIVATION_MONITOR.enter
   39: 
   40:     path = path.to_path if path.respond_to? :to_path
(byebug) 

Actual behavior

Run the script above in Ruby 3.0.0:

$ ruby sample.rb 
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
11.1.3

This is okay, but I cannot step into require method:

$ byebug sample.rb 

[1, 5] in /Users/jnito/Desktop/sample.rb
=> 1: require 'byebug/version'
   2: 
   3: puts RUBY_DESCRIPTION
   4: puts Byebug::VERSION
(byebug) s
*** No sourcefile available for <internal:/Users/jnito/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>
(byebug) s
*** No sourcefile available for <internal:/Users/jnito/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>
(byebug) 

Shouldn't it show this code?

Steps to reproduce the problem

(I described above.)