MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetStackTrace

Method GetStackTrace

Source/Engine/Platform/Base/PlatformBase.cpp:760–789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758}
759
760String PlatformBase::GetStackTrace(int32 skipCount, int32 maxDepth, void* context)
761{
762 StringBuilder result;
763 Array<StackFrame> stackFrames = Platform::GetStackFrames(skipCount, maxDepth, context);
764 for (const auto& frame : stackFrames)
765 {
766 StringAsUTF16<ARRAY_COUNT(StackFrame::FunctionName)> functionName(frame.FunctionName);
767 const StringView functionNameStr(functionName.Get());
768 if (StringUtils::Length(frame.FileName) != 0)
769 {
770 StringAsUTF16<ARRAY_COUNT(StackFrame::FileName)> fileName(frame.FileName);
771 result.Append(TEXT(" at ")).Append(functionNameStr);
772 if (!functionNameStr.EndsWith(')'))
773 result.Append(TEXT("()"));
774 result.AppendFormat(TEXT("in {0}:line {1}\n"),fileName.Get(), frame.LineNumber);
775 }
776 else if (StringUtils::Length(frame.FunctionName) != 0)
777 {
778 result.Append(TEXT(" at ")).Append(functionNameStr);
779 if (!functionNameStr.EndsWith(')'))
780 result.Append(TEXT("()"));
781 result.Append('\n');
782 }
783 else
784 {
785 result.AppendFormat(TEXT(" at 0x{0:x}\n"), (uint64)frame.ProgramCounter);
786 }
787 }
788 return result.ToString();
789}
790
791void PlatformBase::CollectCrashData(const String& crashDataFolder, void* context)
792{

Callers

nothing calls this directly

Calls 5

LengthFunction · 0.50
GetMethod · 0.45
AppendMethod · 0.45
EndsWithMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected