diff options
| author | Stefan Boberg <[email protected]> | 2026-03-18 19:48:01 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-18 19:48:01 +0100 |
| commit | e854a69b99a08dd2f9ad1c236059c13c34cc44f5 (patch) | |
| tree | c6805a8530acc0f4d36dd68ae502a6d7eb6c0cc2 /src/zencore/include | |
| parent | Pre-initialization of default logger (#859) (diff) | |
| download | zen-e854a69b99a08dd2f9ad1c236059c13c34cc44f5.tar.xz zen-e854a69b99a08dd2f9ad1c236059c13c34cc44f5.zip | |
Add lightweight crash handler for pre-Sentry startup backtraces (#853)
- Install a crash handler at the very top of main() in both zenserver and zen
- On Windows, uses SetUnhandledExceptionFilter with StackWalk64 for accurate
crash-site backtraces with DbgHelp symbol resolution
- On Linux/Mac, uses sigaction with async-signal-safe backtrace output
- Automatically superseded when Sentry/crashpad installs its own handlers
- Stays active for the full process lifetime if Sentry is disabled or absent
- Include .sym debug symbol files in Linux release bundle
Diffstat (limited to 'src/zencore/include')
| -rw-r--r-- | src/zencore/include/zencore/crashhandler.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/zencore/include/zencore/crashhandler.h b/src/zencore/include/zencore/crashhandler.h new file mode 100644 index 000000000..bfb5c740e --- /dev/null +++ b/src/zencore/include/zencore/crashhandler.h @@ -0,0 +1,19 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#pragma once + +#include <zencore/zencore.h> + +namespace zen { + +/// Install a lightweight crash handler that prints backtraces to stderr. +/// +/// Call as early as possible in main(). On Windows, uses SetUnhandledExceptionFilter; +/// on Linux/Mac, installs signal handlers for SIGSEGV, SIGABRT, SIGFPE, SIGBUS, SIGILL. +/// +/// The handler is automatically superseded when a crash reporter such as Sentry +/// installs its own handlers. If no crash reporter is installed, this handler +/// remains active for the lifetime of the process. +void InstallCrashHandler(); + +} // namespace zen |