[ruby/irb] Avoid locking the debug UI to a single thread
(https://github.com/ruby/irb/pull/725) Since `debug` stores and updates the target thread via its Session's `@tc` variable, we don't need to and shouldn't lock the UI to the thread that activates the integration. https://github.com/ruby/irb/commit/202efdbf0c
This commit is contained in:
parent
380c25f89f
commit
cc311e1c45
@ -32,17 +32,14 @@ module IRB
|
|||||||
end
|
end
|
||||||
DEBUGGER__::CONFIG.set_config
|
DEBUGGER__::CONFIG.set_config
|
||||||
configure_irb_for_debugger(irb)
|
configure_irb_for_debugger(irb)
|
||||||
thread = Thread.current
|
|
||||||
|
|
||||||
DEBUGGER__.initialize_session{ IRB::Debug::UI.new(thread, irb) }
|
DEBUGGER__.initialize_session{ IRB::Debug::UI.new(irb) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# When debug session was previously started but not by IRB
|
# When debug session was previously started but not by IRB
|
||||||
if defined?(DEBUGGER__::SESSION) && !irb.context.with_debugger
|
if defined?(DEBUGGER__::SESSION) && !irb.context.with_debugger
|
||||||
configure_irb_for_debugger(irb)
|
configure_irb_for_debugger(irb)
|
||||||
thread = Thread.current
|
DEBUGGER__::SESSION.reset_ui(IRB::Debug::UI.new(irb))
|
||||||
|
|
||||||
DEBUGGER__::SESSION.reset_ui(IRB::Debug::UI.new(thread, irb))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Apply patches to debug gem so it skips IRB frames
|
# Apply patches to debug gem so it skips IRB frames
|
||||||
|
@ -4,8 +4,7 @@ require 'debug/console'
|
|||||||
module IRB
|
module IRB
|
||||||
module Debug
|
module Debug
|
||||||
class UI < DEBUGGER__::UI_Base
|
class UI < DEBUGGER__::UI_Base
|
||||||
def initialize(thread, irb)
|
def initialize(irb)
|
||||||
@thread = thread
|
|
||||||
@irb = irb
|
@irb = irb
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -56,7 +55,7 @@ module IRB
|
|||||||
|
|
||||||
def readline _
|
def readline _
|
||||||
setup_interrupt do
|
setup_interrupt do
|
||||||
tc = DEBUGGER__::SESSION.get_thread_client(@thread)
|
tc = DEBUGGER__::SESSION.instance_variable_get(:@tc)
|
||||||
cmd = @irb.debug_readline(tc.current_frame.binding || TOPLEVEL_BINDING)
|
cmd = @irb.debug_readline(tc.current_frame.binding || TOPLEVEL_BINDING)
|
||||||
|
|
||||||
case cmd
|
case cmd
|
||||||
|
Loading…
x
Reference in New Issue
Block a user