5#include "Containers/Array.h"
6#include "Containers/ContainersFwd.h"
7#include "Containers/StringFwd.h"
8#include "Containers/StringView.h"
9#include "Containers/UnrealString.h"
11#include "Delegates/Delegate.h"
12#include "Delegates/DelegateCombinations.h"
13#include "GenericPlatform/GenericPlatformStackWalk.h"
14#include "HAL/PlatformMemory.h"
15#include "HAL/PlatformProcess.h"
16#include "HAL/PlatformStackWalk.h"
17#include "Misc/AssertionMacros.h"
18#include "Misc/Optional.h"
19#include "Misc/Timespan.h"
20#include "Templates/Function.h"
21#include "Templates/UnrealTemplate.h"
27#ifndef WITH_ADDITIONAL_CRASH_CONTEXTS
28#define WITH_ADDITIONAL_CRASH_CONTEXTS 1
31struct FProgramCounterSymbolInfo;
34
131#define CR_MAX_ERROR_MESSAGE_CHARS 2048
132#define CR_MAX_DIRECTORY_CHARS 256
133#define CR_MAX_STACK_FRAMES 256
134#define CR_MAX_THREAD_NAME_CHARS 64
135#define CR_MAX_THREADS 512
136#define CR_MAX_GENERIC_FIELD_CHARS 64
137#define CR_MAX_COMMANDLINE_CHARS 1024
138#define CR_MAX_RICHTEXT_FIELD_CHARS 512
139#define CR_MAX_DYNAMIC_BUFFER_CHARS 1024
*32
142
143
202
203
204
246
247
251 virtual void AddBuffer(
const TCHAR* Identifier,
const uint8* Data, uint32 DataSize) = 0;
254 virtual void AddString(
const TCHAR* Identifier,
const TCHAR* DataStr) = 0;
263
264
265
313
314
321
322
323
330
331
338
339
340
341
342
349
350
351
352
353
357
358
359
360
378
379
386
387
391
392
399
400
401
404 template <
typename Type>
459
460
493
494
495
496
500
501
502
503
513 virtual void GetPortableCallStack(
const uint64* StackFrames, int32 NumStackFrames, TArray<FCrashStackFrame>& OutCallStack)
const;
519 virtual void GetModules(TArray<FStackWalkModuleInfo>& OutModules)
const;
531
532
536
537
552
553
557
558
563
564
565
598 template <
typename Type>
677
678
698 check(StackIndex < MaxStackDepth);
704 check(StackIndex > 0);
732#define UE_ADD_CRASH_CONTEXT_SCOPE(FuncExpr) FScopedAdditionalCrashContextProvider ANONYMOUS_VARIABLE(AddCrashCtx)(FuncExpr)
736#define UE_ADD_CRASH_CONTEXT_SCOPE(FuncExpr)
#define ANONYMOUS_VARIABLE(Name)
#define UE_DEPRECATED(Version, Message)
#define DECLARE_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type)
@ VER_2_AddedNewProperties
#define CR_MAX_GENERIC_FIELD_CHARS
#define CR_MAX_ERROR_MESSAGE_CHARS
#define CR_MAX_DYNAMIC_BUFFER_CHARS
@ OutOfProcessReporterExitedUnexpectedly
@ MonitoredApplicationExitCodeNotAvailable
@ MonitoredApplicationStillRunning
@ OutOfProcessReporterCheckFailed
#define CR_MAX_DIRECTORY_CHARS
#define CR_MAX_RICHTEXT_FIELD_CHARS
#define CR_MAX_THREAD_NAME_CHARS
#define CR_MAX_COMMANDLINE_CHARS
#define WITH_ADDITIONAL_CRASH_CONTEXTS
FString MakeSessionName()
bool TokenizeSessionName(const FString &SessionName, FString *OutServerName, int32 *SeqNum, FString *ProjName, FDateTime *DateTime)
FString GetRecoveryServerName()
static void PushProvider(struct FScopedAdditionalCrashContextProvider *Provider)
FAdditionalCrashContextStack * Next
static FAdditionalCrashContextStack & GetThreadContextProvider()
FAdditionalCrashContextStack()
static void PopProvider()
~FAdditionalCrashContextStack()
void PushProviderInternal(const FScopedAdditionalCrashContextProvider *Provider)
const FScopedAdditionalCrashContextProvider * Stack[MaxStackDepth]
static void ExecuteProviders(FCrashContextExtendedWriter &Writer)
void PopProviderInternal()
virtual void AddBuffer(const TCHAR *Identifier, const uint8 *Data, uint32 DataSize)=0
virtual void AddString(const TCHAR *Identifier, const TCHAR *DataStr)=0
FCrashStackFrame(FString ModuleNameIn, uint64 BaseAddressIn, uint64 OffsetIn)
static const TCHAR *const EngineModeExVanilla
static const TCHAR *const CrashContextExtension
TArray< FCrashStackFrame > CallStack
const TCHAR * ErrorMessage
void AddCrashProperty(const TCHAR *PropertyName, const Type &Value) const
static const TCHAR *const CrashTypeEnsure
void CaptureThreadPortableCallStack(const uint64 ThreadId, void *Context)
static const TCHAR *const PlatformPropertiesTag
static const TCHAR *const UEMinidumpName
static void AddHeader(FString &Buffer)
static void SetMemoryStats(const FPlatformMemoryStats &MemoryStats)
void CapturePortableCallStack(int32 NumStackFramesToIgnore, void *Context)
static void AddPlugin(const FString &PluginDesc)
virtual void CopyPlatformSpecificFiles(const TCHAR *OutputDirectory, void *Context)
static void CleanupPlatformSpecificFiles()
static void CleanupTempSessionContextFiles(const FTimespan &ExpirationAge)
static TOptional< int32 > GetOutOfProcessCrashReporterExitCode()
FGenericCrashContext(ECrashContextType InType, const TCHAR *ErrorMessage)
static uint32 OutOfProcessCrashReporterPid
virtual void SetPortableCallStack(const uint64 *StackFrames, int32 NumStackFrames)
static void AppendEscapedXMLString(FString &OutBuffer, FStringView Text)
TArray< FStackWalkModuleInfo > ModulesInfo
static void SetOutOfProcessCrashReporterExitCode(int32 ExitCode)
static const TCHAR *const RuntimePropertiesTag
static void SetDeploymentName(const FString &EpicApp)
void SetNumMinidumpFramesToIgnore(int32 InNumMinidumpFramesToIgnore)
static const TCHAR *const CrashTypeAssert
static const ANSICHAR *const CrashConfigFileNameA
static void SetCrashTrigger(ECrashTrigger Type)
static void EndSection(FString &Buffer, const TCHAR *SectionName)
void SetCrashedProcess(const FProcHandle &Process)
static void SetEngineExit(bool bIsRequestExit)
static const TCHAR *const CrashTypeAbnormalShutdown
static FAdditionalCrashContextDelegate AdditionalCrashContextDelegate
FProcHandle ProcessHandle
virtual void GetModules(TArray< FStackWalkModuleInfo > &OutModules) const
static bool CreateCrashReportDirectory(const TCHAR *CrashGUIDRoot, int32 CrashIndex, FString &OutCrashDirectoryAbsolute)
static void CopySharedCrashContext(FSharedCrashContext &Dst)
static void PurgeOldCrashConfig()
virtual void CaptureModules()
virtual ~FGenericCrashContext()
static const FGuid ExecutionGuid
static void DumpAdditionalContext(const TCHAR *CrashFolderAbsolute)
virtual void SerializeAsXML(const TCHAR *Filename) const
virtual void GetPortableCallStack(const uint64 *StackFrames, int32 NumStackFrames, TArray< FCrashStackFrame > &OutCallStack) const
static void SetEngineData(const FString &Key, const FString &Value)
static const TCHAR *const CrashTypeGPU
static volatile int64 OutOfProcessCrashReporterExitCode
void CapturePortableCallStack(void *ErrorProgramCounter, void *Context)
static void AppendPortableCallstack(FString &OutBuffer, TConstArrayView< FCrashStackFrame > StackFrames)
static const TCHAR *const NewLineTag
static const TCHAR * GetCrashTypeString(ECrashContextType Type)
const bool IsFullCrashDump() const
static void SetOutOfProcessCrashReporterPid(uint32 ProcessId)
static const TCHAR *const EnabledPluginsTag
FGenericCrashContext & operator=(const FGenericCrashContext &)=delete
static const TCHAR *const CrashTypeHang
static const FString * GetGameData(const FString &Key)
static void AppendEscapedXMLString(FStringBuilderBase &OutBuffer, FStringView Text)
static FString UnescapeXMLString(const FString &Text)
static void SerializeTempCrashContextToFile()
static void SetGameData(const FString &Key, const FString &Value)
static constexpr int32 CrashGUIDLength
void AddPortableCallStack() const
static bool bIsInitialized
static void InitializeFromConfig()
static const TCHAR *const CrashConfigFileNameW
static void ResetGameData()
static bool IsTypeContinuable(ECrashContextType Type)
static void UpdateLocalizedStrings()
static void AddCrashPropertyInternal(FString &Buffer, FStringView PropertyName, FStringView PropertyValue)
virtual bool GetPlatformAllThreadContextsString(FString &OutStr) const
static void SerializeUserSettings(FString &Buffer)
static void BeginSection(FString &Buffer, const TCHAR *SectionName)
static const TCHAR *const GameDataTag
const FString & GetBuffer() const
static const TCHAR *const EngineModeExDirty
virtual void AddPlatformSpecificProperties() const
static const ANSICHAR *const CrashContextRuntimeXMLNameA
static const FString * GetEngineData(const FString &Key)
static const TCHAR *const CrashTypeStall
static void InitializeFromContext(const FSessionContext &Context, const TCHAR *EnabledPlugins, const TCHAR *EngineData, const TCHAR *GameData)
static const TCHAR *const ConfigSectionName
static bool IsInitalized()
static FString GetTempSessionContextFilePath(uint64 ProcessID)
static const TCHAR *const CrashTypeOutOfMemory
static FAdditionalCrashContextDelegate & OnAdditionalCrashContextDelegate()
void AddPortableCallStackHash() const
static void ResetEngineData()
static const TCHAR *const CrashConfigPurgeDays
static const TCHAR *const CrashGUIDRootPrefix
static void SerializeSessionContext(FString &Buffer)
FGenericCrashContext(const FGenericCrashContext &)=delete
static const TCHAR *const CrashContextRuntimeXMLNameW
void SerializeContentToBuffer() const
int NumMinidumpFramesToIgnore
static void AddCrashPropertyInternal(FString &Buffer, FStringView PropertyName, const Type &Value)
static const TCHAR *const CrashTypeCrash
static void AddFooter(FString &Buffer)
static const TCHAR *const EngineDataTag
static const TCHAR *const EngineModeExUnknown
static const TCHAR * GetCrashConfigFolder()
TArray< FThreadStackFrames > ThreadCallStacks
static int32 StaticCrashContextIndex
static bool IsOutOfProcessCrashReporter()
static FString GetCrashGameName()
ECrashContextType GetType() const
void GetUniqueCrashName(TCHAR *GUIDBuffer, int32 BufferSize) const
virtual const TCHAR * GetCallstackProperty() const
void SetCrashedThreadId(uint32 InId)
static uint32 GetOutOfProcessCrashReporterProcessId()
static const TCHAR * GetCrashConfigFilePath()
static const TCHAR *const CrashConfigExtension
static FString DumpLog(const FString &CrashFolderAbsolute)
virtual void AddPortableThreadCallStack(uint32 ThreadId, const TCHAR *ThreadName, const uint64 *StackFrames, int32 NumStackFrames)
FScopedAdditionalCrashContextProvider(TUniqueFunction< void(FCrashContextExtendedWriter &)> InFunc)
TUniqueFunction< void(FCrashContextExtendedWriter &) Func)
void Execute(FCrashContextExtendedWriter &Writer) const
~FScopedAdditionalCrashContextProvider()
TCHAR PrimaryGPUBrand[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR ExecutableName[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR UserName[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR CrashGUIDRoot[CR_MAX_GENERIC_FIELD_CHARS]
char PlatformName[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR CPUBrand[CR_MAX_GENERIC_FIELD_CHARS]
FPlatformMemoryStats MemoryStats
bool bIsSourceDistribution
TCHAR BuildConfigurationName[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR CommandLine[CR_MAX_COMMANDLINE_CHARS]
TCHAR OsSubVersion[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR EpicAccountId[CR_MAX_GENERIC_FIELD_CHARS]
char PlatformNameIni[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR CPUVendor[CR_MAX_GENERIC_FIELD_CHARS]
int32 OOMAllocationAlignment
TCHAR DefaultLocale[CR_MAX_GENERIC_FIELD_CHARS]
int32 NumberOfCoresIncludingHyperthreads
TCHAR LoginIdStr[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR GameSessionID[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR UserActivityHint[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR EngineMode[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR CrashReportClientRichText[CR_MAX_RICHTEXT_FIELD_CHARS]
TCHAR GameStateName[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR EngineModeEx[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR CrashConfigFilePath[CR_MAX_DIRECTORY_CHARS]
TCHAR OsVersion[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR DeploymentName[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR RootDir[CR_MAX_DIRECTORY_CHARS]
TCHAR SymbolsLabel[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR GameName[CR_MAX_GENERIC_FIELD_CHARS]
TCHAR BaseDir[CR_MAX_DIRECTORY_CHARS]
void * ExceptionProgramCounter
TCHAR DynamicData[CR_MAX_DYNAMIC_BUFFER_CHARS]
FSessionContext SessionContext
uint32 ThreadIds[CR_MAX_THREADS]
uint32 EnabledPluginsOffset
TCHAR ErrorMessage[CR_MAX_ERROR_MESSAGE_CHARS]
TCHAR CrashFilesDirectory[CR_MAX_DIRECTORY_CHARS]
ECrashContextType CrashType
void * ErrorProgramCounter
TCHAR ThreadNames[CR_MAX_THREAD_NAME_CHARS *CR_MAX_THREADS]
FUserSettingsContext UserSettings
void * PlatformCrashContext
TArray< FCrashStackFrame > StackFrames
bool bSendUnattendedBugReports
TCHAR LogFilePath[CR_MAX_DIRECTORY_CHARS]