Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2834 → Rev 2835

/branches/tracing/kernel/generic/src/udebug/udebug_ipc.c
132,49 → 132,44
ta = get_lock_callee_task(phone);
klog_printf("task %llu", ta->taskid);
 
//TODO: UDEBUG_TS_BEGINNING
if (ta->dt_state != UDEBUG_TS_ACTIVE) {
if (ta->dt_state == UDEBUG_TS_BEGINNING &&
ta->dt_state != UDEBUG_TS_ACTIVE) {
spinlock_unlock(&ta->lock);
interrupts_restore(ipl);
klog_printf("udebug_rp_begin(): task not in TS_BEGINNING");
klog_printf("udebug_rp_begin(): task not being debugged");
return EINVAL;
}
 
/* Clear debug_active from all of the task's userspace threads */
 
/* Finish debugging of all userspace threads */
for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) {
t = list_get_instance(cur, thread_t, th_link);
 
spinlock_lock(&t->lock);
if ((t->flags & THREAD_FLAG_USPACE) != 0)
t->debug_active = true;
spinlock_unlock(&t->lock);
}
 
/* Now respond to unanswered GO calls and reset thread states */
for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) {
t = list_get_instance(cur, thread_t, th_link);
/* Only process userspace threads */
if ((t->flags & THREAD_FLAG_USPACE) != 0) {
/* Prevent any further debug activity in thread */
t->debug_active = false;
 
spinlock_lock(&t->lock);
/* Still has go? */
if (t->debug_stop == false) {
/*
* Yes, so clear go. As debug_active == false,
* this doesn't affect anything.
*/
t->debug_stop = true;
 
/* Still has go? */
if ((t->flags & THREAD_FLAG_USPACE) != 0 &&
t->debug_stop == false) {
/*
* Yes, so clear go. As debug_active == false,
* this doesn't affect anything.
*/
t->debug_stop = true;
/* Answer GO call */
ipc_answer(&ta->answerbox, t->debug_go_call);
} else {
/*
* Debug_stop is already at initial value.
* Yet this means the thread needs waking up.
*/
waitq_wakeup(&t->go_wq, WAKEUP_FIRST);
}
}
 
/* Answer GO call */
ipc_answer(&ta->answerbox, t->debug_go_call);
} else {
/*
* Debug_stop is already at initial value.
* Yet this means the thread needs waking up.
*/
waitq_wakeup(&t->go_wq, WAKEUP_FIRST);
}
spinlock_unlock(&t->lock);
}