datarace.o impatomic.o cmodelint.o \
snapshot.o malloc.o mymemory.o common.o mutex.o conditionvariable.o \
context.o execution.o libannotate.o plugins.o pthread.o futex.o fuzzer.o \
- sleeps.o history.o funcnode.o
- sleeps.o history.o printf.o
++ sleeps.o history.o funcnode.o printf.o
CPPFLAGS += -Iinclude -I.
LDFLAGS := -ldl -lrt -rdynamic
$(MARKDOWN) $< > $@
malloc.o: malloc.c
- $(CC) -fPIC -c malloc.c -DMSPACES -DONLY_MSPACES -DHAVE_MMAP=0 $(CPPFLAGS) -Wno-unused-variable
+ $(CC) -fPIC -c malloc.c -DMSPACES -DONLY_MSPACES -DHAVE_MMAP=1 $(CPPFLAGS) -Wno-unused-variable
-futex.o: futex.cc
- $(CXX) -fPIC -c futex.cc -std=c++11 $(CPPFLAGS)
+#futex.o: futex.cc
+# $(CXX) -fPIC -c futex.cc -std=c++11 $(CPPFLAGS)
%.o : %.cc
$(CXX) -MMD -MF .$@.d -fPIC -c $< $(CPPFLAGS)
tabbing:
uncrustify -c C.cfg --no-backup --replace *.cc
uncrustify -c C.cfg --no-backup --replace *.h
+ uncrustify -c C.cfg --no-backup --replace include/*
+
#include "datarace.h"
#include "threads-model.h"
#include "bugmessage.h"
+#include "history.h"
#include "fuzzer.h"
#define INITIAL_THREAD_ID 0
action_trace(),
thread_map(2), /* We'll always need at least 2 threads */
pthread_map(0),
- pthread_counter(0),
+ pthread_counter(1),
obj_map(),
condvar_waiters_map(),
obj_thrd_map(),
*/
void ModelExecution::process_write(ModelAction *curr)
{
-
w_modification_order(curr);
-
-
get_thread(curr)->set_return_value(VALUE_NONE);
}
/* Last SC fence in the current thread */
ModelAction *last_sc_fence_local = get_last_seq_cst_fence(curr->get_tid(), NULL);
- ModelAction *last_sc_write = NULL;
- if (curr->is_seqcst())
- last_sc_write = get_last_seq_cst_write(curr);
int tid = curr->get_tid();
ModelAction *prev_same_thread = NULL;
*/
ClockVector * ModelExecution::get_cv(thread_id_t tid) const
{
- return get_parent_action(tid)->get_cv();
+ ModelAction *firstaction=get_parent_action(tid);
+ return firstaction != NULL ? firstaction->get_cv() : NULL;
}
bool valequals(uint64_t val1, uint64_t val2, int size) {
/* Do not split atomic RMW */
if (curr->is_rmwr())
return get_thread(curr);
- if (curr->is_write()) {
- std::memory_order order = curr->get_mo();
- switch(order) {
- case std::memory_order_relaxed:
- return get_thread(curr);
- case std::memory_order_release:
- return get_thread(curr);
- default:
- return NULL;
- }
- }
-
/* Follow CREATE with the created thread */
/* which is not needed, because model.cc takes care of this */
if (curr->get_type() == THREAD_CREATE)
curr = check_current_action(curr);
ASSERT(curr);
+ // model_print("poitner loc: %p, thread: %d, type: %d, order: %d, position: %s\n", curr, curr->get_tid(), curr->get_type(), curr->get_mo(), curr->get_position() );
+ model->get_history()->add_func_atomic( curr, curr_thrd->get_id() );
+
if (curr_thrd->is_blocked() || curr_thrd->is_complete())
scheduler->remove_thread(curr_thrd);
action_list_t * get_action_trace() { return &action_trace; }
Fuzzer * getFuzzer();
CycleGraph * const get_mo_graph() { return mo_graph; }
- HashTable<pthread_cond_t *, cdsc::condition_variable *, uintptr_t, 4> * getCondMap() {return &cond_map;}
- HashTable<pthread_mutex_t *, cdsc::mutex *, uintptr_t, 4> * getMutexMap() {return &mutex_map;}
+ HashTable<pthread_cond_t *, cdsc::snapcondition_variable *, uintptr_t, 4> * getCondMap() {return &cond_map;}
+ HashTable<pthread_mutex_t *, cdsc::snapmutex *, uintptr_t, 4> * getMutexMap() {return &mutex_map;}
+ ModelAction * check_current_action(ModelAction *curr);
+ SnapVector<func_id_list_t *> * get_thrd_func_list() { return &thrd_func_list; }
+
SNAPSHOTALLOC
private:
int get_execution_number() const;
modelclock_t get_next_seq_num();
bool next_execution();
- ModelAction * check_current_action(ModelAction *curr);
bool initialize_curr_action(ModelAction **curr);
void process_read(ModelAction *curr, SnapVector<const ModelAction *> * rf_set);
void process_write(ModelAction *curr);
HashTable<void *, SnapVector<action_list_t> *, uintptr_t, 4> obj_thrd_map;
- HashTable<pthread_mutex_t *, cdsc::mutex *, uintptr_t, 4> mutex_map;
- HashTable<pthread_cond_t *, cdsc::condition_variable *, uintptr_t, 4> cond_map;
+ HashTable<pthread_mutex_t *, cdsc::snapmutex *, uintptr_t, 4> mutex_map;
+ HashTable<pthread_cond_t *, cdsc::snapcondition_variable *, uintptr_t, 4> cond_map;
/**
* List of pending release sequences. Release sequences might be
Fuzzer * fuzzer;
Thread * action_select_next_thread(const ModelAction *curr) const;
+
+ /* thrd_func_list stores a list of function ids for each thread.
+ * Each element in thrd_func_list stores the functions that
+ * thread i has entered and yet to exit from */
+ SnapVector< func_id_list_t * > thrd_func_list;
+
};
#endif /* __EXECUTION_H__ */