Implement default debugger REPL loop

This commit is contained in:
Gabriel Tofvesson 2024-11-30 00:20:10 +01:00
parent 98018e4a8c
commit 3d293d3e68

View File

@ -43,4 +43,18 @@ local function debugREPL(onResult, debugArgs)
return success, (not success and retval) or nil
end
return { debugREPL = debugREPL, execDebug = execDebug }
local function hookDebugger(context, Logger)
Logger = Logger or require("logging").getGlobalLogger()
local result, retval
repeat
result, retval = debugREPL(function(r)
Logger:error("->", r)
end, context)
if not result then
Logger:error("x>", retval)
end
until result
end
return { debugREPL = debugREPL, execDebug = execDebug, hookDebugger = hookDebugger }