Rev 2866 | Rev 2870 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2866 | Rev 2867 | ||
|---|---|---|---|
| Line 78... | Line 78... | ||
| 78 | 78 | ||
| 79 | ipl = interrupts_disable(); |
79 | ipl = interrupts_disable(); |
| 80 | spinlock_lock(&THREAD->debug_lock); |
80 | spinlock_lock(&THREAD->debug_lock); |
| 81 | 81 | ||
| 82 | /* Must only generate events when in debugging session and have go */ |
82 | /* Must only generate events when in debugging session and have go */ |
| 83 | if (THREAD->debug_active == true && |
83 | if (THREAD->debug_active != true || |
| 84 | THREAD->debug_stop == false) { |
84 | THREAD->debug_stop == true) { |
| 85 | klog_printf("udebug_syscall_event"); |
- | |
| 86 | call = THREAD->debug_go_call; |
- | |
| 87 | IPC_SET_RETVAL(call->data, 0); |
- | |
| 88 | IPC_SET_ARG1(call->data, UDEBUG_EVENT_SYSCALL); |
- | |
| 89 | IPC_SET_ARG2(call->data, id); |
- | |
| 90 | IPC_SET_ARG3(call->data, rc); |
- | |
| 91 | klog_printf("udebug_syscall_event/ipc_answer"); |
- | |
| 92 | - | ||
| 93 | THREAD->syscall_args[0] = a1; |
- | |
| 94 | THREAD->syscall_args[1] = a2; |
- | |
| 95 | THREAD->syscall_args[2] = a3; |
- | |
| 96 | THREAD->syscall_args[3] = a4; |
- | |
| 97 | THREAD->syscall_args[4] = a5; |
- | |
| 98 | THREAD->syscall_args[5] = a6; |
- | |
| 99 | - | ||
| 100 | /* |
- | |
| 101 | * Make sure debug_stop is true when going to sleep |
- | |
| 102 | * in case we get woken up by DEBUG_END. (At which |
- | |
| 103 | * point it must be back to the initial true value). |
- | |
| 104 | */ |
- | |
| 105 | THREAD->debug_stop = true; |
- | |
| 106 | - | ||
| 107 | THREAD->cur_event = UDEBUG_EVENT_SYSCALL; |
- | |
| 108 | spinlock_unlock(&THREAD->debug_lock); |
85 | spinlock_unlock(&THREAD->debug_lock); |
| - | 86 | interrupts_restore(ipl); |
|
| - | 87 | return; |
|
| - | 88 | } |
|
| 109 | 89 | ||
| - | 90 | klog_printf("udebug_syscall_event"); |
|
| - | 91 | call = THREAD->debug_go_call; |
|
| - | 92 | IPC_SET_RETVAL(call->data, 0); |
|
| - | 93 | IPC_SET_ARG1(call->data, UDEBUG_EVENT_SYSCALL); |
|
| - | 94 | IPC_SET_ARG2(call->data, id); |
|
| - | 95 | IPC_SET_ARG3(call->data, rc); |
|
| - | 96 | klog_printf("udebug_syscall_event/ipc_answer"); |
|
| - | 97 | ||
| - | 98 | THREAD->syscall_args[0] = a1; |
|
| - | 99 | THREAD->syscall_args[1] = a2; |
|
| - | 100 | THREAD->syscall_args[2] = a3; |
|
| - | 101 | THREAD->syscall_args[3] = a4; |
|
| - | 102 | THREAD->syscall_args[4] = a5; |
|
| - | 103 | THREAD->syscall_args[5] = a6; |
|
| - | 104 | ||
| - | 105 | /* |
|
| - | 106 | * Make sure debug_stop is true when going to sleep |
|
| - | 107 | * in case we get woken up by DEBUG_END. (At which |
|
| - | 108 | * point it must be back to the initial true value). |
|
| - | 109 | */ |
|
| - | 110 | THREAD->debug_stop = true; |
|
| - | 111 | ||
| - | 112 | THREAD->cur_event = UDEBUG_EVENT_SYSCALL; |
|
| - | 113 | spinlock_unlock(&THREAD->debug_lock); |
|
| - | 114 | ||
| 110 | spinlock_lock(&TASK->lock); |
115 | spinlock_lock(&TASK->lock); |
| 111 | ipc_answer(&TASK->answerbox, THREAD->debug_go_call); |
116 | ipc_answer(&TASK->answerbox, THREAD->debug_go_call); |
| 112 | spinlock_unlock(&TASK->lock); |
117 | spinlock_unlock(&TASK->lock); |
| 113 | 118 | ||
| 114 | interrupts_restore(ipl); |
119 | interrupts_restore(ipl); |
| - | 120 | ||
| - | 121 | waitq_sleep(&THREAD->go_wq); |
|
| - | 122 | } |
|
| - | 123 | ||
| - | 124 | void udebug_new_thread_event(struct thread *t) |
|
| - | 125 | { |
|
| - | 126 | call_t *call; |
|
| - | 127 | ipl_t ipl; |
|
| - | 128 | ||
| - | 129 | ipl = interrupts_disable(); |
|
| - | 130 | spinlock_lock(&THREAD->debug_lock); |
|
| 115 | 131 | ||
| 116 | waitq_sleep(&THREAD->go_wq); |
132 | klog_printf("udebug_new_thread_event"); |
| 117 | } else { |
133 | klog_printf("- check state"); |
| - | 134 | ||
| - | 135 | /* Must only generate events when in debugging session */ |
|
| - | 136 | if (THREAD->debug_active != true) { |
|
| - | 137 | klog_printf("- debug_active: %s, debug_stop: %s", |
|
| - | 138 | THREAD->debug_active ? "yes(+)" : "no(-)", |
|
| - | 139 | THREAD->debug_stop ? "yes(-)" : "no(+)"); |
|
| 118 | spinlock_unlock(&THREAD->debug_lock); |
140 | spinlock_unlock(&THREAD->debug_lock); |
| 119 | interrupts_restore(ipl); |
141 | interrupts_restore(ipl); |
| - | 142 | return; |
|
| 120 | } |
143 | } |
| - | 144 | ||
| - | 145 | klog_printf("- trigger event"); |
|
| - | 146 | ||
| - | 147 | call = THREAD->debug_go_call; |
|
| - | 148 | IPC_SET_RETVAL(call->data, 0); |
|
| - | 149 | IPC_SET_ARG1(call->data, UDEBUG_EVENT_NEW_THREAD); |
|
| - | 150 | IPC_SET_ARG2(call->data, (unative_t)t); |
|
| - | 151 | ||
| - | 152 | /* |
|
| - | 153 | * Make sure debug_stop is true when going to sleep |
|
| - | 154 | * in case we get woken up by DEBUG_END. (At which |
|
| - | 155 | * point it must be back to the initial true value). |
|
| - | 156 | */ |
|
| - | 157 | THREAD->debug_stop = true; |
|
| - | 158 | ||
| - | 159 | THREAD->cur_event = UDEBUG_EVENT_NEW_THREAD; |
|
| - | 160 | spinlock_unlock(&THREAD->debug_lock); |
|
| - | 161 | ||
| - | 162 | spinlock_lock(&TASK->lock); |
|
| - | 163 | ipc_answer(&TASK->answerbox, THREAD->debug_go_call); |
|
| - | 164 | spinlock_unlock(&TASK->lock); |
|
| - | 165 | ||
| - | 166 | interrupts_restore(ipl); |
|
| - | 167 | klog_printf("- sleep"); |
|
| - | 168 | ||
| - | 169 | waitq_sleep(&THREAD->go_wq); |
|
| 121 | } |
170 | } |
| 122 | 171 | ||
| - | 172 | ||
| 123 | /** @} |
173 | /** @} |
| 124 | */ |
174 | */ |