Skip to content

Debugger raises an exception in VSCode when it stops at exception #434

@ono-max

Description

@ono-max

Your environment

$ ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]

Describe the bug

$ exe/rdbg ../target.rb --open=vscode
DEBUGGER: Debugger can attach via UNIX domain socket (/var/folders/kv/w1k6nh1x5fl7vx47b2pd005w0000gn/T/ruby-debug-sock-501/ruby-debug-naotto-18645)
DEBUGGER: wait for debugger connection...
Launching: code /var/folders/kv/w1k6nh1x5fl7vx47b2pd005w0000gn/T/ruby-debug-vscode-20211212-18645-1yffto3/ /var/folders/kv/w1k6nh1x5fl7vx47b2pd005w0000gn/T/ruby-debug-vscode-20211212-18645-1yffto3/README.rb
DEBUGGER: Connected.
["DEBUGGER Exception: /Users/naotto/workspace/debug/lib/debug/thread_client.rb:982",
 #<NoMethodError: undefined method `local_variable_defined?' for nil:NilClass>,
 ["/Users/naotto/workspace/debug/lib/debug/thread_client.rb:443:in `block in special_local_variables'",
  "/Users/naotto/workspace/debug/lib/debug/thread_client.rb:441:in `each'",
  "/Users/naotto/workspace/debug/lib/debug/thread_client.rb:441:in `special_local_variables'",
  "/Users/naotto/workspace/debug/lib/debug/server_dap.rb:583:in `process_dap'",
  "/Users/naotto/workspace/debug/lib/debug/thread_client.rb:971:in `wait_next_action_'",
  "/Users/naotto/workspace/debug/lib/debug/thread_client.rb:672:in `wait_next_action'",
  "/Users/naotto/workspace/debug/lib/debug/thread_client.rb:279:in `suspend'",
  "/Users/naotto/workspace/debug/lib/debug/thread_client.rb:217:in `on_breakpoint'",
  "/Users/naotto/workspace/debug/lib/debug/breakpoint.rb:63:in `suspend'",
  "/Users/naotto/workspace/debug/lib/debug/breakpoint.rb:299:in `block in setup'",
  "../target.rb:8:in `/'",
  "../target.rb:8:in `bar'",
  "../target.rb:2:in `foo'",
  "../target.rb:11:in `<main>'"]]
DEBUGGER: **Disconnected.**

To Reproduce

  1. Check rescue any exception
  2. Push "Continue" button.
  3. It raise an exception when I try to see "Variables" tab.
def foo
  bar
rescue ZeroDivisionError
  raise
end

def bar
  1/0
end

foo

Expected behavior
It should not raise an exception.

Additional context
This bug also occurs in Chrome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions