Consider this scenario:
There is an Android app that does stuff, which could be in different threads. Some of these may cause segmentation violations (SIGSEGV's). I want to be able to catch all of the violations, irrespective of the thread that caused it, from a signal handler written in C using NDK.
Actually, I have written such handler by using sigaction
.
And it works but only for the thread that will run the NDK code.
This is because SIGSEGVs are delivered to the thread that caused the violation, in contrary with let's say SIGKILL which is delivered to the process.
As a result, my handler does not receive SIGSEGVs caused by other threads, and the program gets killed.
Is there a way to cause all SIGSEGVs to be redirected to my handler? Or, alternatively, a way to override the default handler for ALL the threads?
And yes, there is a reason I want this particular thing in the way I have describe it! ;)