We were printing may_read_from info twice.
Printing the current action when we get to check_current_action() is
helpful.
Printing scheduling based on priority is also useful, as we recently had
a "bug" involving fairness/priority.
Include the file name in DEBUG() prints, since we may have the same
function names in different files/classes.
#define model_print(fmt, ...) do { fprintf(model_out, fmt, ##__VA_ARGS__); } while (0)
#ifdef CONFIG_DEBUG
-#define DEBUG(fmt, ...) do { model_print("*** %25s(): line %-4d *** " fmt, __func__, __LINE__, ##__VA_ARGS__); } while (0)
+#define DEBUG(fmt, ...) do { model_print("*** %15s:%-4d %25s() *** " fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__); } while (0)
#define DBG() DEBUG("\n")
#define DBG_ENABLED() (1)
#else
int thrd_create(thrd_t *t, thrd_start_t start_routine, void *arg)
{
Thread *thread;
- DBG();
thread = new Thread(t, start_routine, arg);
model->add_thread(thread);
- DEBUG("create thread %d\n", id_to_int(thrd_to_id(*t)));
/* seq_cst is just a 'don't care' parameter */
model->switch_to_master(new ModelAction(THREAD_CREATE, std::memory_order_seq_cst, thread, VALUE_NONE));
return 0;
bool newly_explored = initialize_curr_action(&curr);
+ DBG();
+ if (DBG_ENABLED())
+ curr->print();
+
wake_up_sleeping_actions(curr);
/* Add the action to lists before any other model-checking tasks */
else if (curr->get_sleep_flag() && !curr->is_seqcst() && !sleep_can_read_from(curr, act))
allow_read = false;
- if (allow_read) {
- DEBUG("Adding action to may_read_from:\n");
- if (DBG_ENABLED()) {
- act->print();
- curr->print();
- }
+ if (allow_read)
curr->get_node()->add_read_from(act);
- }
/* Include at most one act per-thread that "happens before" curr */
if (act->happens_before(curr))
for (int i = 0; i < enabled_len; i++) {
thread_id_t tid = int_to_id(i);
if (n->has_priority(tid)) {
+ DEBUG("Node (tid %d) has priority\n", i);
//Have a thread with priority
if (enabled[i] != THREAD_DISABLED)
have_enabled_thread_with_priority = true;