#include <stdlib.h>
#include "common.h"
+#include "model.h"
#define MAX_TRACE_LEN 100
free(strings);
}
+
+void model_print_summary(void)
+{
+ model->print_summary();
+}
do { \
if (!(expr)) { \
fprintf(stderr, "Error: assertion failed in %s at line %d\n", __FILE__, __LINE__); \
+ print_trace(); \
+ model_print_summary(); \
exit(EXIT_FAILURE); \
} \
} while (0);
#define error_msg(...) fprintf(stderr, "Error: " __VA_ARGS__)
void print_trace(void);
+void model_print_summary(void);
#endif /* __COMMON_H__ */
void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) {
ASSERT(from);
ASSERT(to);
+ ASSERT(from != to);
CycleNode *fromnode=getNode(from);
CycleNode *tonode=getNode(to);
void CycleGraph::addRMWEdge(const ModelAction *from, const ModelAction *rmw) {
ASSERT(from);
ASSERT(rmw);
+ ASSERT(from != rmw);
CycleNode *fromnode=getNode(from);
CycleNode *rmwnode=getNode(rmw);
/** @returns whether the current partial trace is feasible other than
* multiple RMW reading from the same store. */
bool ModelChecker::isfeasibleotherthanRMW() {
+ if (DBG_ENABLED()) {
+ if (mo_graph->checkForCycles())
+ DEBUG("Infeasible: modification order cycles\n");
+ if (failed_promise)
+ DEBUG("Infeasible: failed promise\n");
+ if (too_many_reads)
+ DEBUG("Infeasible: too many reads\n");
+ if (promises_expired())
+ DEBUG("Infeasible: promises expired\n");
+ }
return !mo_graph->checkForCycles() && !failed_promise && !too_many_reads && !promises_expired();
}
/** Returns whether the current completed trace is feasible. */
bool ModelChecker::isfinalfeasible() {
+ if (DBG_ENABLED() && promises->size() != 0)
+ DEBUG("Infeasible: unrevolved promises\n");
+
return isfeasible() && promises->size() == 0;
}