From 298510d3ab0dc8280e9648c7b13e7c77258e9f3b Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 19 Apr 2012 12:56:21 -0700 Subject: [PATCH] model: convert 'action_trace' to pointer We need to swap out this list with a new one when we reset, and we want to retain references to this list easily, so make the ModelChecker::action_trace member into a pointer to a list. --- model.cc | 8 +++++--- model.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/model.cc b/model.cc index 6493022..adc47cd 100644 --- a/model.cc +++ b/model.cc @@ -17,10 +17,12 @@ ModelChecker::ModelChecker() rootNode = new TreeNode(NULL); currentNode = rootNode; + action_trace = new std::list(); } ModelChecker::~ModelChecker() { + delete action_trace; delete this->scheduler; delete rootNode; } @@ -52,7 +54,7 @@ ModelAction *ModelChecker::get_last_conflict(ModelAction *act) break; } std::list::reverse_iterator rit; - for (rit = action_trace.rbegin(); rit != action_trace.rend(); rit++) { + for (rit = action_trace->rbegin(); rit != action_trace->rend(); rit++) { ModelAction *prev = *rit; if (prev->get_location() != loc) continue; @@ -105,7 +107,7 @@ void ModelChecker::check_current_action(void) next->set_node(currentNode); set_backtracking(next); currentNode = currentNode->exploreChild(next->get_tid()); - this->action_trace.push_back(next); + this->action_trace->push_back(next); } void ModelChecker::print_trace(void) @@ -116,7 +118,7 @@ void ModelChecker::print_trace(void) printf("---------------------------------------------------------------------\n"); printf("Total nodes created: %d\n\n", TreeNode::getTotalNodes()); - for (it = action_trace.begin(); it != action_trace.end(); it++) { + for (it = action_trace->begin(); it != action_trace->end(); it++) { DBG(); (*it)->print(); } diff --git a/model.h b/model.h index 152d83c..b62ab80 100644 --- a/model.h +++ b/model.h @@ -65,7 +65,7 @@ public: private: int used_thread_id; class ModelAction *current_action; - std::list action_trace; + std::list *action_trace; std::map thread_map; class TreeNode *rootNode, *currentNode; }; -- 2.34.1