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

IRB with tracer flag is not working #5595

Closed
Adithya-copart opened this Issue Feb 6, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@Adithya-copart
Copy link

commented Feb 6, 2019

Environment

  • jruby 9.2.6.0-SNAPSHOT (2.5.3) 2019-02-06 c498366 Java HotSpot(TM) 64-Bit Server VM 25.191-b12 on 1.8.0_191-b12 +jit [darwin-x86_64]
  • Darwin MB-ADPENTELA.local 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64

Expected Behavior

$ irb --tracer
2.5.1 :001 > 

Actual Behavior

$ irb --tracer
ArgumentError: tried to create Proc object without a block
               proc at org/jruby/RubyKernel.java:1392
         add_filter at /Users/adpentela/.rvm/rubies/jruby-head/lib/ruby/stdlib/tracer.rb:263
  initialize_tracer at /Users/adpentela/.rvm/rubies/jruby-head/lib/ruby/stdlib/irb/ext/tracer.rb:19
       <module:IRB> at /Users/adpentela/.rvm/rubies/jruby-head/lib/ruby/stdlib/irb/ext/tracer.rb:70
             <main> at /Users/adpentela/.rvm/rubies/jruby-head/lib/ruby/stdlib/irb/ext/tracer.rb:14
            require at org/jruby/RubyKernel.java:984
             (root) at /Users/adpentela/.rvm/rubies/jruby-head/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
            require at /Users/adpentela/.rvm/rubies/jruby-head/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
        use_tracer= at /Users/adpentela/.rvm/rubies/jruby-head/lib/ruby/stdlib/irb/extend-command.rb:241
         initialize at /Users/adpentela/.rvm/rubies/jruby-head/lib/ruby/stdlib/irb/context.rb:46
         initialize at /Users/adpentela/.rvm/rubies/jruby-head/lib/ruby/stdlib/irb.rb:410
             <main> at /Users/adpentela/.rvm/rubies/jruby-head/bin/irb:13

I was playing with the --tracer flag in MRI and tried it in JRuby which failed with the following error.

@enebo

This comment has been minimized.

Copy link
Member

commented Feb 6, 2019

This is fixed by #5596. Be aware you need to pass --debug to jruby to run tracer:

jruby --debug -S irb --trace

@enebo enebo closed this Feb 6, 2019

@Adithya-copart

This comment has been minimized.

Copy link
Author

commented Feb 7, 2019

Thanks for the fix.
It works as expected with jruby --debug -S irb --tracer

@headius

This comment has been minimized.

Copy link
Member

commented Feb 7, 2019

This was fixed a different way in 9dd7241.

The proc behavior here became a feature in Ruby largely by accident, or in response to the lack of syntax for capturing the current block (def foo(&block)). With that syntax added, and given the desire to reduce the number of methods that have "special" visibility into the caller's scope, we do not support calling proc without a block of some kind.

@headius

This comment has been minimized.

Copy link
Member

commented Feb 7, 2019

Link #3915 and #4456.

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