5 #include <model-assert.h>
9 #include "stacktrace.h"
11 #define MAX_TRACE_LEN 100
13 #define CONFIG_STACKTRACE
14 /** Print a backtrace of the current program state. */
15 void print_trace(void)
17 #ifdef CONFIG_STACKTRACE
18 print_stacktrace(stdout);
20 void *array[MAX_TRACE_LEN];
24 size = backtrace(array, MAX_TRACE_LEN);
25 strings = backtrace_symbols(array, size);
27 printf("\nDumping stack trace (%d frames):\n", size);
29 for (i = 0; i < size; i++)
30 printf("\t%s\n", strings[i]);
33 #endif /* CONFIG_STACKTRACE */
36 void model_print_summary(void)
38 model->print_summary();
41 void assert_hook(void)
43 printf("Add breakpoint to line %u in file %s.\n",__LINE__,__FILE__);
46 void model_assert(bool expr, const char *file, int line)
49 printf(" [BUG] Program has hit assertion in file %s at line %d\n",