Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix how to detect potential_lines #397

Conversation

yui-knk
Copy link
Contributor

@yui-knk yui-knk commented Dec 24, 2017

On Ruby 2.5, format of RubyVM::InstructionSequence#disasm
will be changed. By this change we can not detect which
line is valid to set breakpoints. On the other hand
Ruby 2.5 will introduce new methods

  • RubyVM::InstructionSequence#each_child
    Iterate all direct child instruction sequences.
  • RubyVM::InstructionSequence#trace_points
    Return trace points in the instruction sequence.

see: https://github.com/ruby/ruby/blob/9fe26ef8de1ae047a4d775ce74878a0aeb01a19b/NEWS

We can detect potential_lines by these methods.
So this commit defines new methods and call each_child &
trace_points if these methods are implemented.

Thanks to Koichi Sasada (ko1) for investigation, implemention of
new methods for Ruby and concept implementation for byebug.

This PR is a part of Ruby 2.5 support. I will send another PR to fix some
test cases.

Related: #345

@yui-knk
Copy link
Contributor Author

yui-knk commented Dec 24, 2017

On my local environment

$ ruby -v
ruby 2.5.0dev (2017-12-24 trunk 61432) [x86_64-darwin14]

$ bundle exec rake test
465 runs, 528 assertions, 7 failures, 0 errors, 3 skips

On Ruby 2.5, format of `RubyVM::InstructionSequence#disasm`
will be changed. By this change we can not detect which
line is valid to set breakpoints. On the other hand
Ruby 2.5 will introduce new methods

* `RubyVM::InstructionSequence#each_child`
  Iterate all direct child instruction sequences.
* `RubyVM::InstructionSequence#trace_points`
  Return trace points in the instruction sequence.

see: https://github.com/ruby/ruby/blob/9fe26ef8de1ae047a4d775ce74878a0aeb01a19b/NEWS

We can detect potential_lines by these methods.
So this commit defines new methods and call each_child &
trace_points if these methods are implemented.

Thanks to Koichi Sasada (ko1) for investigation, implemention of
new methods for Ruby and concept implementation for byebug.
@deivid-rodriguez
Copy link
Owner

Looking great, thanks so much! I'll merge as soon as CI is done!

@deivid-rodriguez deivid-rodriguez merged commit b2cfc5c into deivid-rodriguez:master Dec 24, 2017
@yui-knk yui-knk deleted the potential_lines_with_trace_points branch December 24, 2017 04:42
@yui-knk yui-knk mentioned this pull request Dec 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants