Skip to content

Commit

Permalink
support config.rdbgInitialScripts
Browse files Browse the repository at this point in the history
for future extensions.

And rename:

* `load_rdbgExtension` -> `load_extensions`
* `config.rdbgExtension` -> `config.rdbgExtensions`
  • Loading branch information
Ruby committed May 8, 2023
1 parent 3becfa1 commit 5750931
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/debug/server_dap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,23 @@ def recv_request
retry
end

def load_rdbgExtension req
if exts = req.dig('arguments', 'rdbgExtension')
def load_extensions req
if exts = req.dig('arguments', 'rdbgExtensions')
exts.each{|ext|
require_relative "dap_custom/#{File.basename(ext)}"
}
end

if scripts = req.dig('arguments', 'rdbgInitialScripts')
scripts.each do |script|
begin
eval(script)
rescue Exception => e
puts e.message
puts e.backtrace.inspect
end
end
end
end

def process
Expand All @@ -303,7 +314,7 @@ def process_request req
UI_DAP.local_fs_map_set req.dig('arguments', 'localfs') || req.dig('arguments', 'localfsMap') || true
@nonstop = true

load_rdbgExtension req
load_extensions req

when 'attach'
send_response req
Expand All @@ -315,7 +326,7 @@ def process_request req
@nonstop = false
end

load_rdbgExtension req
load_extensions req

when 'configurationDone'
send_response req
Expand Down

0 comments on commit 5750931

Please sign in to comment.