-void printRace(struct DataRace * race) {
- printf("Datarace detected\n");
- printf("Location %p\n", race->address);
- printf("Initial access: thread %u clock %u, iswrite %u\n",race->oldthread,race->oldclock, race->isoldwrite);
- printf("Second access: thread %u, iswrite %u\n", race->newaction->get_tid(), race->isnewwrite);
+/**
+ * @brief Assert a data race
+ *
+ * Asserts a data race which is currently realized, causing the execution to
+ * end and stashing a message in the model-checker's bug list
+ *
+ * @param race The race to report
+ */
+void assert_race(struct DataRace *race)
+{
+ char buf[200];
+ char *ptr = buf;
+ ptr += sprintf(ptr, "Data race detected @ address %p:\n", race->address);
+ ptr += sprintf(ptr, " Access 1: %5s in thread %2d @ clock %3u\n",
+ race->isoldwrite ? "write" : "read",
+ id_to_int(race->oldthread), race->oldclock);
+ ptr += sprintf(ptr, " Access 2: %5s in thread %2d @ clock %3u",
+ race->isnewwrite ? "write" : "read",
+ id_to_int(race->newaction->get_tid()), race->newaction->get_seq_number());
+ model->assert_bug(buf);