141,10 → 141,10 |
|
nsc = --TASK->udebug.not_stoppable_count; |
|
if (TASK->udebug.dt_state == UDEBUG_TS_BEGINNING) { |
klog_printf("udebug_stoppable_begin"); |
klog_printf(" - nsc := %d", nsc); |
} |
/* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */ |
mutex_lock(&THREAD->udebug.lock); |
ASSERT(THREAD->udebug.stoppable == false); |
THREAD->udebug.stoppable = true; |
|
if (TASK->udebug.dt_state == UDEBUG_TS_BEGINNING && nsc == 0) { |
/* |
155,18 → 155,10 |
db_call = TASK->udebug.begin_call; |
ASSERT(db_call); |
|
/* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */ |
mutex_lock(&THREAD->udebug.lock); |
ASSERT(THREAD->udebug.stoppable == false); |
THREAD->udebug.stoppable = true; |
mutex_unlock(&THREAD->udebug.lock); |
|
TASK->udebug.dt_state = UDEBUG_TS_ACTIVE; |
TASK->udebug.begin_call = NULL; |
mutex_unlock(&TASK->udebug.lock); |
|
IPC_SET_RETVAL(db_call->data, 0); |
//klog_printf("udebug_stoppable_begin/ipc_answer"); |
ipc_answer(&TASK->answerbox, db_call); |
|
} else if (TASK->udebug.dt_state == UDEBUG_TS_ACTIVE) { |
174,11 → 166,6 |
* Active debugging session |
*/ |
|
/* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */ |
mutex_lock(&THREAD->udebug.lock); |
ASSERT(THREAD->udebug.stoppable == false); |
THREAD->udebug.stoppable = true; |
|
if (THREAD->udebug.debug_active && THREAD->udebug.stop) { |
/* |
* Thread was requested to stop - answer go call |
193,31 → 180,13 |
IPC_SET_ARG1(go_call->data, UDEBUG_EVENT_STOP); |
|
THREAD->udebug.cur_event = UDEBUG_EVENT_STOP; |
mutex_unlock(&THREAD->udebug.lock); |
|
ipc_answer(&TASK->answerbox, go_call); |
|
mutex_unlock(&TASK->udebug.lock); |
} else { |
/* |
* No stop request - nothing happens. |
*/ |
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
} |
} else { |
/* |
* All other cases - nothing special happens. |
*/ |
} |
|
/* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */ |
mutex_lock(&THREAD->udebug.lock); |
ASSERT(THREAD->udebug.stoppable == false); |
THREAD->udebug.stoppable = true; |
mutex_unlock(&THREAD->udebug.lock); |
|
mutex_unlock(&TASK->udebug.lock); |
} |
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
} |
|
void udebug_stoppable_end(void) |
230,8 → 199,6 |
|
restart: |
mutex_lock(&TASK->udebug.lock); |
|
/* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */ |
mutex_lock(&THREAD->udebug.lock); |
|
if (THREAD->udebug.debug_active && |
343,12 → 310,11 |
* point it must be back to the initial true value). |
*/ |
THREAD->udebug.stop = true; |
|
THREAD->udebug.cur_event = etype; |
mutex_unlock(&THREAD->udebug.lock); |
|
ipc_answer(&TASK->answerbox, call); |
|
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
|
udebug_wait_for_go(&THREAD->udebug.go_wq); |
392,12 → 358,11 |
* point it must be back to the initial true value). |
*/ |
THREAD->udebug.stop = true; |
|
THREAD->udebug.cur_event = UDEBUG_EVENT_THREAD_B; |
mutex_unlock(&THREAD->udebug.lock); |
|
ipc_answer(&TASK->answerbox, call); |
|
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
|
klog_printf("- sleep"); |
440,10 → 405,9 |
THREAD->udebug.cur_event = 0; /* none */ |
THREAD->udebug.stop = true; /* set to initial value */ |
|
mutex_unlock(&THREAD->udebug.lock); |
|
ipc_answer(&TASK->answerbox, call); |
|
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
|
/* Leave int_lock enabled */ |
490,13 → 454,12 |
* point it must be back to the initial true value). |
*/ |
THREAD->udebug.stop = true; |
|
THREAD->udebug.cur_event = etype; |
mutex_unlock(&THREAD->udebug.lock); |
|
klog_printf("- send answer"); |
ipc_answer(&TASK->answerbox, call); |
|
ipc_answer(&TASK->answerbox, call); |
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
|
udebug_wait_for_go(&THREAD->udebug.go_wq); |
532,7 → 495,7 |
|
udebug_int_lock(); |
|
if (ta->udebug.dt_state == UDEBUG_TS_BEGINNING && |
if (ta->udebug.dt_state != UDEBUG_TS_BEGINNING && |
ta->udebug.dt_state != UDEBUG_TS_ACTIVE) { |
klog_printf("udebug_task_cleanup(): task not being debugged"); |
return EINVAL; |