mdb runner/parser WIP

Do I continue like this? or just integrate the mdb runner itself into
luadebug?
This commit is contained in:
2025-10-26 16:30:57 +01:00
parent 92fd3cabf8
commit 349cbc8175
4 changed files with 168 additions and 46 deletions

View File

@ -49,6 +49,7 @@ local debugger = {
runner = runner, -- Set here as member to let runners extend this base class
debugwindow = nil, ---@type JPDebugView
debugrunner = nil, ---@type runner|nil
state = "idle",
}
function debugger.log(msg)
@ -73,9 +74,18 @@ function debugger.is_running()
return debugger.debugrunner~=nil
end
function debugger.on_state(state)
debugger.log(string.format("state %s -> %s", debugger.state, state))
debugger.state = state
end
function debugger.run(target, name, r, view)
if debugger.debugrunner then
debugger.error("Already an active session")
if debugger.state == "paused" then
debugger.debugrunner:continue()
else
debugger.error("Already an active session")
end
return
end
debugger.debugwindow = view
@ -90,6 +100,11 @@ function debugger.run(target, name, r, view)
on_stdout = debugger.on_stdout,
on_stderr = debugger.on_stderr,
on_exit = debugger.on_exit,
on_state = debugger.on_state,
on_break = function(file, line, reason)
debugger.log(string.format("breakpoint hit: %s:%d", file, line))
end,
})
-- And run
debugger.debugrunner:run(target, name)
@ -104,11 +119,13 @@ function debugger.stop()
debugger.log(string.format("... Stoped with exit code %d", exitcode))
end
debugger.debugrunner = nil
debugger.on_state('idle')
end
function debugger.on_exit(exitcode)
debugger.log(string.format("exit: %d", exitcode))
debugger.debugrunner = nil
debugger.on_state('idle')
end
return debugger