Crash: use SA_SIGINFO on Linux for enhanced crash diagnostics

Switch signal handler registration from signal() to sigaction(SA_SIGINFO)
on Linux to capture fault address, signal code description, and program
counter at crash time. These are logged to the file logger and included
in OpenTelemetry crash reports.
This commit is contained in:
Magne Sjaastad committed 2026-03-23 10:30:14 +01:00
1 parent 20052771ad
commit 8df24c5bd3
4 files changed
+176 -14

No files matched your search

@@ -327,7 +327,7 @@ static std::string extractRelevantPath( const std::string& fullPath )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaOpenTelemetryManager::reportCrash( int signalCode, const std::stacktrace& trace )
void RiaOpenTelemetryManager::reportCrash( int signalCode, const std::stacktrace& trace, const std::map<std::string, std::string>& extraAttributes )
{
if ( !isEnabled() )
{
@@ -378,6 +378,12 @@ void RiaOpenTelemetryManager::reportCrash( int signalCode, const std::stacktrace
attributes["service.name"] = RiaPreferencesOpenTelemetry::current()->serviceName().toStdString();
attributes["service.version"] = RiaPreferencesOpenTelemetry::current()->serviceVersion().toStdString();
// Merge platform-specific crash context (fault address, signal code, program counter)
for ( const auto& [key, value] : extraAttributes )
{
attributes[key] = value;
}
// Add system information
addOsInfo( attributes );
@@ -88,7 +88,7 @@ public:
// Event reporting
void reportEventAsync( const std::string& eventName, const std::map<std::string, std::string>& attributes );
void reportCrash( int signalCode, const std::stacktrace& trace );
void reportCrash( int signalCode, const std::stacktrace& trace, const std::map<std::string, std::string>& extraAttributes = {} );
// Configuration
bool isEnabled() const;