model: add print_trace() function
authorBrian Norris <banorris@uci.edu>
Tue, 10 Apr 2012 22:51:05 +0000 (15:51 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 10 Apr 2012 22:51:05 +0000 (15:51 -0700)
Prints out the current program trace.

model.cc
model.h

index 41dc44d34a8a0626e1a82de4bb59023e88aaa1e3..62b2925dc0e4f46ba79df049500363c4f29d9fdc 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -39,6 +39,16 @@ void ModelChecker::check_current_action(void)
                DEBUG("trying to push NULL action...\n");
 }
 
+void ModelChecker::print_trace(void)
+{
+       std::list<class ModelAction *>::iterator it;
+
+       for (it = action_trace.begin(); it != action_trace.end(); it++) {
+               DBG();
+               (*it)->print();
+       }
+}
+
 ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, int value)
 {
        struct thread *t = thread_current();
diff --git a/model.h b/model.h
index aa7e9052c8dafcddec751fd4f237c6ecd4dd4945..14d4372da7943d5bc4eb4199145b1266f95f3d2c 100644 (file)
--- a/model.h
+++ b/model.h
@@ -41,6 +41,7 @@ public:
 
        void set_current_action(ModelAction *act) { current_action = act; }
        void check_current_action(void);
+       void print_trace(void);
 
 private:
        int used_thread_id;