189,6 → 189,7 |
|
ta->dt_state = UDEBUG_TS_BEGINNING; |
ta->debug_begin_call = call; |
ta->debugger = call->sender; |
|
if (ta->not_stoppable_count == 0) { |
ta->dt_state = UDEBUG_TS_ACTIVE; |
222,76 → 223,24 |
{ |
task_t *ta; |
ipl_t ipl; |
int rc; |
|
thread_t *t; |
link_t *cur; |
int flags; |
|
klog_printf("udebug_rp_end()"); |
|
ipl = interrupts_disable(); |
ta = get_lock_callee_task(phone); |
|
rc = udebug_task_cleanup(ta); |
|
klog_printf("task %llu", ta->taskid); |
|
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 being debugged"); |
|
if (rc < 0) { |
return EINVAL; |
} |
|
/* 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->debug_lock); |
spinlock_lock(&t->lock); |
|
flags = t->flags; |
|
spinlock_unlock(&t->lock); |
|
/* Only process userspace threads */ |
if ((flags & THREAD_FLAG_USPACE) != 0) { |
/* Prevent any further debug activity in thread */ |
t->debug_active = false; |
t->cur_event = 0; /* none */ |
|
/* 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; |
|
/* Answer GO call */ |
klog_printf("answer GO call with EVENT_FINISHED"); |
IPC_SET_RETVAL(t->debug_go_call->data, 0); |
IPC_SET_ARG1(t->debug_go_call->data, UDEBUG_EVENT_FINISHED); |
ipc_answer(&ta->answerbox, t->debug_go_call); |
} else { |
/* |
* Debug_stop is already at initial value. |
* Yet this means the thread needs waking up. |
*/ |
|
/* |
* t's lock must not be held when calling |
* waitq_wakeup. |
*/ |
waitq_wakeup(&t->go_wq, WAKEUP_FIRST); |
} |
} |
spinlock_unlock(&t->debug_lock); |
} |
|
ta->dt_state = UDEBUG_TS_INACTIVE; |
|
spinlock_unlock(&ta->lock); |
interrupts_restore(ipl); |
|
IPC_SET_RETVAL(call->data, 0); |
|
klog_printf("udebug_rp_end() done\n"); |