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

Invalid Tracepoint Behavior for Blocks #5859

Closed
aryeh-looker opened this issue Sep 8, 2019 · 4 comments
Closed

Invalid Tracepoint Behavior for Blocks #5859

aryeh-looker opened this issue Sep 8, 2019 · 4 comments
Milestone

Comments

@aryeh-looker
Copy link
Contributor

@aryeh-looker aryeh-looker commented Sep 8, 2019

Environment

  • jruby 9.2.8.0 (2.5.3) 2019-08-12 a1ac7ff Java HotSpot(TM) 64-Bit Server VM 25.221-b11 on 1.8.0_221-b11 +jit [darwin-x86_64]
  • Darwin MacBook-Pro.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

Script Under Test

$ cat test.rb 
TracePoint.trace(:b_call) { puts 'called' }
do_thing = proc { puts 'thing done' }
do_thing[]

Behavior Under MRI

$ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
$ ruby test.rb 
called
thing done

Behavior under JRuby 9.2.8.0

$ ruby --version
jruby 9.2.8.0 (2.5.3) 2019-08-12 a1ac7ff Java HotSpot(TM) 64-Bit Server VM 25.221-b11 on 1.8.0_221-b11 +jit [darwin-x86_64]
$ JRUBY_OPTS="--debug" ruby test.rb 
thing done
@aryeh-looker
Copy link
Contributor Author

@aryeh-looker aryeh-looker commented Sep 8, 2019

Looks like not specifying an event name or using :line could be a sound workaround for some use-cases:

$ cat test.rb 
TracePoint.trace { |tp| puts [tp.event, tp.lineno].inspect }        # 1
do_thing = proc { puts 'thing done' }                               # 2
do_thing[]                                                          # 3
$ JRUBY_OPTS="--debug" ruby test.rb 
[:line, 1]
[:line, 2]
[:line, 1]
thing done

Loading

@headius
Copy link
Member

@headius headius commented Sep 9, 2019

Looks like we are missing a :b_call event along some path. Probably an easy fix.

Loading

@enebo
Copy link
Member

@enebo enebo commented Sep 9, 2019

@aryeh-looker :line itself appears to be an off by one bug and I don't actually see any place we emit b_call (although we do have it defined). So two bugs found!

Loading

@enebo enebo added this to the JRuby 9.2.9.0 milestone Sep 25, 2019
@enebo
Copy link
Member

@enebo enebo commented Sep 30, 2019

I fixed a serious of problems with TracePoint including fixing line numbers being +1 and also b_call.

@aryeh-looker you should see a lot more events now with a default trace. We were erroneously only emitting :line as a default before.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants