vm_exec: Add debugger hooks for instruction execution events

This commit is contained in:
nikitalita 2025-03-02 15:56:33 -08:00
parent a5a311bf0b
commit a9ee0b7da3
2 changed files with 8 additions and 2 deletions

View file

@ -43,6 +43,7 @@
#include "basics.h"
#include "texturemanager.h"
#include "palutil.h"
#include "common/scripting/dap/RuntimeEvents.h"
extern cycle_t VMCycles[10];
extern int VMCalls[10];
@ -63,7 +64,7 @@ void ThrowVMException(VMException *x);
#if COMPGOTO
#define OP(x) x
#define NEXTOP do { pc++; unsigned op = pc->op; a = pc->a; goto *ops[op]; } while(0)
#define NEXTOP do { pc++; DebugServer::RuntimeEvents::EmitInstructionExecutionEvent(stack, ret, numret, pc); unsigned op = pc->op; a = pc->a; goto *ops[op]; } while(0)
#else
#define OP(x) case OP_##x
#define NEXTOP pc++; break

View file

@ -71,7 +71,9 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
{
#if !COMPGOTO
VM_UBYTE op;
for(;;) switch(op = pc->op, a = pc->a, op)
for(;;) {
DebugServer::RuntimeEvents::EmitInstructionExecutionEvent(stack, ret, numret, pc);
switch(op = pc->op, a = pc->a, op)
#else
pc--;
NEXTOP;
@ -1951,6 +1953,9 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
NEXTOP;
}
}
#if !COMPGOTO
}
#endif
#if 0
catch(VMException *exception)
{