- don't include the native frames per default

This commit is contained in:
Magnus Norddahl 2018-12-19 00:43:50 +01:00
parent 7785dd1b56
commit 9a2b3792ef
3 changed files with 8 additions and 6 deletions

View file

@ -5,4 +5,4 @@
JitFuncPtr JitCompile(VMScriptFunction *func); JitFuncPtr JitCompile(VMScriptFunction *func);
void JitDumpLog(FILE *file, VMScriptFunction *func); void JitDumpLog(FILE *file, VMScriptFunction *func);
FString JitCaptureStackTrace(int framesToSkip); FString JitCaptureStackTrace(int framesToSkip, bool includeNativeFrames);

View file

@ -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]; void *frames[32];
int numframes = CaptureStackTrace(32, frames); int numframes = CaptureStackTrace(32, frames);
NativeSymbolResolver nativeSymbols; std::unique_ptr<NativeSymbolResolver> nativeSymbols;
if (includeNativeFrames)
nativeSymbols.reset(new NativeSymbolResolver());
FString s; FString s;
for (int i = framesToSkip + 1; i < numframes; i++) for (int i = framesToSkip + 1; i < numframes; i++)
{ {
s += JitGetStackFrameName(&nativeSymbols, frames[i]); s += JitGetStackFrameName(nativeSymbols.get(), frames[i]);
} }
return s; return s;
} }

View file

@ -660,7 +660,7 @@ CVMAbortException::CVMAbortException(EVMAbortException reason, const char *morei
} }
if (vm_jit) if (vm_jit)
stacktrace = JitCaptureStackTrace(1); stacktrace = JitCaptureStackTrace(1, false);
else else
stacktrace = ""; stacktrace = "";
} }