Allow to enable or disable debugging.
Some checks reported errors
The build has failed.

This commit is contained in:
2018-08-27 19:53:24 +02:00
parent c8e2dccbeb
commit 349bbed774
4 changed files with 11 additions and 9 deletions

View File

@@ -628,8 +628,9 @@ int ph7_release(ph7 *pEngine) {
return rc;
}
int ph7_vm_init(
ph7 *pEngine, /* Running PH7 engine */
ph7_vm **ppOutVm /* OUT: A pointer to the virtual machine */
ph7 *pEngine, /* Running PH7 engine */
ph7_vm **ppOutVm, /* OUT: A pointer to the virtual machine */
sxbool bDebug /* VM Debugging */
) {
ph7_vm *pVm;
int rc;
@@ -647,7 +648,7 @@ int ph7_vm_init(
return PH7_NOMEM;
}
/* Initialize the Virtual Machine */
rc = PH7_VmInit(pVm, &(*pEngine));
rc = PH7_VmInit(pVm, &(*pEngine), bDebug);
if(rc != PH7_OK) {
SyMemBackendPoolFree(&pEngine->sAllocator, pVm);
if(ppOutVm) {

View File

@@ -896,8 +896,9 @@ static sxi32 VmEvalChunk(ph7_vm *pVm, ph7_context *pCtx, SyString *pChunk, int i
* start compiling the target PHP program.
*/
PH7_PRIVATE sxi32 PH7_VmInit(
ph7_vm *pVm, /* Initialize this */
ph7 *pEngine /* Master engine */
ph7_vm *pVm, /* Initialize this */
ph7 *pEngine, /* Master engine */
sxbool bDebug /* Debugging */
) {
SyString sBuiltin;
ph7_value *pObj;
@@ -993,8 +994,8 @@ PH7_PRIVATE sxi32 PH7_VmInit(
/* Precompile the built-in library */
VmEvalChunk(&(*pVm), 0, &sBuiltin, PH7_AERSCRIPT_CODE);
/* Initialize instructions debug container */
pVm->bDebug = TRUE;
if(pVm->bDebug) {
if(bDebug) {
pVm->bDebug = TRUE;
SySetInit(&pVm->aInstrSet, &pVm->sAllocator, sizeof(VmInstr));
}
/* Reset the code generator */