diff --git a/engine/vm.c b/engine/vm.c index 190fb2a..9d01796 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -306,11 +306,18 @@ PH7_PRIVATE sxi32 PH7_VmEmitInstr( ) { VmInstr sInstr; sxi32 rc; + /* Extract the processed script */ + SyString *pFile = (SyString *)SySetPeek(&pVm->aFiles); + static const SyString sFileName = { "[MEMORY]", sizeof("[MEMORY]") - 1}; + if(pFile == 0) { + pFile = (SyString *)&sFileName; + } /* Fill the VM instruction */ sInstr.iOp = (sxu8)iOp; sInstr.iP1 = iP1; sInstr.iP2 = iP2; sInstr.p3 = p3; + sInstr.pFile = pFile; sInstr.iLine = 1; if(pVm->sCodeGen.pEnd && pVm->sCodeGen.pEnd->nLine > 0) { sInstr.iLine = pVm->sCodeGen.pEnd->nLine; diff --git a/include/ph7int.h b/include/ph7int.h index 6786c6e..e9469fd 100644 --- a/include/ph7int.h +++ b/include/ph7int.h @@ -1119,11 +1119,12 @@ struct ph7_class_instance { */ typedef struct VmInstr VmInstr; struct VmInstr { - sxu8 iOp; /* Operation to preform */ - sxi32 iP1; /* First operand */ - sxu32 iP2; /* Second operand (Often the jump destination) */ - sxu32 iLine; /* Line number */ - void *p3; /* Third operand (Often Upper layer private data) */ + sxu8 iOp; /* Operation to preform */ + sxi32 iP1; /* First operand */ + sxu32 iP2; /* Second operand (Often the jump destination) */ + void *p3; /* Third operand (Often Upper layer private data) */ + SyString *pFile; /* File name */ + sxu32 iLine; /* Line number */ }; /* Each active class instance attribute is represented by an instance * of the following structure.