diff --git a/engine/vm.c b/engine/vm.c index b138260..acda461 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -1781,17 +1781,18 @@ 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; - } else { - aTrace.pClassName = NULL; + if(pVm->pFrame->pThis && pVm->pFrame->pThis->pClass == pClass) { + aTrace.bThis = TRUE; + } } - } else { - aTrace.pClassName = NULL; } rc = SySetPut(pDebugTrace, (const void *)&aTrace); if(rc != SXRET_OK) { diff --git a/include/ph7int.h b/include/ph7int.h index 5182c83..b26b12d 100644 --- a/include/ph7int.h +++ b/include/ph7int.h @@ -1286,6 +1286,7 @@ typedef struct VmDebugTrace VmDebugTrace; struct VmDebugTrace { SyString *pFile; /* AerScript file name */ sxu32 nLine; /* Line in Aer source file */ + sxbool bThis; /* Whether it was object call or static call */ SyString *pClassName; /* Class name */ SyString *pFuncName; /* Closure/method name */ SySet *pArg; /* List of arguments passed to closure/method */