Fix snapshot code
[model-checker.git] / common.h
index 367dc6b2b00098b9380e400bea68e69771f91e8c..7be72d72f8e0b56fc8f333ffe25489685b053f60 100644 (file)
--- a/common.h
+++ b/common.h
@@ -9,8 +9,9 @@
 #include "config.h"
 
 extern int model_out;
+extern int switch_alloc;
 
-#define model_print(fmt, ...) do { dprintf(model_out, fmt, ##__VA_ARGS__); } while (0)
+#define model_print(fmt, ...) do { switch_alloc = 1; dprintf(model_out, fmt, ##__VA_ARGS__); switch_alloc = 0; } while (0)
 
 #ifdef CONFIG_DEBUG
 #define DEBUG(fmt, ...) do { model_print("*** %15s:%-4d %25s() *** " fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__); } while (0)
@@ -29,7 +30,7 @@ void assert_hook(void);
 do { \
        if (!(expr)) { \
                fprintf(stderr, "Error: assertion failed in %s at line %d\n", __FILE__, __LINE__); \
-               print_trace(); \
+               /* print_trace(); // Trace printing may cause dynamic memory allocation */ \
                assert_hook();                           \
                exit(EXIT_FAILURE); \
        } \