80,45 → 80,95 |
spinlock_lock(&THREAD->debug_lock); |
|
/* Must only generate events when in debugging session and have go */ |
if (THREAD->debug_active == true && |
THREAD->debug_stop == false) { |
klog_printf("udebug_syscall_event"); |
call = THREAD->debug_go_call; |
IPC_SET_RETVAL(call->data, 0); |
IPC_SET_ARG1(call->data, UDEBUG_EVENT_SYSCALL); |
IPC_SET_ARG2(call->data, id); |
IPC_SET_ARG3(call->data, rc); |
klog_printf("udebug_syscall_event/ipc_answer"); |
if (THREAD->debug_active != true || |
THREAD->debug_stop == true) { |
spinlock_unlock(&THREAD->debug_lock); |
interrupts_restore(ipl); |
return; |
} |
|
THREAD->syscall_args[0] = a1; |
THREAD->syscall_args[1] = a2; |
THREAD->syscall_args[2] = a3; |
THREAD->syscall_args[3] = a4; |
THREAD->syscall_args[4] = a5; |
THREAD->syscall_args[5] = a6; |
klog_printf("udebug_syscall_event"); |
call = THREAD->debug_go_call; |
IPC_SET_RETVAL(call->data, 0); |
IPC_SET_ARG1(call->data, UDEBUG_EVENT_SYSCALL); |
IPC_SET_ARG2(call->data, id); |
IPC_SET_ARG3(call->data, rc); |
klog_printf("udebug_syscall_event/ipc_answer"); |
|
/* |
* Make sure debug_stop is true when going to sleep |
* in case we get woken up by DEBUG_END. (At which |
* point it must be back to the initial true value). |
*/ |
THREAD->debug_stop = true; |
THREAD->syscall_args[0] = a1; |
THREAD->syscall_args[1] = a2; |
THREAD->syscall_args[2] = a3; |
THREAD->syscall_args[3] = a4; |
THREAD->syscall_args[4] = a5; |
THREAD->syscall_args[5] = a6; |
|
THREAD->cur_event = UDEBUG_EVENT_SYSCALL; |
spinlock_unlock(&THREAD->debug_lock); |
/* |
* Make sure debug_stop is true when going to sleep |
* in case we get woken up by DEBUG_END. (At which |
* point it must be back to the initial true value). |
*/ |
THREAD->debug_stop = true; |
|
spinlock_lock(&TASK->lock); |
ipc_answer(&TASK->answerbox, THREAD->debug_go_call); |
spinlock_unlock(&TASK->lock); |
THREAD->cur_event = UDEBUG_EVENT_SYSCALL; |
spinlock_unlock(&THREAD->debug_lock); |
|
interrupts_restore(ipl); |
spinlock_lock(&TASK->lock); |
ipc_answer(&TASK->answerbox, THREAD->debug_go_call); |
spinlock_unlock(&TASK->lock); |
|
waitq_sleep(&THREAD->go_wq); |
} else { |
interrupts_restore(ipl); |
|
waitq_sleep(&THREAD->go_wq); |
} |
|
void udebug_new_thread_event(struct thread *t) |
{ |
call_t *call; |
ipl_t ipl; |
|
ipl = interrupts_disable(); |
spinlock_lock(&THREAD->debug_lock); |
|
klog_printf("udebug_new_thread_event"); |
klog_printf("- check state"); |
|
/* Must only generate events when in debugging session */ |
if (THREAD->debug_active != true) { |
klog_printf("- debug_active: %s, debug_stop: %s", |
THREAD->debug_active ? "yes(+)" : "no(-)", |
THREAD->debug_stop ? "yes(-)" : "no(+)"); |
spinlock_unlock(&THREAD->debug_lock); |
interrupts_restore(ipl); |
return; |
} |
|
klog_printf("- trigger event"); |
|
call = THREAD->debug_go_call; |
IPC_SET_RETVAL(call->data, 0); |
IPC_SET_ARG1(call->data, UDEBUG_EVENT_NEW_THREAD); |
IPC_SET_ARG2(call->data, (unative_t)t); |
|
/* |
* Make sure debug_stop is true when going to sleep |
* in case we get woken up by DEBUG_END. (At which |
* point it must be back to the initial true value). |
*/ |
THREAD->debug_stop = true; |
|
THREAD->cur_event = UDEBUG_EVENT_NEW_THREAD; |
spinlock_unlock(&THREAD->debug_lock); |
|
spinlock_lock(&TASK->lock); |
ipc_answer(&TASK->answerbox, THREAD->debug_go_call); |
spinlock_unlock(&TASK->lock); |
|
interrupts_restore(ipl); |
klog_printf("- sleep"); |
|
waitq_sleep(&THREAD->go_wq); |
} |
|
|
/** @} |
*/ |