#include <stdio.h>
#include <stdlib.h>
+#include <model-assert.h>
+
#include "common.h"
#include "model.h"
#include "stacktrace.h"
{
printf("Add breakpoint to line %u in file %s.\n",__LINE__,__FILE__);
}
+
+void model_assert(bool expr, const char *file, int line)
+{
+ if (!expr) {
+ printf(" [BUG] Program has hit assertion in file %s at line %d\n",
+ file, line);
+ model->set_assert();
+ }
+}
--- /dev/null
+#ifndef __MODEL_ASSERT_H__
+#define __MODEL_ASSERT_H__
+
+#if __cplusplus
+extern "C" {
+#endif
+
+void model_assert(bool expr, const char *file, int line);
+#define MODEL_ASSERT(expr) model_assert((expr), __FILE__, __LINE__)
+
+#if __cplusplus
+}
+#endif
+
+#endif /* __MODEL_ASSERT_H__ */