Skip to content

Commit af4f878

Browse files
authored
Add support of fast-fail crash capturing (#828)
* Add fast fail crash to sample * Update scripts to include wer module * Add wer module loading * Update script * Update changelog * Add limitations * Update SentryPlaygroundUtils.cpp * Update build-deps.ps1 * Update README.md * Update README.md
1 parent 469e2af commit af4f878

File tree

12 files changed

+33
-11
lines changed

12 files changed

+33
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- Add support of fast-fail crash capturing ([#828](https://github.com/getsentry/sentry-unreal/pull/828))
8+
59
### Dependencies
610

711
- Bump Cocoa SDK (iOS and Mac) from v8.46.0 to v8.47.0 ([#823](https://github.com/getsentry/sentry-unreal/pull/823))

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ sudo apt-get install -y libstdc++6
6464

6565
- Plugin supports Linux arm64 platform for UE 5.0 and newer.
6666

67+
- Fast-fail crash capturing is currently supported only in packaged game builds when using the `github` plugin version. When a fast-fail crash occurs the `HandleBeforeSend` hook will not be invoked and any custom event pre-processing will be skipped. Also, captured fast-fail crash events will not include UE-specific tags or context.
68+
6769
## Development
6870

6971
Please see the [contribution guide](./CONTRIBUTING.md).

plugin-dev/Source/Sentry/Private/GenericPlatform/GenericPlatformSentrySubsystem.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ void PrintVerboseLog(sentry_level_t level, const char* message, va_list args, vo
4848

4949
FString MessageBuf = FString(buffer);
5050

51-
// The WER (Windows Error Reporting) module (crashpad_wer.dll) can't be distributed along with other Sentry binaries
52-
// within the plugin package due to some UE Marketplace restrictions. Its absence doesn't affect crash capturing
53-
// and the corresponding warning can be disregarded
54-
if (MessageBuf.Equals(TEXT("crashpad WER handler module not found")))
55-
{
56-
return;
57-
}
58-
5951
#if !NO_LOGGING
6052
const FName SentryCategoryName(LogSentrySdk.GetCategoryName());
6153
#else

plugin-dev/Source/Sentry/Sentry.Build.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public Sentry(ReadOnlyTargetRules Target) : base(Target)
101101
if (CrashpadExists)
102102
{
103103
RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "crashpad_handler.exe"), Path.Combine(WindowsThirdPartyPath, "bin", "crashpad_handler.exe"));
104+
RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "crashpad_wer.dll"), Path.Combine(WindowsThirdPartyPath, "bin", "crashpad_wer.dll"));
104105

105106
PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "crashpad_compat.lib"));
106107
PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "crashpad_snapshot.lib"));

sample/Content/UI/W_SentryDemo.uasset

5 KB
Binary file not shown.

sample/Source/SentryPlayground/SentryPlaygroundUtils.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
#include "Misc/FileHelper.h"
55
#include "Misc/Paths.h"
66

7+
#if PLATFORM_MICROSOFT
8+
#include "Microsoft/WindowsHWrapper.h"
9+
#endif
10+
711
void USentryPlaygroundUtils::Terminate(ESentryAppTerminationType Type)
812
{
913
switch (Type)
@@ -32,6 +36,13 @@ void USentryPlaygroundUtils::Terminate(ESentryAppTerminationType Type)
3236
*addrPtr = 10;
3337
}
3438
break;
39+
case ESentryAppTerminationType::FastFail:
40+
{
41+
#if PLATFORM_MICROSOFT
42+
RaiseFailFastException(nullptr, nullptr, 0);
43+
#endif
44+
}
45+
break;
3546
case ESentryAppTerminationType::Assert:
3647
{
3748
char *assertPtr = nullptr;

sample/Source/SentryPlayground/SentryPlaygroundUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ enum class ESentryAppTerminationType : uint8
1111
ArrayOutOfBounds,
1212
BadFunctionPtr,
1313
InvalidMemoryAccess,
14+
FastFail,
1415
Assert,
1516
Ensure
1617
};

scripts/build-deps.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ function buildSentryNative()
130130

131131
Get-ChildItem -Path "$modulesDir/sentry-native/install/lib" -Filter "*.lib" -Recurse | Copy-Item -Destination $nativeOutDirLibs
132132
Copy-Item "$modulesDir/sentry-native/install/bin/crashpad_handler.exe" -Destination $nativeOutDirBinaries
133+
Copy-Item "$modulesDir/sentry-native/install/bin/crashpad_wer.dll" -Destination $nativeOutDirBinaries
133134
Copy-Item "$modulesDir/sentry-native/install/include/sentry.h" -Destination $nativeOutDirIncludes
134135
}
135136

@@ -171,4 +172,4 @@ else
171172
{
172173
buildPlatformDependency($platform)
173174
}
174-
}
175+
}

scripts/build-win64-crashpad.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ mkdir "${sentryArtifactsDestination}/lib"
1717

1818
cp ${sentryNativeRoot}/install/lib/*.lib ${sentryArtifactsDestination}/lib
1919
cp ${sentryNativeRoot}/install/bin/crashpad_handler.exe ${sentryArtifactsDestination}/bin/crashpad_handler.exe
20+
cp ${sentryNativeRoot}/install/bin/crashpad_wer.dll ${sentryArtifactsDestination}/bin/crashpad_wer.dll
2021
cp ${sentryNativeRoot}/install/include/sentry.h ${sentryArtifactsDestination}/include/sentry.h

scripts/packaging/pack.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function packFiles([string] $publishingPlatform)
2424
'upload-debug-symbols-win.bat',
2525
'upload-debug-symbols.sh',
2626
'crashpad_handler.exe'
27+
'crashpad_wer.dll'
2728
)
2829
}
2930

scripts/packaging/package-github.snapshot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ Source/ThirdParty/Win64/Breakpad/include/sentry.h
414414
Source/ThirdParty/Win64/Breakpad/lib/breakpad_client.lib
415415
Source/ThirdParty/Win64/Breakpad/lib/sentry.lib
416416
Source/ThirdParty/Win64/Crashpad/bin/crashpad_handler.exe
417+
Source/ThirdParty/Win64/Crashpad/bin/crashpad_wer.dll
417418
Source/ThirdParty/Win64/Crashpad/include/sentry.h
418419
Source/ThirdParty/Win64/Crashpad/lib/crashpad_client.lib
419420
Source/ThirdParty/Win64/Crashpad/lib/crashpad_compat.lib

scripts/packaging/test-contents.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,18 @@ function testFiles([string] $publishingPlatform)
2121
exit 2
2222
}
2323

24-
$packages = Get-ChildItem "$projectRoot/sentry-unreal-*-$publishingPlatform.zip"
24+
# TODO: Extract this functionality to share between `test-contents.ps1` and `pack.ps1`
25+
# See https://github.com/getsentry/sentry-unreal/issues/820 for more details.
26+
$pluginSpec = Get-Content "plugin-dev/Sentry.uplugin"
27+
$version = [regex]::Match("$pluginSpec", '"VersionName": "([^"]+)"').Groups[1].Value
28+
29+
Write-Host "Searching version $version release packages..."
30+
31+
$packages = Get-ChildItem -Path "$projectRoot/*" -Include "sentry-unreal-$version-engine*-$publishingPlatform.zip"
2532
$expectedPackagesCount = (Get-Content "$PSScriptRoot/engine-versions.txt").Length
2633
if ($packages.Length -ne $expectedPackagesCount)
2734
{
28-
throw "Invalid number of packages - expected $expectedPackagesCount, got $packages"
35+
throw "Invalid number of packages - expected $expectedPackagesCount, got $($packages.Length)"
2936
}
3037

3138
foreach ($packageFile in $packages)

0 commit comments

Comments
 (0)