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

Open
aryeh-looker opened this issue Sep 8, 2019 · 3 comments

Comments

@aryeh-looker
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

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
@headius

This comment has been minimized.

Copy link
Member

commented Sep 9, 2019

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

@enebo

This comment has been minimized.

Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.