forked from arti/vt1200
dwt: visual injection experiments via the returning rdebug jump
This commit is contained in:
1 parent
1e5c095b72
commit
05f1895bf5
80 files changed
+3252
No files matched your search
@@ -0,0 +1,40 @@
|
||||
-- probe_hook.lua -- investigation only: log the DI hook stages of blinkpc.
|
||||
-- Sets breakpoints at entry / ret_hook / the stock OS handler after the hook is
|
||||
-- installed, prints PC/SP/ST, and resumes. Never writes memory.
|
||||
local machine = manager.machine
|
||||
local cpu = machine.devices[':maincpu']
|
||||
local dbg = machine.debugger
|
||||
if not dbg then print("ERROR: no debugger"); machine:exit(); return end
|
||||
local ARM = tonumber(os.getenv("HOOK_ARM") or "3450")
|
||||
local STOP = tonumber(os.getenv("HOOK_STOP") or "3520")
|
||||
local f = 0
|
||||
local armed = false
|
||||
local clock = os.getenv("FRAME_CLOCK")
|
||||
|
||||
local function bp(addr, tag)
|
||||
dbg:command(string.format(
|
||||
'bpset %s,,{ printf "HOOK %s pc=%%08X sp=%%08X st=%%08X a0=%%08X\\n", pc, sp, st, a0 ; g }',
|
||||
addr, tag))
|
||||
end
|
||||
|
||||
emu.register_frame_done(function()
|
||||
f = f + 1
|
||||
if clock then
|
||||
local fh = io.open(clock, "w")
|
||||
if fh then fh:write(f .. "\n"); fh:close() end
|
||||
end
|
||||
if f == ARM and not armed then
|
||||
armed = true
|
||||
bp("1840190", "ENTRY")
|
||||
bp("18402d0", "RET")
|
||||
bp("3f7146d0", "OSH")
|
||||
print(string.format("probe_hook: armed at frame %d", f))
|
||||
end
|
||||
if f >= STOP then
|
||||
print("probe_hook: stopping")
|
||||
machine:exit()
|
||||
end
|
||||
end, "vt1200-probe-hook")
|
||||
|
||||
dbg.visible_cpu = cpu
|
||||
dbg.execution_state = 'run'
|
||||
Reference in new issue
Block a user