Frequently Asked Question

Linux crash handler
Last Updated 2 years ago

Please note that when you use KYFG_StreamCreateAndAlloc(), and memory buffers are allocated by our library, they are marked as such (to distinguish with a scenario when buffers were allocated by the user program, announced using KYFG_BufferAnnounce() and thus should also be released by the user program). These buffers are released by our library when the user calls KYFG_StreamDelete(), which should be done by the user's application. If you do not call KYFG_StreamDelete(), it will be internally called by the KYFG_CameraClose(), which also should be done by the user's application. If, for some reason, you also do not call KYFG_CameraClose(), it will be internally called by the KYFG_Close(), which your application must call at some point.
We would like to emphasize that your application should not rely on those automatic internal calls. Instead, to fully comply with our API specification, your application should explicitly call KYFG_StreamDelete() for each stream it created with KYFG_StreamCreateAndAlloc() or KYFG_StreamCreate(), then KYFG_CameraClose() for each camera and KYFG_Close() for the frame grabber.

How to implement the crash handler

Plesae reffer to https://man7.org/linux/man-pages/man7/signal.7.html and https://man7.org/linux/man-pages/man2/sigaction.2.html
for details

Code sample 1:
signal(SIGSEGV, handler);   // install our handler
Code sample 2:
void setApplicationCrashHandler (CrashHandlerFunction handler)
{
jassert (handler != nullptr); // This must be a valid function.
globalCrashHandler = handler;

const int signals[] = { SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGABRT, SIGSYS };

for (int i = 0; i {
signal (signals[i], handleCrash);
}
}
(https://www.programcreek.com/cpp/?CodeExample=crash+handler)
see also https://devarea.com/linux-writing-fault-handlers/#.Y0a42nZByUk


Please Wait!

Please wait... it will take a second!