Skip to content

Commit 5750931

Browse files
author
Ruby
committed
support config.rdbgInitialScripts
for future extensions. And rename: * `load_rdbgExtension` -> `load_extensions` * `config.rdbgExtension` -> `config.rdbgExtensions`
1 parent 3becfa1 commit 5750931

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

lib/debug/server_dap.rb

+15-4
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,23 @@ def recv_request
274274
retry
275275
end
276276

277-
def load_rdbgExtension req
278-
if exts = req.dig('arguments', 'rdbgExtension')
277+
def load_extensions req
278+
if exts = req.dig('arguments', 'rdbgExtensions')
279279
exts.each{|ext|
280280
require_relative "dap_custom/#{File.basename(ext)}"
281281
}
282282
end
283+
284+
if scripts = req.dig('arguments', 'rdbgInitialScripts')
285+
scripts.each do |script|
286+
begin
287+
eval(script)
288+
rescue Exception => e
289+
puts e.message
290+
puts e.backtrace.inspect
291+
end
292+
end
293+
end
283294
end
284295

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

306-
load_rdbgExtension req
317+
load_extensions req
307318

308319
when 'attach'
309320
send_response req
@@ -315,7 +326,7 @@ def process_request req
315326
@nonstop = false
316327
end
317328

318-
load_rdbgExtension req
329+
load_extensions req
319330

320331
when 'configurationDone'
321332
send_response req

0 commit comments

Comments
 (0)