Enable debugging.
所有检测均成功
The build was successful.

This commit introduces ne debug feature. The PH7 Engine limits the VM dump to the global scope. Since Aer Script is fully object-oriented language the dump option contains only information about last call of OP_DONE. This change,
forces the VM to store all instructions set in a global container when debugging is enabled, thus providing information the dump of whole script parse.
这个提交包含在:
Rafal Kupiec 2018-08-26 19:59:17 +02:00
父节点 ab5ee94f99
当前提交 178f3820f6
签署人:: belliash
GPG 密钥 ID: 4E829243E0CFE6B4
共有 2 个文件被更改,包括 15 次插入2 次删除

查看文件

@ -319,6 +319,10 @@ PH7_PRIVATE sxi32 PH7_VmEmitInstr(
/* Instruction index in the bytecode array */
*pIndex = SySetUsed(pVm->pByteContainer);
}
if(pVm->bDebug) {
/* Record instruction in debug container */
SySetPut(&pVm->aInstrSet, (void *)&sInstr);
}
/* Finally,record the instruction */
rc = SySetPut(pVm->pByteContainer, (const void *)&sInstr);
if(rc != SXRET_OK) {
@ -981,6 +985,10 @@ PH7_PRIVATE sxi32 PH7_VmInit(
SyStringInitFromBuf(&sBuiltin, PH7_BUILTIN_LIB, sizeof(PH7_BUILTIN_LIB) - 1);
/* Precompile the built-in library */
VmEvalChunk(&(*pVm), 0, &sBuiltin, PH7_AERSCRIPT_CODE);
/* Initialize instructions debug container */
if(pVm->bDebug) {
SySetInit(&pVm->aInstrSet, &pVm->sAllocator, sizeof(VmInstr));
}
/* Reset the code generator */
PH7_ResetCodeGenerator(&(*pVm), pEngine->xConf.xErr, pEngine->xConf.pErrData);
return SXRET_OK;
@ -5756,7 +5764,10 @@ PH7_PRIVATE sxi32 PH7_VmDump(
void *pUserData /* Last argument to xConsumer() */
) {
sxi32 rc;
rc = VmByteCodeDump(pVm->pByteContainer, xConsumer, pUserData);
if(!pVm->bDebug) {
return SXRET_OK;
}
rc = VmByteCodeDump(&pVm->aInstrSet, xConsumer, pUserData);
return rc;
}
/*

查看文件

@ -1199,6 +1199,7 @@ struct ph7_vm {
SyMutex *pMutex; /* Recursive mutex associated with VM. */
#endif
ph7 *pEngine; /* Interpreter that own this VM */
SySet aInstrSet; /* Instructions debug container */
SySet aByteCode; /* Default bytecode container */
SySet *pByteContainer; /* Current bytecode container */
VmFrame *pFrame; /* Stack of active frames */
@ -1232,7 +1233,8 @@ struct ph7_vm {
void *pStdin; /* STDIN IO stream */
void *pStdout; /* STDOUT IO stream */
void *pStderr; /* STDERR IO stream */
int bErrReport; /* TRUE to report all runtime Error/Warning/Notice */
sxbool bDebug; /* TRUE to enable debugging */
sxbool bErrReport; /* TRUE to report all runtime Error/Warning/Notice */
int nRecursionDepth; /* Current recursion depth */
int nMaxDepth; /* Maximum allowed recursion depth */
int nObDepth; /* OB depth */