trick/trick_source/sim_services/Executive/fpe_handler.cpp

43 lines
903 B
C++
Raw Permalink Normal View History

/*
2015-02-26 15:02:31 +00:00
PURPOSE: (Floating point exception handler)
PROGRAMMERS: (((Robert W. Bailey) (LinCom) (April 1992) (--) (Realtime)))
*/
#include <string.h>
#include <stdio.h>
#include <signal.h>
/*
* FPE specific headers
2015-02-26 15:02:31 +00:00
*/
#ifdef __linux
#include <fenv.h>
#endif
#include "trick/Executive.hh"
#include "trick/exec_proto.hh"
2015-02-26 15:02:31 +00:00
/**
* @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) ;
2015-02-26 15:02:31 +00:00
}