Installing Crash Handlers in Cobalt
Stay organized with collections
Save and categorize content based on your preferences.
Partners can install Crashpad's crash handlers to create crash reports in the
cache directory. This is done by:
- Adding the following files to the
starboard_platform
target's sources:
'<(DEPTH)/starboard/shared/starboard/crash_handler.cc',
'<(DEPTH)/starboard/shared/starboard/crash_handler.h',
- Handling
kCobaltExtensionCrashHandlerName
in the implementation of
SbSystemGetExtension
:
#include "starboard/system.h"
#include "starboard/extension/crash_handler.h"
#include "starboard/shared/starboard/crash_handler.h"
...
const void* SbSystemGetExtension(const char* name) {
...
if (SbStringCompareAll(name, kCobaltExtensionCrashHandlerName) == 0) {
return starboard::common::GetCrashHandlerApi();
}
return NULL;
}
- Calling the
third_party::crashpad::wrapper::InstallCrashpadHandler()
hook
directly after installing system crash handlers. On linux, for example, this
could look like:
#include "third_party/crashpad/crashpad/wrapper/wrapper.h"
int main(int argc, char** argv) {
...
starboard::shared::signal::InstallCrashSignalHandlers();
starboard::shared::signal::InstallSuspendSignalHandlers();
std::string ca_certificates_path = starboard::common::GetCACertificatesPath();
third_party::crashpad::wrapper::InstallCrashpadHandler(ca_certificates_path);
int result = application.Run(argc, argv);
...
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-29 UTC."],[[["Partners can utilize Crashpad's crash handlers to generate crash reports within the cache directory."],["Integrating Crashpad involves adding `crash_handler.cc` and `crash_handler.h` to the `starboard_platform` target's sources."],["`SbSystemGetExtension` must handle `kCobaltExtensionCrashHandlerName` to enable crash handler functionality."],["The `InstallCrashpadHandler()` hook should be invoked immediately following the installation of system crash handlers."]]],["Partners implement crash reporting by adding `crash_handler.cc` and `crash_handler.h` to the `starboard_platform` target. They must also handle `kCobaltExtensionCrashHandlerName` within the `SbSystemGetExtension` function, returning `starboard::common::GetCrashHandlerApi()`. Finally, `InstallCrashpadHandler()` is called directly after installing system signal handlers, exemplified by `starboard::shared::signal::InstallCrashSignalHandlers()`, and providing the CA certificates path. This sets up Crashpad's crash handlers.\n"]]