From faca9b7fb2fb581c390a8ae3b188b769ac7f038e Mon Sep 17 00:00:00 2001 From: belliash Date: Fri, 14 Sep 2018 22:22:37 +0200 Subject: [PATCH] Another fix in debug trace. --- engine/vm.c | 30 ++++++++++++++++-------------- include/ph7int.h | 4 ++-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/engine/vm.c b/engine/vm.c index 983a827..cb34d27 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -1733,22 +1733,24 @@ PH7_PRIVATE sxi32 VmExtractDebugTrace(ph7_vm *pVm, SySet *pDebugTrace) { break; } } - aTrace.pClassName = NULL; - aTrace.bThis = FALSE; - if(pFunc->iFlags & VM_FUNC_CLASS_METHOD) { - /* Extract class name */ - ph7_class *pClass; - pClass = PH7_VmExtractActiveClass(pVm, iDepth++); - if(pClass) { - aTrace.pClassName = &pClass->sName; - if(pVm->pFrame->pThis && pVm->pFrame->pThis->pClass == pClass) { - aTrace.bThis = TRUE; + if(aTrace.pFile) { + aTrace.pClassName = NULL; + aTrace.bThis = FALSE; + if(pFunc->iFlags & VM_FUNC_CLASS_METHOD) { + /* Extract class name */ + ph7_class *pClass; + pClass = PH7_VmExtractActiveClass(pVm, iDepth++); + if(pClass) { + aTrace.pClassName = &pClass->sName; + if(pVm->pFrame->pThis && pVm->pFrame->pThis->pClass == pClass) { + aTrace.bThis = TRUE; + } } } - } - rc = SySetPut(pDebugTrace, (const void *)&aTrace); - if(rc != SXRET_OK) { - break; + rc = SySetPut(pDebugTrace, (const void *)&aTrace); + if(rc != SXRET_OK) { + break; + } } } /* Roll frame */ diff --git a/include/ph7int.h b/include/ph7int.h index f85225c..b60de17 100644 --- a/include/ph7int.h +++ b/include/ph7int.h @@ -1231,7 +1231,7 @@ struct ph7_vm { int nMaxDepth; /* Maximum allowed recursion depth */ int nExceptDepth; /* Exception depth */ int closure_cnt; /* Loaded closures counter */ - int json_rc; /* JSON return status [refer to json_encode()/json_decode()]*/ + int json_rc; /* JSON return status [refer to json_encode()/json_decode()] */ ph7_output_consumer sVmConsumer; /* Registered output consumer callback */ int iAssertFlags; /* Assertion flags */ ph7_value sAssertCallback; /* Callback to call on failed assertions */ @@ -1258,7 +1258,7 @@ struct VmFrame { SyHash hVar; /* Variable hashtable for fast lookup */ SySet sArg; /* Function arguments container */ SySet sRef; /* Local reference table (VmSlot instance) */ - sxi32 iFlags; /* Frame configuration flags (See below)*/ + sxi32 iFlags; /* Frame configuration flags (See below) */ sxu32 iExceptionJump; /* Exception jump destination */ }; #define VM_FRAME_EXCEPTION 0x01 /* Special Exception frame */