debug_inspector icon indicating copy to clipboard operation
debug_inspector copied to clipboard

binding.call(1).break not valid on debug gem which was builtin on Ruby 3.1release.

Open zw963 opened this issue 4 years ago • 0 comments

I guess this issue caused by this gem, so, i create a new issue here too.

feel free to close one of them, thank you.

I want warp offical binding.break into a method, assume, named: brk!.

following is attempt: (compare to pry)

require 'binding_of_caller'

class Binding
  def _break
    require 'debug'

    warn 'laoding break'

    self.break
  end

  def _pry
    require 'pry'
    warn 'loading pry'
    self.pry
  end
end

class Object
  def brk!
    binding.of_caller(1)._break
  end

  def pry!
    binding.of_caller(1)._pry
  end
end

What i expected is, wrappered brk! behavior like wrapped pry!.

e.g. asssume, we have 1.rb code like this:

puts 100
pry!
puts 200

when run with ruby 1.rb, get this: (it was expected)

image

But, when if change code to this:

puts 100
brk!
puts 200

when run ruby 1.rb, get this. (it was unexpected)

image

as you can see, the => not stop on correct position. (which we expected to on same line as brk! as pry! does)

Thank you.

zw963 avatar Jan 03 '22 16:01 zw963