--- execution_monitor.ipp.0 Sat Oct 25 10:54:54 2008 +++ execution_monitor.ipp Sat Oct 25 10:54:19 2008 @@ -148,6 +148,13 @@ # define BOOST_TEST_USE_ALT_STACK # endif +# if defined(__FreeBSD__) +# if __FreeBSD_version <= 70000 +# define BOOST_SKIP_SIGNAL_TESTS +# define BOOST_TEST_IGNORE_NON_ZERO_CHILD_CODE +# endif +# endif + # if defined(SIGPOLL) && !defined(__CYGWIN__) && \ !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && \ !defined(__NetBSD__) && \ @@ -155,6 +162,15 @@ # define BOOST_TEST_CATCH_SIGPOLL # endif +#ifdef BOOST_SKIP_SIGNAL_TESTS +# define BOOST_SKIP_SIGILL_TESTS +# define BOOST_SKIP_SIGFPE_TESTS +# define BOOST_SKIP_SIGSEGV_TESTS +# define BOOST_SKIP_SIGBUS_TESTS +# define BOOST_SKIP_SIGCHLD_TESTS +# define BOOST_SKIP_SIGPOLL_TESTS +#endif + # ifdef BOOST_TEST_USE_ALT_STACK # define BOOST_TEST_ALT_STACK_SIZE SIGSTKSZ # endif @@ -290,6 +306,7 @@ switch( m_sig_info->si_signo ) { case SIGILL: switch( m_sig_info->si_code ) { +#ifndef BOOST_SKIP_SIGILL_TESTS case ILL_ILLOPC: report_error( execution_exception::system_fatal_error, "signal: illegal opcode; address of failing instruction: 0x%08lx", @@ -329,12 +346,18 @@ report_error( execution_exception::system_fatal_error, "signal: internal stack error; address of failing instruction: 0x%08lx", m_sig_info->si_addr ); - break; - } - break; + break; +#endif /* BOOST_SKIP_SIGILL_TESTS */ + default: + report_error( execution_exception::system_fatal_error, + "signal: SIGILL (llegal instruction; address of failing instruction: 0x%08lx)", + m_sig_info->si_addr ); + break; + } case SIGFPE: - switch( m_sig_info->si_code ) { + switch( m_sig_info->si_code ) { +#ifndef BOOST_SKIP_SIGFPE_TESTS case FPE_INTDIV: report_error( execution_exception::system_error, "signal: integer divide by zero; address of failing instruction: 0x%08lx", @@ -375,11 +398,17 @@ "signal: subscript out of range; address of failing instruction: 0x%08lx", m_sig_info->si_addr ); break; +#endif /* BOOST_SKIP_SIGFPE_TESTS */ + default: + report_error( execution_exception::system_error, + "signal: SIGFPE (errnoneous arithmetic operations; address of failing instruction: 0x%08lx)", + m_sig_info->si_addr ); + break; } - break; case SIGSEGV: switch( m_sig_info->si_code ) { +#ifndef BOOST_SKIP_SIGSEGV_TESTS case SEGV_MAPERR: report_error( execution_exception::system_fatal_error, "memory access violation at address: 0x%08lx: no mapping at fault address", @@ -390,11 +419,17 @@ "memory access violation at address: 0x%08lx: invalid permissions", m_sig_info->si_addr ); break; +#endif /* BOOST_SKIP_SIGSEGV_TESTS */ + default: + report_error( execution_exception::system_fatal_error, + "signal: SIGSEGV (memory access violation at address: 0x%08lx: invalid permissions)", + m_sig_info->si_addr ); + break; } - break; case SIGBUS: switch( m_sig_info->si_code ) { +#ifndef BOOST_SKIP_SIGBUS_TESTS case BUS_ADRALN: report_error( execution_exception::system_fatal_error, "memory access violation at address: 0x%08lx: invalid address alignment", @@ -410,11 +445,17 @@ "memory access violation at address: 0x%08lx: object specific hardware error", m_sig_info->si_addr ); break; - } - break; +#endif /* BOOST_SKIP_SIGBUS_TESTS */ + default: + report_error( execution_exception::system_fatal_error, + "signal: SIGBUS (memory access violation at address: 0x%08lx: object specific hardware error)", + m_sig_info->si_addr ); + break; + } case SIGCHLD: switch( m_sig_info->si_code ) { +#ifndef BOOST_SKIP_SIGCHLD_TESTS case CLD_EXITED: report_error( execution_exception::system_error, "child has exited; pid: %d; uid: %d; exit value: %d", @@ -445,13 +486,19 @@ "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; - } - break; +#endif /* BOOST_SKIP_SIGCHLD_TESTS */ + default: + report_error( execution_exception::system_error, + "signal: SIGSEGV (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 ); + break; + } #if defined(BOOST_TEST_CATCH_SIGPOLL) case SIGPOLL: switch( m_sig_info->si_code ) { +#ifndef BOOST_SKIP_SIGPOLL_TESTS case POLL_IN: report_error( execution_exception::system_error, "data input available; band event %d", @@ -484,10 +531,15 @@ (int)m_sig_info->si_band ); break; #endif +#endif /* BOOST_SKIP_SIGPOLL_TESTS */ + default: + report_error( execution_exception::system_error, + "signal: SIGPOLL (asynchronous I/O event occured; band event %d)", + (int)m_sig_info->si_band ); + break; } - break; -#endif +#endif /* BOOST_TEST_CATCH_SIGPOLL */ case SIGABRT: report_error( execution_exception::system_error, @@ -695,11 +747,11 @@ static bool ignore_sigchild( siginfo_t* info ) { - return info->si_signo == SIGCHLD && info->si_code == CLD_EXITED + return info->si_signo == SIGCHLD #ifdef BOOST_TEST_IGNORE_NON_ZERO_CHILD_CODE ; #else - && (int)info->si_status == 0; + && info->si_code == CLD_EXITED && (int)info->si_status == 0; #endif }