Optional debug aid of trapping SIGINT

Normally ifdef'ed out.
This commit is contained in:
Stephen Williams 2009-12-11 08:01:49 -08:00
parent 4cda5ae6e9
commit 7403dab028
1 changed files with 18 additions and 0 deletions

18
main.cc
View File

@ -75,6 +75,20 @@ extern "C" int optind;
extern "C" const char*optarg; extern "C" const char*optarg;
#endif #endif
#if defined(TRAP_SIGINT_FOR_DEBUG)
/*
* This is a debugging aid. Do not compile it in general, but leave it
* here for those days when I need the ability to cleanly exit on a
* signal interrupt.
*/
# include <signal.h>
static void signals_handler(int sig)
{
fprintf(stderr, "Exit on signal %d\n", sig);
exit(1);
}
#endif
/* Count errors detected in flag processing. */ /* Count errors detected in flag processing. */
unsigned flag_errors = 0; unsigned flag_errors = 0;
@ -612,6 +626,10 @@ int main(int argc, char*argv[])
struct tms cycles[5]; struct tms cycles[5];
#if defined(TRAP_SIGINT_FOR_DEBUG)
signal(SIGINT, &signals_handler);
#endif
library_suff.push_back(strdup(".v")); library_suff.push_back(strdup(".v"));
vpi_module_list = strdup("system"); vpi_module_list = strdup("system");