Crashlytics NDK not report crashes if I use my custom crash handler

  android, android-ndk, c++, crash, crashlytics

I use Crashlytics NDK.
I add my crash handlers – sigaction for signals(SIGABRT, SIGSEG etc) in game thread.
After that Crashlytics stop reporting crashes on some devices(Xiaomi Mi 9T pro – crash reported, Samsung S8 – crash not reported).

How I can force to work together Crashlytics NDK crash handlers and my custom crash handlers?

This is my custom crash handlers:

static const int SIGNALS_TO_CATCH[] =
  {
      SIGABRT,
      SIGBUS,
      SIGFPE,
      SIGSEGV,
      SIGILL,
      SIGSTKFLT,
      SIGTRAP,
    };
    static struct sigaction old_handlers[NSIG];
    
    void crash_handler(int signal, siginfo* info, void* ctxvoid)
    {
        android_fatal() << "CRASH OCCURED!!" << signal;
        sigaction(signal, &old_handlers[signal], nullptr);
    }

This is registration

struct sigaction sigaction_struct;
memset(&sigaction_struct, 0, sizeof(sigaction_struct));
sigaction_struct.sa_flags = SA_SIGINFO;
sigaction_struct.sa_sigaction = crash_handler;

for (auto signal : SIGNALS_TO_CATCH)
    sigaction(signal, &sigaction_struct, &old_handlers[signal])

Source: Windows Questions C++

LEAVE A COMMENT