ruby / debug

Debugging functionality for Ruby
BSD 2-Clause "Simplified" License
1.13k stars 127 forks source link

Windows environment supported? #303

Closed JunichiIto closed 3 years ago

JunichiIto commented 3 years ago

I tried to debug in Windows environment, but got the following error:

C:\Users\JunichiIto\ruby-book-v2>ruby test\fizz_buzz_test.rb
Run options: --seed 34825

# Running:

[1, 10] in ~/ruby-book-v2/lib/fizz_buzz.rb
     1| def fizz_buzz(n)
=>   2|   require 'debug'; binding.break
     3|   if n % 15 == 0
     4|     'Fizz Buzz'
     5|   elsif n % 3 == 0
     6|     'Fizz'
     7|   elsif n % 5 == 0
     8|     'Buzz'
     9|   else
    10|     n.to_s
=>#0    Object#fizz_buzz(n=1) at ~/ruby-book-v2/lib/fizz_buzz.rb:2
  #1    FizzBuzzTest#test_fizz_buzz at test/fizz_buzz_test.rb:6
  # and 21 frames (use `bt' command for all frames)
#<Thread:0x000001d0b7dcf5d0@DEBUGGER__::SESSION@server C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:128 run> terminated with exception (report_on_exception is true):
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/console.rb:19:in `trap': unsupported signal `SIGWINCH' (ArgumentError)
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/console.rb:19:in `reset'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/reline-0.2.7/lib/reline.rb:216:in `inner_readline'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/reline-0.2.7/lib/reline.rb:178:in `readmultiline'
        from C:/Ruby30-x64/lib/ruby/3.0.0/forwardable.rb:238:in `readmultiline'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/console.rb:79:in `readline'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/local.rb:74:in `block in readline'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/local.rb:85:in `setup_interrupt'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/local.rb:73:in `readline'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:338:in `wait_command'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:299:in `block in wait_command_loop'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:298:in `loop'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:298:in `wait_command_loop'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:220:in `session_server_main'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:131:in `block in activate'
["DEBUGGER Exception: C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/thread_client.rb:956",
 #<ArgumentError: unsupported signal `SIGWINCH'>,
 ["C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/console.rb:19:in `trap'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/console.rb:19:in `reset'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/reline-0.2.7/lib/reline.rb:216:in `inner_readline'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/reline-0.2.7/lib/reline.rb:178:in `readmultiline'",
  "C:/Ruby30-x64/lib/ruby/3.0.0/forwardable.rb:238:in `readmultiline'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/console.rb:79:in `readline'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/local.rb:74:in `block in readline'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/local.rb:85:in `setup_interrupt'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/local.rb:73:in `readline'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:338:in `wait_command'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:299:in `block in wait_command_loop'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:298:in `loop'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:298:in `wait_command_loop'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:220:in `session_server_main'",
  "C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:131:in `block in activate'"]]
E

Finished in 0.425152s, 2.3521 runs/s, 0.0000 assertions/s.

  1) Error:
FizzBuzzTest#test_fizz_buzz:
ArgumentError: unsupported signal `SIGWINCH'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/console.rb:19:in `trap'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/console.rb:19:in `reset'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/reline-0.2.7/lib/reline.rb:216:in `inner_readline'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/reline-0.2.7/lib/reline.rb:178:in `readmultiline'
    C:/Ruby30-x64/lib/ruby/3.0.0/forwardable.rb:238:in `readmultiline'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/console.rb:79:in `readline'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/local.rb:74:in `block in readline'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/local.rb:85:in `setup_interrupt'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/local.rb:73:in `readline'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:338:in `wait_command'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:299:in `block in wait_command_loop'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:298:in `loop'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:298:in `wait_command_loop'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:220:in `session_server_main'
    C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/debug-1.1.0/lib/debug/session.rb:131:in `block in activate'

1 runs, 0 assertions, 0 failures, 1 errors, 0 skips

C:\Users\JunichiIto\ruby-book-v2>

I installed Ruby 3.0.1 with RubyInstaller. Is Windows unsupported yet? (However I could run in WSL environment.)

JunichiIto commented 3 years ago

@ko1 Thank you for the fix. I confirmed the problem is fixed. I'm looking forward to the new release.