Skip to content
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
26 changes: 19 additions & 7 deletions lib/debug/server_dap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ def dap_setup bytes
end

def send **kw
kw[:seq] = @seq += 1
str = JSON.dump(kw)
@sock.write "Content-Length: #{str.bytesize}\r\n\r\n#{str}"
show_protocol '<', str
if sock = @sock
kw[:seq] = @seq += 1
str = JSON.dump(kw)
sock.write "Content-Length: #{str.bytesize}\r\n\r\n#{str}"
show_protocol '<', str
end
end

def send_response req, success: true, message: nil, **kw
Expand Down Expand Up @@ -319,11 +321,21 @@ def process
send_response req, breakpoints: filters

when 'disconnect'
if args.fetch("terminateDebuggee", false)
@q_msg << 'kill!'
terminate = args.fetch("terminateDebuggee", false)

if SESSION.in_subsession?
if terminate
@q_msg << 'kill!'
else
@q_msg << 'continue'
end
else
@q_msg << 'continue'
if terminate
@q_msg << 'kill!'
pause
end
end

send_response req

## control
Expand Down