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

TypeError: debugging with --debug #4706

Closed
jakago opened this issue Jul 6, 2017 · 1 comment
Closed

TypeError: debugging with --debug #4706

jakago opened this issue Jul 6, 2017 · 1 comment

Comments

@jakago
Copy link

jakago commented Jul 6, 2017

main.rb

p JRUBY_VERSION

Environment

jruby 9.1.12.0 (2.3.3) 2017-06-15 33c6439 Java HotSpot(TM) 64-Bit Server VM 24.80-b11 on 1.7.0_80-b15 +jit [darwin-x86_64]

Darwin mac-mini.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan 9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64

Actual Behavior

OK:

% jruby main.rb
"9.1.12.0"

Warning:

% jruby -rdebug main.rb
Debug.rb
Emacs support available.

/Users/xxxxxx/.rbenv/versions/jruby-9.1.12.0/lib/ruby/stdlib/debug.rb:1114: warning: tracing
 (e.g. set_trace_func) will not capture all events without --debug flag
"9.1.12.0"

Error:

% jruby --debug -rdebug main.rb
Debug.rb
Emacs support available.

TypeError: no implicit conversion of Symbol into Integer
                   [] at org/jruby/RubyArray.java:1458
              context at /Users/xxxxxx/.rbenv/versions/jruby-9.1.12.0/lib/ruby/stdlib/debug.rb:982
     block in suspend at /Users/xxxxxx/.rbenv/versions/jruby-9.1.12.0/lib/ruby/stdlib/debug.rb:958
                 each at org/jruby/RubyHash.java:1343
     block in suspend at /Users/xxxxxx/.rbenv/versions/jruby-9.1.12.0/lib/ruby/stdlib/debug.rb:956
          synchronize at org/jruby/ext/thread/Mutex.java:148
              suspend at /Users/xxxxxx/.rbenv/versions/jruby-9.1.12.0/lib/ruby/stdlib/debug.rb:954
          suspend_all at /Users/xxxxxx/.rbenv/versions/jruby-9.1.12.0/lib/ruby/stdlib/debug.rb:237
           trace_func at /Users/xxxxxx/.rbenv/versions/jruby-9.1.12.0/lib/ruby/stdlib/debug.rb:865
  block in DEBUGGER__ at /Users/xxxxxx/.rbenv/versions/jruby-9.1.12.0/lib/ruby/stdlib/debug.rb:1115
               <main> at main.rb:1
@enebo enebo added this to the JRuby 9.2.0.0 milestone Jul 6, 2017
@enebo
Copy link
Member

enebo commented Jul 6, 2017

wowie zowie!!! So glancing at this it would appear in most cases we pass in nothing or just the thread to context but SOMETIMES we pass in [thread, 1]. Very weird. In an award for most esoteric Ruby syntax of 2017 (and believe me I thought I knew pretty much all weird Ruby syntax):

        for th, in @thread_list
          next if th == Thread.current
          context(th).set_suspend
        end

Notice that ','? HAHAH so JRuby does not destructure the array because of that comma and passes the array through as th. It should just pass the first element. Trivial repro:

@t = [[1, 2], [3, 4]]
for th, in @t
   p th
end

@enebo enebo modified the milestones: JRuby 9.1.13.0, JRuby 9.2.0.0 Aug 16, 2017
@enebo enebo closed this as completed in c3a1d6c Aug 16, 2017
enebo added a commit that referenced this issue Aug 16, 2017
This is really about fixing:
```ruby
@t = [[1, 2], [3, 4]]
for th, in @t
   p th
end
```

which stdlib debug happens to use (notice the extra ,).  Spec commit coming
after this one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants