Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
GenericPlatformCrashContext.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
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"
10#include "CoreTypes.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"
22
23struct FDateTime;
24struct FGuid;
26
27#ifndef WITH_ADDITIONAL_CRASH_CONTEXTS
28#define WITH_ADDITIONAL_CRASH_CONTEXTS 1
29#endif
30
31struct FProgramCounterSymbolInfo;
32
33/** Defines special exit codes used to diagnose abnormal terminations. The code values are arbitrary, but easily recongnizable in decimal. They are meant to be
34 used with the out-of-process monitoring/analytics in order to figure out unexpected cases. */
36{
37 /** Used by out-of-process monitor in analytics report, the application is still running, but out-of-process monitor was requested to exit before the application exit code could be read. */
39
40 /** Used by out-of-process monitor in analytics report, the application is not running anymore, but the out-of-process monitor could not read the Editor exit code (either is is not supported by the OS or is not available). */
42
43 /** Used by the application when the crash reporter crashed itself while reporting a crash.*/
45
46 /** Used by the application when the crash handler crashed itself (crash in the __except() clause for example).*/
48
49 /** Used by the application to flag when it detects that its out-of-process application supposed to report the bugs died (ex if the Editor detects that CrashReportClientEditor is not running anymore as expected).*/
51
52 /** Application crashed during static initialization. It may or may not have been able to have sent a crash report. */
54
55 /** Used as MonitorExceptCode in analytics to track how often the out-of-process CRC exits because of a failed check. */
57
58 /** The exception code used for ensure, in case a kernel driver callback happens at in a dispatch level where SEH (on windows) is disabled. */
60};
61
62/** Enumerates crash description versions. */
64{
65 /** Introduces a new crash description format. */
67
68 /** Added misc properties (CPU,GPU,OS,etc), memory related stats and platform specific properties as generic payload. */
70
71 /** Using crash context when available. */
73};
74
75/** Enumerates crash dump modes. */
77{
78 /** Default minidump settings. */
79 Default = 0,
80
81 /** Full memory crash minidump */
82 FullDump = 1,
83
84 /** Full memory crash minidump, even on ensures */
86};
87
88/** Portable stack frame */
90{
93 uint64 Offset;
94
95 FCrashStackFrame(FString ModuleNameIn, uint64 BaseAddressIn, uint64 OffsetIn)
97 , BaseAddress(BaseAddressIn)
98 , Offset(OffsetIn)
99 {
100 }
101};
102
103/** Portable thread stack frame */
106 uint32 ThreadId;
108};
109
111{
112 Crash,
113 Assert,
114 Ensure,
115 Stall,
116 GPUCrash,
117 Hang,
120
121 Max
122};
123
124/** In development mode we can cause crashes in order to test reporting systems. */
126{
127 Debug = -1,
128 Normal = 0
129};
130
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
140
141/**
142 * Fixed size structure that holds session specific state.
143 */
145{
150 bool bIsOOM;
152 uint32 ProcessId;
189};
190
191/** Additional user settings to be communicated to crash reporting client. */
193{
194 bool bNoDialog = false;
196 bool bSendUsageData = false;
197 bool bImplicitSend = false;
199};
200
201/**
202 * Fixed size struct holds crash information and session specific state. It is designed
203 * to shared between processes (e.g. Game and CrashReporterClient).
204 */
206{
207 // Exception info
214
215 // Additional user settings.
217
218 // Platform specific crash context (must be portable)
220 // Directory for dumped files
222 // Game/Engine information not possible to catch out of process
224 // Count and offset into dynamic buffer to comma separated plugin list
227 // Count and offset into dynamic buffer to comma separated key=value data for engine information
230 // Count and offset into dynamic buffer to comma separated key=value data for game information
233 // Fixed size dynamic buffer
235
236 // Program counter address where the error occurred.
238
239 // Instruction address where the exception was raised that initiated crash reporting
241};
242
244
245/**
246 * Interface for callbacks to add context to the crash report.
247 */
249{
250 /** Adds a named buffer to the report. Intended for larger payloads. */
251 virtual void AddBuffer(const TCHAR* Identifier, const uint8* Data, uint32 DataSize) = 0;
252
253 /** Add a named buffer containing a string to the report. */
254 virtual void AddString(const TCHAR* Identifier, const TCHAR* DataStr) = 0;
255};
256
257/** Simple Delegate for additional crash context. */
258DECLARE_MULTICAST_DELEGATE_OneParam(FAdditionalCrashContextDelegate, FCrashContextExtendedWriter&);
259
260#endif //WITH_ADDITIONAL_CRASH_CONTEXTS
261
262/**
263 * Contains a runtime crash's properties that are common for all platforms.
264 * This may change in the future.
265 */
267{
268public:
269
270 static const ANSICHAR* const CrashContextRuntimeXMLNameA;
271 static const TCHAR* const CrashContextRuntimeXMLNameW;
272
273 static const ANSICHAR* const CrashConfigFileNameA;
274 static const TCHAR* const CrashConfigFileNameW;
275 static const TCHAR* const CrashConfigExtension;
276 static const TCHAR* const ConfigSectionName;
277 static const TCHAR* const CrashConfigPurgeDays;
278 static const TCHAR* const CrashGUIDRootPrefix;
279
280 static const TCHAR* const CrashContextExtension;
281 static const TCHAR* const RuntimePropertiesTag;
282 static const TCHAR* const PlatformPropertiesTag;
283 static const TCHAR* const EngineDataTag;
284 static const TCHAR* const GameDataTag;
285 static const TCHAR* const EnabledPluginsTag;
286 static const TCHAR* const UEMinidumpName;
287 static const TCHAR* const NewLineTag;
288 static constexpr int32 CrashGUIDLength = 128;
289
290 static const TCHAR* const CrashTypeCrash;
291 static const TCHAR* const CrashTypeAssert;
292 static const TCHAR* const CrashTypeEnsure;
293 static const TCHAR* const CrashTypeStall;
294 static const TCHAR* const CrashTypeGPU;
295 static const TCHAR* const CrashTypeHang;
296 static const TCHAR* const CrashTypeAbnormalShutdown;
297 static const TCHAR* const CrashTypeOutOfMemory;
298
299 static const TCHAR* const EngineModeExUnknown;
300 static const TCHAR* const EngineModeExDirty;
301 static const TCHAR* const EngineModeExVanilla;
302
303 // A guid that identifies this particular execution. Allows multiple crash reports from the same run of the project to be tied together
304 static const FGuid ExecutionGuid;
305
306 /** Initializes crash context related platform specific data that can be impossible to obtain after a crash. */
307 static void Initialize();
308
309 /** Initialized crash context, using a crash context (e.g. shared from another process). */
310 static void InitializeFromContext(const FSessionContext& Context, const TCHAR* EnabledPlugins, const TCHAR* EngineData, const TCHAR* GameData);
311
312 /**
313 * @return true, if the generic crash context has been initialized.
314 */
315 static bool IsInitalized()
316 {
317 return bIsInitialized;
318 }
319
320 /**
321 * @return true if walking the crashed call stack and writing the minidump is being handled out-of-process.
322 * @note The reporting itself (showing the crash UI and sending the report is always done out of process)
323 */
325 {
327 }
328
329 /**
330 * @return a non-zero value if crash reporter process is used to monitor the session, capture the call stack and write the minidump, otherwise, this is done inside the crashing process.
331 */
333 {
335 }
336
337 /**
338 * Set whether or not the out-of-process crash reporter is running. A non-zero process id means that crash artifacts like the call stack and then minidump are
339 * built in a separated background process. The reporting itself, i.e. packaging and sending the crash artifacts is always done out of process.
340 * @note CrashReportClient (CrashReportClientEditor for the Editor) can be configured to wait for crash, capture the crashed process callstack, write the minidump, collect all crash artifacts
341 * and send them (out-of-process reporting) or just collect and send them (in-process reporting because the crashing process creates all crash artifacts itself).
342 */
343 static void SetOutOfProcessCrashReporterPid(uint32 ProcessId)
344 {
346 }
347
348 /**
349 * Set the out of process crash reporter exit code if known. The out of process reporter is expected to run in background, waiting for a signal to handle a
350 * crashes/ensures/assert, but sometimes it crashes. If the engine detects that its associated out of process crash reporter died and if the child process exit
351 * code can be retrieved, it can be exposed through this function.
352 * @see GetOutOfProcessCrashReporterExitCode
353 */
354 static void SetOutOfProcessCrashReporterExitCode(int32 ExitCode);
355
356 /**
357 * Return the out-of-process crash reporter exit code if available. The exit code is available if crash reporter process died while the application it monitors was still running.
358 * Then engine periodically poll the health of the crash reporter process and try to read its exit code if it unexpectedly died.
359 * @note This function is useful to try diagnose why the crash reporter died (crashed/killed/asserted) and gather data for the analytics.
360 */
362
363 /** Default constructor. Optionally pass a process handle if building a crash context for a process other then current. */
364 FGenericCrashContext(ECrashContextType InType, const TCHAR* ErrorMessage);
365
366 virtual ~FGenericCrashContext() { }
367
368 /** Get the file path to the temporary session context file that we create for the given process. */
369 static FString GetTempSessionContextFilePath(uint64 ProcessID);
370
371 /** Clean up expired context files that were left-over on the user disks (because the consumer crashed and/or failed to delete it). */
372 static void CleanupTempSessionContextFiles(const FTimespan& ExpirationAge);
373
374 /** Serializes all data to the buffer. */
376
377 /**
378 * @return the buffer containing serialized data.
379 */
380 const FString& GetBuffer() const
381 {
382 return CommonBuffer;
383 }
384
385 /**
386 * @return a globally unique crash name.
387 */
388 void GetUniqueCrashName(TCHAR* GUIDBuffer, int32 BufferSize) const;
389
390 /**
391 * @return whether this crash is a full memory minidump
392 */
393 const bool IsFullCrashDump() const;
394
395 /** Serializes crash's informations to the specified filename. Should be overridden for platforms where using FFileHelper is not safe, all POSIX platforms. */
396 virtual void SerializeAsXML( const TCHAR* Filename ) const;
397
398 /**
399 * Serializes session context to the given buffer.
400 * NOTE: Assumes that the buffer already has a header and section open.
401 */
402 static void SerializeSessionContext(FString& Buffer);
403
404 template <typename Type>
405 void AddCrashProperty(const TCHAR* PropertyName, const Type& Value) const
406 {
408 }
409
410 /** Escapes and appends specified text to XML string */
411 static void AppendEscapedXMLString(FString& OutBuffer, FStringView Text );
412 static void AppendEscapedXMLString(FStringBuilderBase& OutBuffer, FStringView Text);
413
414 static void AppendPortableCallstack(FString& OutBuffer, TConstArrayView<FCrashStackFrame> StackFrames);
415
416 /** Unescapes a specified XML string, naive implementation. */
417 static FString UnescapeXMLString( const FString& Text );
418
419 /** Helper to get the standard string for the crash type based on crash event bool values. */
420 static const TCHAR* GetCrashTypeString(ECrashContextType Type);
421
422 /** Get the Game Name of the crash */
424
425 /** Helper to get the crash report client config filepath saved by this instance and copied to each crash report folder. */
426 static const TCHAR* GetCrashConfigFilePath();
427
428 /** Helper to get the crash report client config folder used by GetCrashConfigFilePath(). */
429 static const TCHAR* GetCrashConfigFolder();
430
431 /** Helper to clean out old files in the crash report client config folder. */
432 static void PurgeOldCrashConfig();
433
434 /** Clears the engine data dictionary */
435 static void ResetEngineData();
436
437 /** Updates (or adds if not already present) arbitrary engine data to the crash context (will remove the key if passed an empty string) */
438 static void SetEngineData(const FString& Key, const FString& Value);
439
440 /** Clears the game data dictionary */
441 static void ResetGameData();
442
443 /** Updates (or adds if not already present) arbitrary game data to the crash context (will remove the key if passed an empty string) */
444 static void SetGameData(const FString& Key, const FString& Value);
445
446 /** Adds a plugin descriptor string to the enabled plugins list in the crash context */
447 static void AddPlugin(const FString& PluginDesc);
448
449 /** Flushes the logs. In the case of in memory logs is used on this configuration, dumps them to file. Returns the name of the file */
450 static FString DumpLog(const FString& CrashFolderAbsolute);
451
452 /** Collects additional crash context providers. See FAdditionalCrashContextStack. */
453 static void DumpAdditionalContext(const TCHAR* CrashFolderAbsolute);
454
455 /** Initializes a shared crash context from current state. Will not set all fields in Dst. */
457
458 /** We can't gather memory stats in crash handling function, so we gather them just before raising
459 * exception and use in crash reporting.
460 */
461 static void SetMemoryStats(const FPlatformMemoryStats& MemoryStats);
462
463 /** Attempts to create the output report directory. */
464 static bool CreateCrashReportDirectory(const TCHAR* CrashGUIDRoot, int32 CrashIndex, FString& OutCrashDirectoryAbsolute);
465
466 /** Notify the crash context exit has been requested. */
467 static void SetEngineExit(bool bIsRequestExit);
468
470 /** Delegate for additional crash context. */
471 static FAdditionalCrashContextDelegate& OnAdditionalCrashContextDelegate()
472 {
474 }
475#endif //WITH_ADDITIONAL_CRASH_CONTEXTS
476
477 /** Sets the process id to that has crashed. On supported platforms this will analyze the given process rather than current. Default is current process. */
478 void SetCrashedProcess(const FProcHandle& Process)
479 {
480 ProcessHandle = Process;
481 }
482
483 /** Stores crashing thread id. */
484 void SetCrashedThreadId(uint32 InId)
485 {
486 CrashedThreadId = InId;
487 }
488
489 /** Sets the number of stack frames to ignore when symbolicating from a minidump */
490 void SetNumMinidumpFramesToIgnore(int32 InNumMinidumpFramesToIgnore);
491
492 /**
493 * Generate raw call stack for crash report (image base + offset) for the calling thread
494 * @param ErrorProgramCounter The program counter of where the occur occurred in the callstack being captured
495 * @param Context Optional thread context information
496 */
497 void CapturePortableCallStack(void* ErrorProgramCounter, void* Context);
498
499 /**
500 * Generate raw call stack for crash report (image base + offset) for a different thread
501 * @param InThreadId The thread id of the thread to capture the callstack for
502 * @param Context Optional thread context information
503 */
504 void CaptureThreadPortableCallStack(const uint64 ThreadId, void* Context);
505
506 UE_DEPRECATED(5.0, "")
507 void CapturePortableCallStack(int32 NumStackFramesToIgnore, void* Context);
508
509 /** Sets the portable callstack to a specified stack */
510 virtual void SetPortableCallStack(const uint64* StackFrames, int32 NumStackFrames);
511
512 /** Gets the portable callstack to a specified stack and puts it into OutCallStack */
513 virtual void GetPortableCallStack(const uint64* StackFrames, int32 NumStackFrames, TArray<FCrashStackFrame>& OutCallStack) const;
514
515 /** Store info about loaded modules */
516 virtual void CaptureModules();
517
518 /** Gets info about loaded modules and stores it in the given array */
519 virtual void GetModules(TArray<FStackWalkModuleInfo>& OutModules) const;
520
521 /** Adds a portable callstack for a thread */
522 virtual void AddPortableThreadCallStack(uint32 ThreadId, const TCHAR* ThreadName, const uint64* StackFrames, int32 NumStackFrames);
523
524 /** Allows platform implementations to copy files to report directory. */
525 virtual void CopyPlatformSpecificFiles(const TCHAR* OutputDirectory, void* Context);
526
527 /** Cleanup platform specific files - called on startup, implemented per platform */
529
530 /**
531 * @return the type of this crash
532 */
533 ECrashContextType GetType() const { return Type; }
534
535 /**
536 * @return whether a crash context type is continable
537 */
539 {
540 switch (Type)
541 {
543 return true;
545 return true;
546 default:
547 return false;
548 }
549 }
550
551 /**
552 * Set the current deployment name (ie. EpicApp)
553 */
554 static void SetDeploymentName(const FString& EpicApp);
555
556 /**
557 * Sets the type of crash triggered. Used to distinguish crashes caused for debugging purposes.
558 */
560
561protected:
562 /**
563 * @OutStr - a stream of Thread XML elements containing info (e.g. callstack) specific to an active thread
564 * @return - whether the operation was successful
565 */
566 virtual bool GetPlatformAllThreadContextsString(FString& OutStr) const { return false; }
567
571 const TCHAR* ErrorMessage;
576
577 /** Allow platform implementations to provide a callstack property. Primarily used when non-native code triggers a crash. */
578 virtual const TCHAR* GetCallstackProperty() const;
579
580 /** Get arbitrary engine data from the crash context */
581 static const FString* GetEngineData(const FString& Key);
582
583 /** Get arbitrary game data from the crash context */
584 static const FString* GetGameData(const FString& Key);
585
586private:
587
588 /** Serializes the session context section of the crash context to a temporary file. */
590
591 /** Serializes the current user setting struct to a buffer. */
592 static void SerializeUserSettings(FString& Buffer);
593
594 /** Writes a common property to the buffer. */
595 static void AddCrashPropertyInternal(FString& Buffer, FStringView PropertyName, FStringView PropertyValue);
596
597 /** Writes a common property to the buffer. */
598 template <typename Type>
599 static void AddCrashPropertyInternal(FString& Buffer, FStringView PropertyName, const Type& Value)
600 {
602 }
603
604 /** Serializes platform specific properties to the buffer. */
605 virtual void AddPlatformSpecificProperties() const;
606
607 /** Add callstack information to the crash report xml */
609
610 /** Produces a hash based on the offsets of the portable callstack and adds it to the xml */
612
613 /** Add module/pdb information to the crash report xml */
614 void AddModules() const;
615
616 /** Writes header information to the buffer. */
617 static void AddHeader(FString& Buffer);
618
619 /** Writes footer to the buffer. */
620 static void AddFooter(FString& Buffer);
621
622 static void BeginSection(FString& Buffer, const TCHAR* SectionName);
623 static void EndSection(FString& Buffer, const TCHAR* SectionName);
624
625 /** Called once when GConfig is initialized. Opportunity to cache values from config. */
626 static void InitializeFromConfig();
627
628 /** Called to update any localized strings in the crash context */
630
631 /** Whether the Initialize() has been called */
632 static bool bIsInitialized;
633
634 /** The ID of the external process reporting crashes if the platform supports it and was configured to use it, zero otherwise (0 is a reserved system process ID, invalid for the out of process reporter). */
636
637 /** The out of process crash reporter exit code, if available. The 32 MSB indicates if the exit code is set and the 32 LSB contains the exit code. The value can be read/write from different threads. */
639
640 /** Static counter records how many crash contexts have been constructed */
642
644 /** Delegate for additional crash context. */
645 static FAdditionalCrashContextDelegate AdditionalCrashContextDelegate;
646#endif //WITH_ADDITIONAL_CRASH_CONTEXTS
647
648 /** The buffer used to store the crash's properties. */
650
651 /** Records which crash context we were using the StaticCrashContextIndex counter */
653
654 // FNoncopyable
657};
658
660{};
661
663{
664 /** Generates a name for the disaster recovery service embedded in the CrashReporterClientEditor. */
666
667 /** Generates a name for the disaster recovery session. */
669
670 /** Tokenize the session name into its components. */
671 bool TokenizeSessionName(const FString& SessionName, FString* OutServerName, int32* SeqNum, FString* ProjName, FDateTime* DateTime);
672}
673
675
676/**
677 * A thread local stack of callbacks that can be issued at time of the crash.
678 */
680{
683 static void PopProvider();
684
686
687private:
688 enum { MaxStackDepth = 16 };
691 uint32 StackIndex = 0;
692
695
697 {
698 check(StackIndex < MaxStackDepth);
699 Stack[StackIndex++] = Provider;
700 }
701
703 {
704 check(StackIndex > 0);
705 Stack[--StackIndex] = nullptr;
706 }
707};
708
710{
711public:
714 {
716 }
717
719 {
721 }
722
724 {
725 Func(Writer);
726 }
727
728private:
729 TUniqueFunction<void(FCrashContextExtendedWriter&)> Func;
730};
731
732#define UE_ADD_CRASH_CONTEXT_SCOPE(FuncExpr) FScopedAdditionalCrashContextProvider ANONYMOUS_VARIABLE(AddCrashCtx)(FuncExpr)
733
734#else
735
736#define UE_ADD_CRASH_CONTEXT_SCOPE(FuncExpr)
737
738#endif // WITH_ADDITIONAL_CRASH_CONTEXTS
#define check(expr)
#define ANONYMOUS_VARIABLE(Name)
#define UE_DEPRECATED(Version, Message)
#define DECLARE_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type)
ECrashTrigger
Definition Enums.h:24848
ECrashDumpMode
Definition Enums.h:34343
ECrashExitCodes
Definition Enums.h:34271
ECrashContextType
Definition Enums.h:24819
ECrashDescVersions
Definition Enums.h:34350
#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 CR_MAX_THREADS
#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()
void PushProviderInternal(const FScopedAdditionalCrashContextProvider *Provider)
const FScopedAdditionalCrashContextProvider * Stack[MaxStackDepth]
static void ExecuteProviders(FCrashContextExtendedWriter &Writer)
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
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 Initialize()
static void CleanupPlatformSpecificFiles()
static void CleanupTempSessionContextFiles(const FTimespan &ExpirationAge)
static TOptional< int32 > GetOutOfProcessCrashReporterExitCode()
FGenericCrashContext(ECrashContextType InType, const TCHAR *ErrorMessage)
virtual void SetPortableCallStack(const uint64 *StackFrames, int32 NumStackFrames)
void AddModules() const
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
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()
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 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 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
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 FString GetCrashGameName()
ECrashContextType GetType() const
void GetUniqueCrashName(TCHAR *GUIDBuffer, int32 BufferSize) const
virtual const TCHAR * GetCallstackProperty() const
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)
Definition Guid.h:108
FScopedAdditionalCrashContextProvider(TUniqueFunction< void(FCrashContextExtendedWriter &)> InFunc)
TUniqueFunction< void(FCrashContextExtendedWriter &) Func)
void Execute(FCrashContextExtendedWriter &Writer) const
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
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]
TCHAR DefaultLocale[CR_MAX_GENERIC_FIELD_CHARS]
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]
TCHAR DynamicData[CR_MAX_DYNAMIC_BUFFER_CHARS]
uint32 ThreadIds[CR_MAX_THREADS]
TCHAR ErrorMessage[CR_MAX_ERROR_MESSAGE_CHARS]
TCHAR CrashFilesDirectory[CR_MAX_DIRECTORY_CHARS]
TCHAR ThreadNames[CR_MAX_THREAD_NAME_CHARS *CR_MAX_THREADS]
FUserSettingsContext UserSettings
TArray< FCrashStackFrame > StackFrames
TCHAR LogFilePath[CR_MAX_DIRECTORY_CHARS]