From 9a2b3792ef55b0e0279b7f5e256fafe5872e988b Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Wed, 19 Dec 2018 00:43:50 +0100 Subject: [PATCH] - don't include the native frames per default --- src/scripting/vm/jit.h | 2 +- src/scripting/vm/jit_runtime.cpp | 10 ++++++---- src/scripting/vm/vmframe.cpp | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/scripting/vm/jit.h b/src/scripting/vm/jit.h index 532fde0a66..faaf651128 100644 --- a/src/scripting/vm/jit.h +++ b/src/scripting/vm/jit.h @@ -5,4 +5,4 @@ JitFuncPtr JitCompile(VMScriptFunction *func); void JitDumpLog(FILE *file, VMScriptFunction *func); -FString JitCaptureStackTrace(int framesToSkip); +FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames); diff --git a/src/scripting/vm/jit_runtime.cpp b/src/scripting/vm/jit_runtime.cpp index 4cca847e61..6c608b6dad 100644 --- a/src/scripting/vm/jit_runtime.cpp +++ b/src/scripting/vm/jit_runtime.cpp @@ -982,20 +982,22 @@ FString JitGetStackFrameName(NativeSymbolResolver *nativeSymbols, void *pc) } } - return nativeSymbols->GetName(pc); + return nativeSymbols ? nativeSymbols->GetName(pc) : FString(); } -FString JitCaptureStackTrace(int framesToSkip) +FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames) { void *frames[32]; int numframes = CaptureStackTrace(32, frames); - NativeSymbolResolver nativeSymbols; + std::unique_ptr nativeSymbols; + if (includeNativeFrames) + nativeSymbols.reset(new NativeSymbolResolver()); FString s; for (int i = framesToSkip + 1; i < numframes; i++) { - s += JitGetStackFrameName(&nativeSymbols, frames[i]); + s += JitGetStackFrameName(nativeSymbols.get(), frames[i]); } return s; } diff --git a/src/scripting/vm/vmframe.cpp b/src/scripting/vm/vmframe.cpp index 1f352e3d63..3a08eb4509 100644 --- a/src/scripting/vm/vmframe.cpp +++ b/src/scripting/vm/vmframe.cpp @@ -660,7 +660,7 @@ CVMAbortException::CVMAbortException(EVMAbortException reason, const char *morei } if (vm_jit) - stacktrace = JitCaptureStackTrace(1); + stacktrace = JitCaptureStackTrace(1, false); else stacktrace = ""; }