MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / CrashHandler

Function CrashHandler

Source/ThirdParty/tracy/client/TracyProfiler.cpp:975–1164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

973}
974
975static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ )
976{
977 bool expected = false;
978 if( !s_alreadyCrashed.compare_exchange_strong( expected, true ) ) ThreadFreezer( signal );
979
980 struct sigaction act = {};
981 act.sa_handler = SIG_DFL;
982 sigaction( SIGABRT, &act, nullptr );
983
984 auto msgPtr = s_crashText;
985 switch( signal )
986 {
987 case SIGILL:
988 strcpy( msgPtr, "Illegal Instruction.\n" );
989 while( *msgPtr ) msgPtr++;
990 switch( info->si_code )
991 {
992 case ILL_ILLOPC:
993 strcpy( msgPtr, "Illegal opcode.\n" );
994 break;
995 case ILL_ILLOPN:
996 strcpy( msgPtr, "Illegal operand.\n" );
997 break;
998 case ILL_ILLADR:
999 strcpy( msgPtr, "Illegal addressing mode.\n" );
1000 break;
1001 case ILL_ILLTRP:
1002 strcpy( msgPtr, "Illegal trap.\n" );
1003 break;
1004 case ILL_PRVOPC:
1005 strcpy( msgPtr, "Privileged opcode.\n" );
1006 break;
1007 case ILL_PRVREG:
1008 strcpy( msgPtr, "Privileged register.\n" );
1009 break;
1010 case ILL_COPROC:
1011 strcpy( msgPtr, "Coprocessor error.\n" );
1012 break;
1013 case ILL_BADSTK:
1014 strcpy( msgPtr, "Internal stack error.\n" );
1015 break;
1016 default:
1017 break;
1018 }
1019 break;
1020 case SIGFPE:
1021 strcpy( msgPtr, "Floating-point exception.\n" );
1022 while( *msgPtr ) msgPtr++;
1023 switch( info->si_code )
1024 {
1025 case FPE_INTDIV:
1026 strcpy( msgPtr, "Integer divide by zero.\n" );
1027 break;
1028 case FPE_INTOVF:
1029 strcpy( msgPtr, "Integer overflow.\n" );
1030 break;
1031 case FPE_FLTDIV:
1032 strcpy( msgPtr, "Floating-point divide by zero.\n" );

Callers

nothing calls this directly

Calls 5

ThreadFreezerFunction · 0.85
HexPrintFunction · 0.85
GetTimeFunction · 0.85
SendCallstackMethod · 0.80
sigactionClass · 0.70

Tested by

no test coverage detected