|
18 | 18 |
|
19 | 19 | #include "SentryTraceSampler.h"
|
20 | 20 |
|
| 21 | +#include "Utils/SentryFileUtils.h" |
21 | 22 | #include "Utils/SentryLogUtils.h"
|
22 | 23 | #include "Utils/SentryScreenshotUtils.h"
|
23 | 24 |
|
|
41 | 42 |
|
42 | 43 | #if PLATFORM_WINDOWS
|
43 | 44 | #include "Windows/WindowsPlatformMisc.h"
|
| 45 | +#include "Windows/WindowsPlatformCrashContext.h" |
44 | 46 | #endif
|
45 | 47 |
|
| 48 | +extern CORE_API bool GIsGPUCrashed; |
| 49 | + |
46 | 50 | #if USE_SENTRY_NATIVE
|
47 | 51 |
|
48 | 52 | void PrintVerboseLog(sentry_level_t level, const char *message, va_list args, void *userdata)
|
@@ -135,6 +139,11 @@ sentry_value_t HandleBeforeCrash(const sentry_ucontext_t *uctx, sentry_value_t e
|
135 | 139 | SentrySubsystemDesktop* SentrySubsystem = static_cast<SentrySubsystemDesktop*>(closure);
|
136 | 140 | SentrySubsystem->TryCaptureScreenshot();
|
137 | 141 |
|
| 142 | + if (GIsGPUCrashed) |
| 143 | + { |
| 144 | + IFileManager::Get().Copy(*SentrySubsystem->GetGpuDumpBackupPath(), *SentryFileUtils::GetGpuDumpPath()); |
| 145 | + } |
| 146 | + |
138 | 147 | FSentryCrashContext::Get()->Apply(SentrySubsystem->GetCurrentScope());
|
139 | 148 |
|
140 | 149 | TSharedPtr<SentryEventDesktop> eventDesktop = MakeShareable(new SentryEventDesktop(event, true));
|
@@ -219,6 +228,15 @@ void SentrySubsystemDesktop::InitWithSettings(const USentrySettings* settings, U
|
219 | 228 | #endif
|
220 | 229 | }
|
221 | 230 |
|
| 231 | + if (settings->AttachGpuDump) |
| 232 | + { |
| 233 | +#if PLATFORM_WINDOWS |
| 234 | + sentry_options_add_attachmentw(options, *GetGpuDumpBackupPath()); |
| 235 | +#elif PLATFORM_LINUX |
| 236 | + sentry_options_add_attachment(options, TCHAR_TO_UTF8(*GetGpuDumpBackupPath())); |
| 237 | +#endif |
| 238 | + } |
| 239 | + |
222 | 240 | if(settings->UseProxy)
|
223 | 241 | {
|
224 | 242 | sentry_options_set_http_proxy(options, TCHAR_TO_ANSI(*settings->ProxyUrl));
|
@@ -562,6 +580,16 @@ void SentrySubsystemDesktop::TryCaptureScreenshot() const
|
562 | 580 | SentryScreenshotUtils::CaptureScreenshot(GetScreenshotPath());
|
563 | 581 | }
|
564 | 582 |
|
| 583 | +FString SentrySubsystemDesktop::GetGpuDumpBackupPath() const |
| 584 | +{ |
| 585 | + static const FString DateTimeString = FDateTime::Now().ToString(); |
| 586 | + |
| 587 | + const FString GpuDumpPath = FPaths::Combine(GetDatabasePath(), TEXT("gpudumps"), *FString::Printf(TEXT("UEAftermath-%s.nv-gpudmp"), *DateTimeString));; |
| 588 | + const FString GpuDumpFullPath = FPaths::ConvertRelativePathToFull(GpuDumpPath); |
| 589 | + |
| 590 | + return GpuDumpFullPath; |
| 591 | +} |
| 592 | + |
565 | 593 | TSharedPtr<SentryScopeDesktop> SentrySubsystemDesktop::GetCurrentScope()
|
566 | 594 | {
|
567 | 595 | if(scopeStack.Num() == 0)
|
|
0 commit comments