--- execution_monitor.ipp.0 Thu Oct 23 21:29:32 2008 +++ execution_monitor.ipp Thu Oct 23 21:10:49 2008 @@ -147,6 +147,13 @@ # define BOOST_TEST_ALT_STACK_SIZE SIGSTKSZ # endif +# if defined(__FreeBSD__) +# if __FreeBSD_version <= 70000 +# define BOOST_SKIP_SIGNAL_TESTS +# define SIGPOLL 23 +# endif +# endif + #else # define BOOST_NO_SIGNAL_HANDLING @@ -157,6 +164,17 @@ #include #endif +// Some OSes like older versions of FreeBSD do not +// support setting optional SIGNAL subcodes +#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 + #include //____________________________________________________________________________// @@ -278,6 +296,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", @@ -318,11 +337,16 @@ "signal: internal stack error; address of failing instruction: 0x%08lx", m_sig_info->si_addr ); break; +#endif /* BOOST_SKIP_SIGILL_TESTS */ + default: + report_error( execution_exception::system_fatal_error, + "signal: SIGILL (llegal instruction)" ); + break; } - break; case SIGFPE: 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", @@ -363,11 +387,16 @@ "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)" ); + 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", @@ -378,11 +407,17 @@ "memory access violation at address: 0x%08lx: invalid permissions", m_sig_info->si_addr ); break; + default: + report_error( execution_exception::system_fatal_error, + "signal: SIGSEGV (invalid memory reference or segmentation fault)" ); + break; + } +#endif /* BOOST_SKIP_SIGSEGV_TESTS */ } - 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", @@ -398,11 +433,16 @@ "memory access violation at address: 0x%08lx: object specific hardware error", m_sig_info->si_addr ); break; +#endif /* BOOST_SKIP_SIGBUS_TESTS */ + default: + report_error( execution_exception::system_fatal_error, + "signal: SIGSEGV (invalid memory reference or segmentation fault)" ); + break; } - 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", @@ -433,13 +473,18 @@ "stopped child had continued; pid: %d; uid: %d; exit value: %d", (int)m_sig_info->si_uid, (int)m_sig_info->si_pid, (int)m_sig_info->si_status ); break; +#endif /* BOOST_SKIP_SIGCHLD_TESTS */ + default: + report_error( execution_exception::system_error, + "signal: SIGSEGV (child process has terminated)" ); + break; } - 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", @@ -470,11 +515,13 @@ "device disconnected; band event %d", (int)m_sig_info->si_band ); break; +#endif /* BOOST_SKIP_SIGPOLL_TESTS */ + default: + report_error( execution_exception::system_error, + "signal: SIGPOLL (asynchronous I/O event occured)" ); } - break; - -#endif +#endif /* BOOST_TEST_CATCH_SIGPOLL */ case SIGABRT: report_error( execution_exception::system_error, "signal: SIGABRT (application abort requested)" ); @@ -484,7 +531,6 @@ report_error( execution_exception::timeout_error, "signal: SIGALRM (timeout while executing function)" ); break; - default: report_error( execution_exception::system_error, "unrecognized signal" ); }