Skip to content
Snippets Groups Projects
Commit 262bd6e8 authored by Tomáš Pecka's avatar Tomáš Pecka
Browse files

SigHandler: Reraise signal #137

parent 7f659ebd
No related branches found
No related tags found
No related merge requests found
#include <stdio.h>
#include <execinfo.h>
#include <signal.h>
#include <stdlib.h>
#include <cstdio>
#include <csignal>
#include <cstdlib>
#include <cstring>
#include <unistd.h>
#include <execinfo.h>
 
#include "sigHandler.h"
#include "simpleStacktrace.h"
#include <alib/iostream>
#include <global/GlobalData.h>
 
namespace ext {
 
#ifdef DEBUG
void SigHandler::handler(int signal) {
switch(signal) {
case SIGSEGV:
common::Streams::out << "Segmentation fault" << std::endl;
break;
case SIGINT:
common::Streams::out << "Interrupted" << std::endl;
break;
default:
common::Streams::out << "Unknown signal" << std::endl;
break;
}
void SigHandler::handler(int sigNo) {
const char * sigStr = strsignal ( sigNo );
if ( sigStr )
common::Streams::out << strsignal ( sigNo ) << std::endl;
else
common::Streams::out << "Unknown signal (" << sigNo << ")" << std::endl;
common::Streams::out << ext::simpleStacktrace() << std::endl;
exit(1);
/* reraise */
signal ( sigNo, SIG_DFL );
raise ( sigNo );
// exit ( EXIT_FAILURE );
}
#else
void SigHandler::handler ( int ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment