2015-02-26 09:02:31 -06:00

48 lines
1.0 KiB
C++

/*
PURPOSE: (Floating point exception handler)
PROGRAMMERS: (((Robert W. Bailey) (LinCom) (April 1992) (--) (Realtime)))
*/
/*
* $Id: fpe_handler.cpp 2317 2012-04-16 16:13:19Z alin $
*/
#include <string.h>
#include <stdio.h>
#include <signal.h>
/*
* FPE specific headers
*/
#ifdef __linux
#include <fenv.h>
#endif
#include "sim_services/Executive/include/Executive.hh"
#include "sim_services/Executive/include/exec_proto.hh"
/**
* @relates Trick::Executive
* C binded function to handle the SIGFPE signal. The handler prints which type of
* floating point error has occured and calls exec_terminate()
* @return void
*/
#if (__APPLE__ | __CYGWIN__ | __INTERIX )
void fpe_sig_handler(int sig __attribute__ ((unused)) )
#else
void fpe_sig_handler(int sig __attribute__ ((unused)), siginfo_t * sip __attribute__ ((unused)), void *uap __attribute__ ((unused)))
#endif
{
Trick::Executive * E = exec_get_exec_cpp();
#if __APPLE__
siginfo_t * sip = NULL ;
#endif
E->fpe_handler(sip) ;
}