Browse Source

Catch more "core-dumping" signals. Fixes #61 (SIGABRT)

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2379 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
nedko 17 years ago
parent
commit
7a97c8ab1c
1 changed files with 39 additions and 1 deletions
  1. +39
    -1
      linux/dbus/sigsegv.c

+ 39
- 1
linux/dbus/sigsegv.c View File

@@ -31,6 +31,8 @@
char * __cxa_demangle(const char * __mangled_name, char * __output_buffer, size_t * __length, int * __status); char * __cxa_demangle(const char * __mangled_name, char * __output_buffer, size_t * __length, int * __status);
#endif #endif


#include "JackError.h"

#if defined(REG_RIP) #if defined(REG_RIP)
# define SIGSEGV_STACK_IA64 # define SIGSEGV_STACK_IA64
# define REGFORMAT "%016lx" # define REGFORMAT "%016lx"
@@ -59,7 +61,27 @@ static void signal_segv(int signum, siginfo_t* info, void*ptr) {
size_t sz; size_t sz;
#endif #endif


jack_error("Segmentation Fault!");
if (signum == SIGSEGV)
{
jack_error("Segmentation Fault!");
}
else if (signum == SIGABRT)
{
jack_error("Abort!");
}
else if (signum == SIGILL)
{
jack_error("Illegal instruction!");
}
else if (signum == SIGFPE)
{
jack_error("Floating point exception!");
}
else
{
jack_error("Unknown bad signal catched!");
}

jack_error("info.si_signo = %d", signum); jack_error("info.si_signo = %d", signum);
jack_error("info.si_errno = %d", info->si_errno); jack_error("info.si_errno = %d", info->si_errno);
jack_error("info.si_code = %d (%s)", info->si_code, si_codes[info->si_code]); jack_error("info.si_code = %d (%s)", info->si_code, si_codes[info->si_code]);
@@ -122,6 +144,7 @@ static void signal_segv(int signum, siginfo_t* info, void*ptr) {


int setup_sigsegv() { int setup_sigsegv() {
struct sigaction action; struct sigaction action;

memset(&action, 0, sizeof(action)); memset(&action, 0, sizeof(action));
action.sa_sigaction = signal_segv; action.sa_sigaction = signal_segv;
action.sa_flags = SA_SIGINFO; action.sa_flags = SA_SIGINFO;
@@ -130,6 +153,21 @@ int setup_sigsegv() {
return 0; return 0;
} }


if(sigaction(SIGILL, &action, NULL) < 0) {
jack_error("sigaction failed. errno is %d (%s)", errno, strerror(errno));
return 0;
}

if(sigaction(SIGABRT, &action, NULL) < 0) {
jack_error("sigaction failed. errno is %d (%s)", errno, strerror(errno));
return 0;
}

if(sigaction(SIGFPE, &action, NULL) < 0) {
jack_error("sigaction failed. errno is %d (%s)", errno, strerror(errno));
return 0;
}

return 1; return 1;
} }




Loading…
Cancel
Save