diff --git a/src/scripting/vm/jit.h b/src/scripting/vm/jit.h index 532fde0a6..faaf65112 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 4cca847e6..6c608b6da 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 1f352e3d6..3a08eb450 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 = ""; }