-
-
Notifications
You must be signed in to change notification settings - Fork 939
Description
Hey!
I randomly bumped into this one while testing a new release of pry-debugger-jruby.
It seems binding.source_location is off by a few lines when -Xcompile.mode=JIT is being used, which confuses pry since it uses that to display source code.
Example used below:
puts RUBY_DESCRIPTION
# require 'bundler/inline'
# gemfile do
# source 'https://rubygems.org'
# gem 'pry'
# end
# require 'pry'
def some_method
puts binding.source_location
# binding.pry
Hello.new.potato
puts 'Hello, World!'
end
class Hello
def potato
puts "potato1"
puts "potato2"
end
end
some_method(You can comment out the pry parts to see how pry misbehaves)
Environment Information
Provide at least:
- JRuby version (
jruby -v) and command line (flags, JRUBY_OPTS, etc)
jruby 9.4.6.0 (3.1.4) 2024-02-20 576fab2c51 OpenJDK 64-Bit Server VM 23.0.1+8-FR on 23.0.1+8-FR +jit [x86_64-linux]
jruby -Xcompile.mode=JIT --debug test/test.rb
- Operating system and platform (e.g.
uname -a)
Linux 6.8.0-48-generic #48~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 7 11:24:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Expected Behavior
$ jruby -Xcompile.mode=OFF --debug test/test.rb
jruby 9.4.6.0 (3.1.4) 2024-02-20 576fab2c51 OpenJDK 64-Bit Server VM 23.0.1+8-FR on 23.0.1+8-FR [x86_64-linux]
test/test.rb
14
potato1
potato2
Hello, World!
Correct line is shown (14)
Actual Behavior
$ jruby -Xcompile.mode=JIT --debug test/test.rb
jruby 9.4.6.0 (3.1.4) 2024-02-20 576fab2c51 OpenJDK 64-Bit Server VM 23.0.1+8-FR on 23.0.1+8-FR +jit [x86_64-linux]
test/test.rb
21
potato1
potato2
Hello, World!
Incorrect line is shown (21)
As always, thanks for the amazing work on JRuby, and very looking forward to the next release 🙏
(Also, this doesn't block me at all -- just a see something, say something kinda report! :D )