Files
vt1200/harness/mame/hist.lua
T

31 lines
878 B
Lua

-- Dump the debugger's execution history at a chosen frame. This gives the actual
-- instruction stream leading into the stuck loop, including call sites -- i.e.
-- which routine called what, which no amount of static reading has told us.
--
-- HIST_FRAME=300 <mame> vt1200 ... -autoboot_script harness/mame/hist.lua
local machine = manager.machine
local dbg = machine.debugger
if not dbg then
print("ERROR: debugger not enabled; pass -debug")
machine:exit()
return
end
local target = tonumber(os.getenv("HIST_FRAME") or "300")
local path = os.getenv("HIST_OUT")
or "/home/arti/code/k-space/vt1200/harness/mame/hist.txt"
local n = 0
emu.register_frame_done(function()
n = n + 1
if n >= target then
dbg:command("history " .. path)
print("history written to " .. path .. " at frame " .. n)
machine:exit()
end
end, "vt1200-hist")
dbg.execution_state = 'run'