8 #include "threads-model.h"
15 void enter_function(const uint32_t func_id, thread_id_t tid);
16 void exit_function(const uint32_t func_id, thread_id_t tid);
18 uint32_t get_func_counter() { return func_counter; }
19 void incr_func_counter() { func_counter++; }
21 void resize_func_nodes(uint32_t max_func_id);
22 void process_action(ModelAction *act, thread_id_t tid);
24 HashTable<const char *, uint32_t, uintptr_t, 4, model_malloc, model_calloc, model_free> * getFuncMap() { return &func_map; }
25 ModelVector<const char *> * getFuncMapRev() { return &func_map_rev; }
27 ModelVector<FuncNode *> * getFuncNodes() { return &func_nodes; }
28 FuncNode * get_func_node(uint32_t func_id);
29 FuncNode * get_curr_func_node(thread_id_t tid);
31 void update_write_history(void * location, uint64_t write_val);
32 HashTable<void *, value_set_t *, uintptr_t, 4> * getWriteHistory() { return write_history; }
33 void update_loc_rd_func_nodes_map(void * location, FuncNode * node);
34 void update_loc_wr_func_nodes_map(void * location, FuncNode * node);
35 SnapVector<FuncNode *> * getRdFuncNodes(void * location);
36 SnapVector<FuncNode *> * getWrFuncNodes(void * location);
38 void add_waiting_write(ConcretePredicate * concrete);
39 void remove_waiting_write(thread_id_t tid);
40 void check_waiting_write(ModelAction * write_act);
41 SnapVector<ConcretePredicate *> * getThrdWaitingWrite() { return thrd_waiting_write; }
43 SnapVector<inst_act_map_t *> * getThrdInstActMap(uint32_t func_id);
45 void update_func_threads_map(uint32_t func_id, thread_id_t tid);
46 SnapVector<thread_id_t> * get_calling_threads(uint32_t func_id);
48 void set_new_exec_flag();
49 void dump_func_node_graph();
50 void print_func_node();
54 uint32_t func_counter;
56 /* Map function names to integer ids */
57 HashTable<const char *, uint32_t, uintptr_t, 4, model_malloc, model_calloc, model_free> func_map;
59 /* Map integer ids to function names */
60 ModelVector<const char *> func_map_rev;
62 ModelVector<FuncNode *> func_nodes;
64 /* Map a location to a set of values that have been written to it */
65 HashTable<void *, value_set_t *, uintptr_t, 4> * write_history;
67 /* Map a location to FuncNodes that may read from it */
68 HashTable<void *, SnapVector<FuncNode *> *, uintptr_t, 0> * loc_rd_func_nodes_map;
70 /* Map a location to FuncNodes that may write to it */
71 HashTable<void *, SnapVector<FuncNode *> *, uintptr_t, 0> * loc_wr_func_nodes_map;
73 HashTable<void *, SnapVector<ConcretePredicate *> *, uintptr_t, 0> * loc_waiting_writes_map;
74 SnapVector<ConcretePredicate *> * thrd_waiting_write;
76 /* A run-time map from FuncInst to ModelAction per each FuncNode, per each thread.
77 * Manipulated by FuncNode, and needed by NewFuzzer */
78 HashTable<uint32_t, SnapVector<inst_act_map_t *> *, int, 0> * func_inst_act_maps;
80 bool skip_action(ModelAction * act, SnapList<ModelAction *> * curr_act_list);
82 /* Map func_id to threads that have called this function */
83 HashTable<uint32_t, SnapVector<thread_id_t> *, int, 0> * func_threads_map;
86 #endif /* __HISTORY_H__ */