diff options
author | Morgan Deters <mdeters@gmail.com> | 2010-03-05 08:26:37 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2010-03-05 08:26:37 +0000 |
commit | 88b52c971b43248e6ceacf1c8140a06427d0418d (patch) | |
tree | 4ee443c898a858fcdd658f3f043e4180eddd8784 /src/main/util.cpp | |
parent | 29cc307cdf2c42bebf4f5615874a864783f47fd0 (diff) |
* public/private code untangled (smt/smt_engine.h no longer #includes
expr/node.h). This removes the warnings we had during compilation,
and heads off a number of potential linking errors due to improper
inlining of private (library-only) stuff in client (out-of-library)
code.
* "configure" now takes some options as part of a "bare-option" build
type (e.g., "./configure debug-coverage" or "./configure production-muzzle").
* split cdo.h, cdlist.h, cdmap.h, and cdset.h from context.h
* split cdlist_black unit test from context_black
* implement CDMap<>.
* give ExprManagers ownership of the context (and have SmtEngine share
that one)
* fix main driver to properly report file-not-found
* fix MemoryMappedInputBuffer class to report reasons for
"errno"-returned system errors
* src/expr/attribute.h: context-dependent attribute kinds now
supported
* test/unit/expr/node_white.h: context-dependent attribute tests
* src/prop/cnf_conversion.h and associated parts of src/util/options.h
and src/main/getopt.cpp: obsolete command-line option, removed.
* src/util/Assert.h: assertions are now somewhat more useful (in debug
builds, anyway) during stack unwinding.
* test/unit/theory/theory_black.h: test context-dependent behavior of
registerTerm() attribute for theories
* src/expr/node_builder.h: formatting, fixes for arithmetic
convenience node builders, check memory allocations
* test/unit/expr/node_builder_black.h: add tessts for addition,
subtraction, unary minus, and multiplication convenience node
builders
* src/expr/attribute.h: more comments
* (various) code formatting, comment cleanup, added throws specifier
to some destructors
* contrib/code-checker: prototype perl script to test (some) code policy
* contrib/indent-settings: command line for GNU indent to indent using
CVC4 style (sort of; this is a work in progress)
* COPYING: legal stuff
* DESIGN_QUESTIONS: obsolete, removed
Diffstat (limited to 'src/main/util.cpp')
-rw-r--r-- | src/main/util.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main/util.cpp b/src/main/util.cpp index adb117b9d..a2b46513d 100644 --- a/src/main/util.cpp +++ b/src/main/util.cpp @@ -16,6 +16,7 @@ #include <cstdio> #include <cstdlib> #include <cerrno> +#include <exception> #include <string.h> #include <signal.h> @@ -63,6 +64,45 @@ void segv_handler(int sig, siginfo_t* info, void*) { #endif /* CVC4_DEBUG */ } +static terminate_handler default_terminator; + +void cvc4unexpected() { +#ifdef CVC4_DEBUG + fprintf(stderr, + "\n" + "CVC4 threw an \"unexpected\" exception (one that wasn't properly specified\n" + "in the throws() specifier for the throwing function).\n\n"); + if(segvNoSpin) { + fprintf(stderr, "No-spin requested.\n"); + set_terminate(default_terminator); + } else { + fprintf(stderr, "Spinning so that a debugger can be connected.\n"); + fprintf(stderr, "Try: gdb %s %u\n", progName, getpid()); + for(;;) { + sleep(60); + } + } +#else /* CVC4_DEBUG */ + fprintf(stderr, "CVC4 threw an \"unexpected\" exception.\n"); + set_terminate(default_terminator); +#endif /* CVC4_DEBUG */ +} + +void cvc4terminate() { +#ifdef CVC4_DEBUG + fprintf(stderr, + "\n" + "CVC4 was terminated by the C++ runtime.\n" + "Perhaps an exception was thrown during stack unwinding. (Don't do that.)\n"); + default_terminator(); +#else /* CVC4_DEBUG */ + fprintf(stderr, + "CVC4 was terminated by the C++ runtime.\n" + "Perhaps an exception was thrown during stack unwinding.\n"); + default_terminator(); +#endif /* CVC4_DEBUG */ +} + /** Initialize the driver. Sets signal handlers for SIGINT and SIGSEGV. */ void cvc4_init() throw() { struct sigaction act1; @@ -78,6 +118,9 @@ void cvc4_init() throw() { sigemptyset(&act2.sa_mask); if(sigaction(SIGSEGV, &act2, NULL)) throw Exception(string("sigaction(SIGSEGV) failure: ") + strerror(errno)); + + set_unexpected(cvc4unexpected); + default_terminator = set_terminate(cvc4terminate); } }/* CVC4::main namespace */ |