From d0b0a416d04e2adf4696598e41887686e8650c4b Mon Sep 17 00:00:00 2001 From: belliash Date: Mon, 27 Aug 2018 12:36:21 +0200 Subject: [PATCH] Allow to dump last frame only. --- engine/vm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engine/vm.c b/engine/vm.c index be92e29..1edfdb8 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -1773,7 +1773,7 @@ static const char *VmInstrToString(sxi32 nOp); /* * This routine is used to dump the debug stacktrace based on all active frames. */ -PH7_PRIVATE sxi32 VmExtractDebugTrace(ph7_vm *pVm, SySet *pDebugTrace) { +PH7_PRIVATE sxi32 VmExtractDebugTrace(ph7_vm *pVm, SySet *pDebugTrace, sxbool bAllFrames) { sxi32 iDepth = 0; sxi32 rc = SXRET_OK; /* Initialize the container */ @@ -1812,6 +1812,9 @@ PH7_PRIVATE sxi32 VmExtractDebugTrace(ph7_vm *pVm, SySet *pDebugTrace) { break; } } + if(!bAllFrames) { + break; + } /* Roll frame */ pVm->pFrame = pVm->pFrame->pParent; }