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

reset_ui needs ui.activate #825

Merged
merged 1 commit into from
Nov 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 18 additions & 32 deletions lib/debug/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ def deactivate
def reset_ui ui
@ui.deactivate
@ui = ui

# activate new ui
@tp_thread_begin.disable
@ui.activate self
if @ui.respond_to?(:reader_thread) && thc = get_thread_client(@ui.reader_thread)
thc.mark_as_management
end
@tp_thread_begin.enable
end

def pop_event
Expand Down Expand Up @@ -1026,21 +1034,23 @@ def register_default_command
register_command 'open' do |arg|
case arg&.downcase
when '', nil
repl_open
when 'vscode'
repl_open_vscode
when /\A(.+):(\d+)\z/
repl_open_tcp $1, $2.to_i
::DEBUGGER__.open nonstop: true
when /\A(\d+)z/
repl_open_tcp nil, $1.to_i
::DEBUGGER__.open_tcp host: nil, port: $1.to_i, nonstop: true
when /\A(.+):(\d+)\z/
::DEBUGGER__.open_tcp host: $1, port: $2.to_i, nonstop: true
when 'tcp'
repl_open_tcp CONFIG[:host], (CONFIG[:port] || 0)
::DEBUGGER__.open_tcp host: CONFIG[:host], port: (CONFIG[:port] || 0), nonstop: true
when 'vscode'
CONFIG[:open_frontend] = 'vscode'
::DEBUGGER__.open nonstop: true
when 'chrome', 'cdp'
CONFIG[:open_frontend] = 'chrome'
repl_open_tcp CONFIG[:host], (CONFIG[:port] || 0)
::DEBUGGER__.open_tcp host: CONFIG[:host], port: (CONFIG[:port] || 0), nonstop: true
else
raise "Unknown arg: #{arg}"
end

:retry
end

Expand Down Expand Up @@ -1097,30 +1107,6 @@ def process_command line
return :retry
end

def repl_open_setup
@tp_thread_begin.disable
@ui.activate self
if @ui.respond_to?(:reader_thread) && thc = get_thread_client(@ui.reader_thread)
thc.mark_as_management
end
@tp_thread_begin.enable
end

def repl_open_tcp host, port, **kw
DEBUGGER__.open_tcp host: host, port: port, nonstop: true, **kw
repl_open_setup
end

def repl_open
DEBUGGER__.open nonstop: true
repl_open_setup
end

def repl_open_vscode
CONFIG[:open_frontend] = 'vscode'
repl_open
end

def step_command type, arg
if type == :until
leave_subsession [:step, type, arg]
Expand Down