diff --git a/exe/rdbg b/exe/rdbg index 14b5e978c..0d753c171 100755 --- a/exe/rdbg +++ b/exe/rdbg @@ -13,18 +13,12 @@ when :start start_mode = config[:open] ? "open" : 'start' cmd = config[:command] ? ARGV.shift : (ENV['RUBY'] || RbConfig.ruby) - if defined?($:.resolve_feature_path) - begin - _, sopath = $:.resolve_feature_path('debug/debug.so') - rescue LoadError - # raises LoadError before 3.1 (2.7 and 3.0) - else - sopath = File.dirname(File.dirname(sopath)) if sopath - end + begin + _, sopath = $:.resolve_feature_path('debug/debug.so') + rescue LoadError + # raises LoadError before 3.1 (2.7 and 3.0) else - # `$:.resolve_feature_path` is not defined in 2.6 or earlier. - so = "debug/debug.#{RbConfig::CONFIG['DLEXT']}" - sopath = $:.find {|dir| File.exist?(File.join(dir, so))} + sopath = File.dirname(File.dirname(sopath)) if sopath end added = "-r #{libpath}/#{start_mode}" added = "-I #{sopath} #{added}" if sopath diff --git a/lib/debug/breakpoint.rb b/lib/debug/breakpoint.rb index 78c4d2174..224c35e58 100644 --- a/lib/debug/breakpoint.rb +++ b/lib/debug/breakpoint.rb @@ -476,24 +476,13 @@ def enable try_enable end - if RUBY_VERSION.to_f <= 2.6 - def override klass - sig_method_name = @sig_method_name - klass.prepend Module.new{ - define_method(sig_method_name) do |*args, &block| - super(*args, &block) - end - } - end - else - def override klass - sig_method_name = @sig_method_name - klass.prepend Module.new{ - define_method(sig_method_name) do |*args, **kw, &block| - super(*args, **kw, &block) - end - } - end + def override klass + sig_method_name = @sig_method_name + klass.prepend Module.new{ + define_method(sig_method_name) do |*args, **kw, &block| + super(*args, **kw, &block) + end + } end def try_enable added: false diff --git a/lib/debug/session.rb b/lib/debug/session.rb index 99c78af1d..d13bcffb4 100644 --- a/lib/debug/session.rb +++ b/lib/debug/session.rb @@ -2664,12 +2664,3 @@ class Binding alias break debugger alias b debugger end - -# for Ruby 2.6 compatibility -unless method(:p).unbind.respond_to? :bind_call - class UnboundMethod - def bind_call(obj, *args) - self.bind(obj).call(*args) - end - end -end