diff --git a/lib/debug/thread_client.rb b/lib/debug/thread_client.rb index 6f9da4af1..332e50cb8 100644 --- a/lib/debug/thread_client.rb +++ b/lib/debug/thread_client.rb @@ -5,6 +5,10 @@ require_relative 'color' +class ::Thread + attr_accessor :debug_thread_client +end + module DEBUGGER__ M_INSTANCE_VARIABLES = method(:instance_variables).unbind M_INSTANCE_VARIABLE_GET = method(:instance_variable_get).unbind @@ -48,12 +52,7 @@ def safe_global_variables class ThreadClient def self.current - if thc = Thread.current[:DEBUGGER__ThreadClient] - thc - else - thc = SESSION.get_thread_client - Thread.current[:DEBUGGER__ThreadClient] = thc - end + Thread.current.debug_thread_client ||= SESSION.get_thread_client end include Color @@ -862,8 +861,22 @@ def make_breakpoint args class SuspendReplay < Exception end + if ::Fiber.respond_to?(:blocking) + private def fiber_blocking + ::Fiber.blocking{yield} + end + elsif ::Fiber.method_defined?(:blocking?) + private def fiber_blocking + ::Fiber.new(blocking: true){yield}.resume + end + else + private def fiber_blocking + yield + end + end + def wait_next_action - wait_next_action_ + fiber_blocking{wait_next_action_} rescue SuspendReplay replay_suspend end diff --git a/test/support/cdp_utils.rb b/test/support/cdp_utils.rb index 144904eab..a6c927c64 100644 --- a/test/support/cdp_utils.rb +++ b/test/support/cdp_utils.rb @@ -63,7 +63,7 @@ def connect_to_cdp_server MSG end - TIMEOUT_SEC = (ENV['RUBY_DEBUG_TIMEOUT_SEC'] || 10).to_i + TIMEOUT_SEC = (ENV['RUBY_DEBUG_TIMEOUT_SEC'] || 30).to_i HOST = '127.0.0.1' def run_cdp_scenario program, &msgs diff --git a/test/support/dap_utils.rb b/test/support/dap_utils.rb index 634f70792..69c305c2f 100644 --- a/test/support/dap_utils.rb +++ b/test/support/dap_utils.rb @@ -96,7 +96,7 @@ def connect_to_dap_server test_info sock end - TIMEOUT_SEC = (ENV['RUBY_DEBUG_TIMEOUT_SEC'] || 10).to_i + TIMEOUT_SEC = (ENV['RUBY_DEBUG_TIMEOUT_SEC'] || 30).to_i def run_dap_scenario program, &msgs begin diff --git a/test/support/protocol_test_case.rb b/test/support/protocol_test_case.rb index 902955c0d..71cf11a05 100644 --- a/test/support/protocol_test_case.rb +++ b/test/support/protocol_test_case.rb @@ -644,7 +644,7 @@ def send **kw end end - TIMEOUT_SEC = (ENV['RUBY_DEBUG_TIMEOUT_SEC'] || 10).to_i + TIMEOUT_SEC = (ENV['RUBY_DEBUG_TIMEOUT_SEC'] || 30).to_i def assert_dap_response expected_def, result_res return unless defined? DAP_HASH diff --git a/test/support/test_case.rb b/test/support/test_case.rb index fae5b9f58..0704a4bb2 100644 --- a/test/support/test_case.rb +++ b/test/support/test_case.rb @@ -96,7 +96,7 @@ def debug_print msg RUBY = ENV['RUBY'] || RbConfig.ruby RDBG_EXECUTABLE = "#{RUBY} #{__dir__}/../../exe/rdbg" - TIMEOUT_SEC = (ENV['RUBY_DEBUG_TIMEOUT_SEC'] || 10).to_i + TIMEOUT_SEC = (ENV['RUBY_DEBUG_TIMEOUT_SEC'] || 30).to_i def get_target_ui ENV['RUBY_DEBUG_TEST_UI']