Redirect output after taking snapshots
[c11tester.git] / history.cc
index 7fab503bc48e5056f4ec68ae260bfb35e73b9ebd..f82d69dbae44daf77c66b23595fb0e941009dd4b 100644 (file)
 /** @brief Constructor */
 ModelHistory::ModelHistory() :
        func_counter(1),        /* function id starts with 1 */
+       last_seq_number(-1),
        func_map(),
        func_map_rev(),
-       func_nodes(),
-       last_action(NULL)
+       func_nodes()
 {
        /* The following are snapshot data structures */
        write_history = new HashTable<void *, value_set_t *, uintptr_t, 0>();
@@ -147,23 +147,8 @@ void ModelHistory::process_action(ModelAction *act, thread_id_t tid)
        FuncNode * func_node = func_nodes[func_id];
        func_node->add_inst(act);
 
-       if (act->is_read()) {
-               // Do nothing
-       } else if (act->is_write()) {
-               /*
-               Predicate * curr_pred = func_node->get_predicate_tree_position(tid);
-               FuncInst * curr_inst = func_node->get_inst(act);
-
-               if (curr_pred) {
-                       // Follow child
-                       curr_pred = curr_pred->follow_write_child(curr_inst);
-               }
-               func_node->set_predicate_tree_position(tid, curr_pred);
-               */
-       }
-
        func_node->update_tree(act);
-       last_action = act;
+       last_seq_number = act->get_seq_number();
 }
 
 /* Return the FuncNode given its func_id  */
@@ -406,10 +391,8 @@ bool ModelHistory::skip_action(ModelAction * act)
                return true;
 
        /* Skip actions with the same sequence number */
-       if (last_action != NULL) {
-               if (last_action->get_seq_number() == curr_seq_number)
-                       return true;
-       }
+       if (last_seq_number != -1 && last_seq_number == curr_seq_number)
+               return true;
 
        /* Skip actions that are paused by fuzzer (sequence number is 0) */
        if (curr_seq_number == 0)