X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=common.cc;h=b71c00ab804e5a7b1817790ac825791761b8f0d8;hb=d70f6f259c9850e5fceb527e3a9541c440c0146b;hp=f8df1335b00cbe57001d4efacea2191134a4653c;hpb=da1e23074c6f5712e617151a110e80078492d413;p=model-checker.git diff --git a/common.cc b/common.cc index f8df133..b71c00a 100644 --- a/common.cc +++ b/common.cc @@ -14,15 +14,15 @@ #define MAX_TRACE_LEN 100 -FILE *model_out; -int fd_user_out; /**< @brief File descriptor from which to read user program output */ +/** @brief Model-checker output stream; default to stdout until redirected */ +FILE *model_out = stdout; #define CONFIG_STACKTRACE /** Print a backtrace of the current program state. */ void print_trace(void) { #ifdef CONFIG_STACKTRACE - print_stacktrace(stdout); + print_stacktrace(model_out); #else void *array[MAX_TRACE_LEN]; char **strings; @@ -47,7 +47,7 @@ void model_print_summary(void) void assert_hook(void) { - model_print("Add breakpoint to line %u in file %s.\n",__LINE__,__FILE__); + model_print("Add breakpoint to line %u in file %s.\n", __LINE__, __FILE__); } void model_assert(bool expr, const char *file, int line) @@ -60,6 +60,10 @@ void model_assert(bool expr, const char *file, int line) } } +#ifndef CONFIG_DEBUG + +static int fd_user_out; /**< @brief File descriptor from which to read user program output */ + /** * @brief Setup output redirecting * @@ -161,3 +165,4 @@ void print_program_output() } } } +#endif /* ! CONFIG_DEBUG */