Boost-Geometry-Utils
view release on metacpan or search on metacpan
src/boost/test/impl/execution_monitor.ipp view on Meta::CPAN
} // namespace detail
#if defined(BOOST_SIGACTION_BASED_SIGNAL_HANDLING)
// ************************************************************************** //
// ************** Sigaction based signal handling ************** //
// ************************************************************************** //
namespace detail {
// ************************************************************************** //
// ************** boost::detail::system_signal_exception ************** //
// ************************************************************************** //
class system_signal_exception {
public:
// Constructor
system_signal_exception()
: m_sig_info( 0 )
, m_context( 0 )
{}
// Access methods
void operator()( siginfo_t* i, void* c )
{
m_sig_info = i;
m_context = c;
}
void report() const;
private:
// Data members
siginfo_t* m_sig_info; // system signal detailed info
void* m_context; // signal context
};
//____________________________________________________________________________//
void
system_signal_exception::report() const
{
if( !m_sig_info )
return; // no error actually occur?
switch( m_sig_info->si_code ) {
case SI_USER:
report_error( execution_exception::system_error,
"signal: generated by kill() (or family); uid=%d; pid=%d",
(int)m_sig_info->si_uid, (int)m_sig_info->si_pid );
break;
case SI_QUEUE:
report_error( execution_exception::system_error,
"signal: sent by sigqueue()" );
break;
case SI_TIMER:
report_error( execution_exception::system_error,
"signal: the expiration of a timer set by timer_settimer()" );
break;
case SI_ASYNCIO:
report_error( execution_exception::system_error,
"signal: generated by the completion of an asynchronous I/O request" );
break;
case SI_MESGQ:
report_error( execution_exception::system_error,
"signal: generated by the the arrival of a message on an empty message queue" );
break;
default:
break;
}
switch( m_sig_info->si_signo ) {
case SIGILL:
switch( m_sig_info->si_code ) {
#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS
case ILL_ILLOPC:
report_error( execution_exception::system_fatal_error,
"signal: illegal opcode; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
case ILL_ILLTRP:
report_error( execution_exception::system_fatal_error,
"signal: illegal trap; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
case ILL_PRVREG:
report_error( execution_exception::system_fatal_error,
"signal: privileged register; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
case ILL_BADSTK:
report_error( execution_exception::system_fatal_error,
"signal: internal stack error; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
#endif
case ILL_ILLOPN:
report_error( execution_exception::system_fatal_error,
"signal: illegal operand; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
case ILL_ILLADR:
report_error( execution_exception::system_fatal_error,
"signal: illegal addressing mode; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
case ILL_PRVOPC:
report_error( execution_exception::system_fatal_error,
"signal: privileged opcode; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
case ILL_COPROC:
report_error( execution_exception::system_fatal_error,
"signal: co-processor error; address of failing instruction: 0x%08lx",
m_sig_info->si_addr );
break;
default:
report_error( execution_exception::system_fatal_error,
"signal: SIGILL, si_code: %d (illegal instruction; address of failing instruction: 0x%08lx)",
m_sig_info->si_addr, m_sig_info->si_code );
break;
}
src/boost/test/impl/execution_monitor.ipp view on Meta::CPAN
break;
case CLD_STOPPED:
report_error( execution_exception::system_error,
"child has stopped; pid: %d; uid: %d; exit value: %d",
(int)m_sig_info->si_pid, (int)m_sig_info->si_uid, (int)m_sig_info->si_status );
break;
case CLD_CONTINUED:
report_error( execution_exception::system_error,
"stopped child had continued; pid: %d; uid: %d; exit value: %d",
(int)m_sig_info->si_pid, (int)m_sig_info->si_uid, (int)m_sig_info->si_status );
break;
#endif
default:
report_error( execution_exception::system_error,
"signal: SIGCHLD, si_code: %d (child process has terminated; pid: %d; uid: %d; exit value: %d)",
(int)m_sig_info->si_pid, (int)m_sig_info->si_uid, (int)m_sig_info->si_status, m_sig_info->si_code );
break;
}
break;
#if defined(BOOST_TEST_CATCH_SIGPOLL)
case SIGPOLL:
switch( m_sig_info->si_code ) {
#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS
case POLL_IN:
report_error( execution_exception::system_error,
"data input available; band event %d",
(int)m_sig_info->si_band );
break;
case POLL_OUT:
report_error( execution_exception::system_error,
"output buffers available; band event %d",
(int)m_sig_info->si_band );
break;
case POLL_MSG:
report_error( execution_exception::system_error,
"input message available; band event %d",
(int)m_sig_info->si_band );
break;
case POLL_ERR:
report_error( execution_exception::system_error,
"i/o error; band event %d",
(int)m_sig_info->si_band );
break;
case POLL_PRI:
report_error( execution_exception::system_error,
"high priority input available; band event %d",
(int)m_sig_info->si_band );
break;
#if defined(POLL_ERR) && defined(POLL_HUP) && (POLL_ERR - POLL_HUP)
case POLL_HUP:
report_error( execution_exception::system_error,
"device disconnected; band event %d",
(int)m_sig_info->si_band );
break;
#endif
#endif
default:
report_error( execution_exception::system_error,
"signal: SIGPOLL, si_code: %d (asynchronous I/O event occured; band event %d)",
(int)m_sig_info->si_band, m_sig_info->si_code );
break;
}
break;
#endif
case SIGABRT:
report_error( execution_exception::system_error,
"signal: SIGABRT (application abort requested)" );
break;
case SIGALRM:
report_error( execution_exception::timeout_error,
"signal: SIGALRM (timeout while executing function)" );
break;
default:
report_error( execution_exception::system_error, "unrecognized signal" );
}
}
//____________________________________________________________________________//
// ************************************************************************** //
// ************** boost::detail::signal_action ************** //
// ************************************************************************** //
// Forward declaration
extern "C" {
static void execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context );
static void execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context );
}
class signal_action {
typedef struct sigaction* sigaction_ptr;
public:
//Constructor
signal_action();
signal_action( int sig, bool install, bool attach_dbg, char* alt_stack );
~signal_action();
private:
// Data members
int m_sig;
bool m_installed;
struct sigaction m_new_action;
struct sigaction m_old_action;
};
//____________________________________________________________________________//
signal_action::signal_action()
: m_installed( false )
{}
//____________________________________________________________________________//
signal_action::signal_action( int sig, bool install, bool attach_dbg, char* alt_stack )
: m_sig( sig )
( run in 0.952 second using v1.01-cache-2.11-cpan-39bf76dae61 )