Rev 2918 | Rev 3014 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 2894 | svoboda | 1 | /* |
| 2 | * Copyright (c) 2008 Jiri Svoboda |
||
| 3 | * All rights reserved. |
||
| 4 | * |
||
| 5 | * Redistribution and use in source and binary forms, with or without |
||
| 6 | * modification, are permitted provided that the following conditions |
||
| 7 | * are met: |
||
| 8 | * |
||
| 9 | * - Redistributions of source code must retain the above copyright |
||
| 10 | * notice, this list of conditions and the following disclaimer. |
||
| 11 | * - Redistributions in binary form must reproduce the above copyright |
||
| 12 | * notice, this list of conditions and the following disclaimer in the |
||
| 13 | * documentation and/or other materials provided with the distribution. |
||
| 14 | * - The name of the author may not be used to endorse or promote products |
||
| 15 | * derived from this software without specific prior written permission. |
||
| 16 | * |
||
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
||
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
||
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
||
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
||
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
| 27 | */ |
||
| 28 | |||
| 2801 | svoboda | 29 | /** @addtogroup generic |
| 30 | * @{ |
||
| 31 | */ |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @file |
||
| 2894 | svoboda | 35 | * @brief Udebug. |
| 2801 | svoboda | 36 | */ |
| 37 | |||
| 38 | #include <synch/waitq.h> |
||
| 39 | #include <console/klog.h> |
||
| 2813 | svoboda | 40 | #include <udebug/udebug.h> |
| 2870 | svoboda | 41 | #include <errno.h> |
| 2801 | svoboda | 42 | #include <arch.h> |
| 43 | |||
| 2917 | svoboda | 44 | static void udebug_wait_for_go(waitq_t *wq) |
| 45 | { |
||
| 46 | int rc; |
||
| 47 | ipl_t ipl; |
||
| 48 | |||
| 49 | ipl = waitq_sleep_prepare(wq); |
||
| 50 | |||
| 51 | wq->missed_wakeups = 0; /* Enforce blocking. */ |
||
| 52 | rc = waitq_sleep_timeout_unsafe(wq, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE); |
||
| 53 | |||
| 54 | waitq_sleep_finish(wq, rc, ipl); |
||
| 55 | } |
||
| 56 | |||
| 2804 | svoboda | 57 | void udebug_stoppable_begin(void) |
| 2801 | svoboda | 58 | { |
| 2804 | svoboda | 59 | int nsc; |
| 2898 | svoboda | 60 | call_t *db_call, *go_call; |
| 2823 | svoboda | 61 | ipl_t ipl; |
| 2804 | svoboda | 62 | |
| 2902 | svoboda | 63 | ASSERT(THREAD); |
| 64 | ASSERT(TASK); |
||
| 65 | |||
| 2823 | svoboda | 66 | ipl = interrupts_disable(); |
| 2804 | svoboda | 67 | spinlock_lock(&TASK->lock); |
| 68 | |||
| 69 | nsc = --TASK->not_stoppable_count; |
||
| 70 | |||
| 2825 | svoboda | 71 | if (TASK->dt_state == UDEBUG_TS_BEGINNING) { |
| 2804 | svoboda | 72 | klog_printf("udebug_stoppable_begin"); |
| 73 | klog_printf(" - nsc := %d", nsc); |
||
| 74 | } |
||
| 75 | |||
| 2825 | svoboda | 76 | if (TASK->dt_state == UDEBUG_TS_BEGINNING && nsc == 0) { |
| 2898 | svoboda | 77 | /* |
| 78 | * This was the last non-stoppable thread. Reply to |
||
| 79 | * DEBUG_BEGIN call. |
||
| 80 | */ |
||
| 81 | |||
| 2902 | svoboda | 82 | db_call = TASK->debug_begin_call; |
| 83 | ASSERT(db_call); |
||
| 84 | |||
| 2898 | svoboda | 85 | /* Lock order OK, THREAD->debug_lock is after TASK->lock */ |
| 86 | spinlock_lock(&THREAD->debug_lock); |
||
| 87 | THREAD->debug_stoppable = true; |
||
| 88 | spinlock_unlock(&THREAD->debug_lock); |
||
| 89 | |||
| 2825 | svoboda | 90 | TASK->dt_state = UDEBUG_TS_ACTIVE; |
| 2801 | svoboda | 91 | TASK->debug_begin_call = NULL; |
| 2804 | svoboda | 92 | spinlock_unlock(&TASK->lock); |
| 2823 | svoboda | 93 | interrupts_restore(ipl); |
| 2804 | svoboda | 94 | |
| 95 | IPC_SET_RETVAL(db_call->data, 0); |
||
| 2913 | svoboda | 96 | //klog_printf("udebug_stoppable_begin/ipc_answer"); |
| 2804 | svoboda | 97 | ipc_answer(&TASK->answerbox, db_call); |
| 2898 | svoboda | 98 | |
| 99 | } else if (TASK->dt_state == UDEBUG_TS_ACTIVE) { |
||
| 100 | /* |
||
| 101 | * Active debugging session |
||
| 102 | */ |
||
| 103 | |||
| 104 | /* Lock order OK, THREAD->debug_lock is after TASK->lock */ |
||
| 105 | spinlock_lock(&THREAD->debug_lock); |
||
| 106 | THREAD->debug_stoppable = true; |
||
| 107 | |||
| 2902 | svoboda | 108 | if (THREAD->debug_active && THREAD->debug_stop) { |
| 2898 | svoboda | 109 | /* |
| 110 | * Thread was requested to stop - answer go call |
||
| 111 | */ |
||
| 112 | |||
| 113 | /* Make sure nobody takes this call away from us */ |
||
| 114 | go_call = THREAD->debug_go_call; |
||
| 115 | THREAD->debug_go_call = NULL; |
||
| 2902 | svoboda | 116 | ASSERT(go_call); |
| 2898 | svoboda | 117 | |
| 118 | IPC_SET_RETVAL(go_call->data, 0); |
||
| 119 | IPC_SET_ARG1(go_call->data, UDEBUG_EVENT_STOP); |
||
| 120 | |||
| 121 | THREAD->cur_event = UDEBUG_EVENT_STOP; |
||
| 122 | spinlock_unlock(&THREAD->debug_lock); |
||
| 123 | |||
| 124 | ipc_answer(&TASK->answerbox, go_call); |
||
| 125 | |||
| 126 | spinlock_unlock(&TASK->lock); |
||
| 127 | interrupts_restore(ipl); |
||
| 128 | } else { |
||
| 129 | /* |
||
| 130 | * No stop request - nothing happens. |
||
| 131 | */ |
||
| 132 | spinlock_unlock(&THREAD->debug_lock); |
||
| 133 | spinlock_unlock(&TASK->lock); |
||
| 134 | interrupts_restore(ipl); |
||
| 135 | } |
||
| 2804 | svoboda | 136 | } else { |
| 2898 | svoboda | 137 | /* |
| 138 | * All other cases - nothing special happens. |
||
| 139 | */ |
||
| 140 | |||
| 141 | /* Lock order OK, THREAD->debug_lock is after TASK->lock */ |
||
| 142 | spinlock_lock(&THREAD->debug_lock); |
||
| 143 | THREAD->debug_stoppable = true; |
||
| 144 | spinlock_unlock(&THREAD->debug_lock); |
||
| 145 | |||
| 2804 | svoboda | 146 | spinlock_unlock(&TASK->lock); |
| 2823 | svoboda | 147 | interrupts_restore(ipl); |
| 2804 | svoboda | 148 | } |
| 149 | } |
||
| 150 | |||
| 151 | void udebug_stoppable_end(void) |
||
| 152 | { |
||
| 2823 | svoboda | 153 | ipl_t ipl; |
| 154 | |||
| 2804 | svoboda | 155 | restart: |
| 2823 | svoboda | 156 | ipl = interrupts_disable(); |
| 2804 | svoboda | 157 | spinlock_lock(&TASK->lock); |
| 158 | |||
| 2898 | svoboda | 159 | /* Lock order OK, THREAD->debug_lock is after TASK->lock */ |
| 160 | spinlock_lock(&THREAD->debug_lock); |
||
| 161 | |||
| 162 | if (TASK->dt_state == UDEBUG_TS_ACTIVE) { |
||
| 2913 | svoboda | 163 | //klog_printf("udebug_stoppable_end"); |
| 164 | //klog_printf("debug_stop=%d", THREAD->debug_stop); |
||
| 2898 | svoboda | 165 | } |
| 166 | |||
| 2902 | svoboda | 167 | if (THREAD->debug_active && |
| 2825 | svoboda | 168 | THREAD->debug_stop == true) { |
| 2804 | svoboda | 169 | TASK->debug_begin_call = NULL; |
| 2898 | svoboda | 170 | spinlock_unlock(&THREAD->debug_lock); |
| 2804 | svoboda | 171 | spinlock_unlock(&TASK->lock); |
| 2823 | svoboda | 172 | interrupts_restore(ipl); |
| 173 | |||
| 2917 | svoboda | 174 | udebug_wait_for_go(&THREAD->go_wq); |
| 175 | |||
| 2804 | svoboda | 176 | goto restart; |
| 177 | /* must try again - have to lose stoppability atomically */ |
||
| 178 | } else { |
||
| 179 | ++TASK->not_stoppable_count; |
||
| 2898 | svoboda | 180 | THREAD->debug_stoppable = false; |
| 181 | |||
| 182 | spinlock_unlock(&THREAD->debug_lock); |
||
| 2804 | svoboda | 183 | spinlock_unlock(&TASK->lock); |
| 2823 | svoboda | 184 | interrupts_restore(ipl); |
| 2801 | svoboda | 185 | } |
| 186 | } |
||
| 187 | |||
| 2805 | svoboda | 188 | void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3, |
| 2901 | svoboda | 189 | unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc, |
| 190 | bool end_variant) |
||
| 2801 | svoboda | 191 | { |
| 2805 | svoboda | 192 | call_t *call; |
| 2823 | svoboda | 193 | ipl_t ipl; |
| 2901 | svoboda | 194 | udebug_event_t etype; |
| 2805 | svoboda | 195 | |
| 2901 | svoboda | 196 | etype = end_variant ? UDEBUG_EVENT_SYSCALL_E : UDEBUG_EVENT_SYSCALL_B; |
| 197 | |||
| 2823 | svoboda | 198 | ipl = interrupts_disable(); |
| 2848 | svoboda | 199 | spinlock_lock(&THREAD->debug_lock); |
| 2823 | svoboda | 200 | |
| 2854 | svoboda | 201 | /* Must only generate events when in debugging session and have go */ |
| 2867 | svoboda | 202 | if (THREAD->debug_active != true || |
| 2899 | svoboda | 203 | THREAD->debug_stop == true || |
| 2901 | svoboda | 204 | (TASK->debug_evmask & UDEBUG_EVMASK(etype)) == 0) { |
| 2867 | svoboda | 205 | spinlock_unlock(&THREAD->debug_lock); |
| 206 | interrupts_restore(ipl); |
||
| 207 | return; |
||
| 208 | } |
||
| 2804 | svoboda | 209 | |
| 2913 | svoboda | 210 | //klog_printf("udebug_syscall_event"); |
| 2867 | svoboda | 211 | call = THREAD->debug_go_call; |
| 212 | IPC_SET_RETVAL(call->data, 0); |
||
| 2901 | svoboda | 213 | IPC_SET_ARG1(call->data, etype); |
| 2867 | svoboda | 214 | IPC_SET_ARG2(call->data, id); |
| 215 | IPC_SET_ARG3(call->data, rc); |
||
| 2913 | svoboda | 216 | //klog_printf("udebug_syscall_event/ipc_answer"); |
| 2805 | svoboda | 217 | |
| 2867 | svoboda | 218 | THREAD->syscall_args[0] = a1; |
| 219 | THREAD->syscall_args[1] = a2; |
||
| 220 | THREAD->syscall_args[2] = a3; |
||
| 221 | THREAD->syscall_args[3] = a4; |
||
| 222 | THREAD->syscall_args[4] = a5; |
||
| 223 | THREAD->syscall_args[5] = a6; |
||
| 2866 | svoboda | 224 | |
| 2867 | svoboda | 225 | /* |
| 226 | * Make sure debug_stop is true when going to sleep |
||
| 227 | * in case we get woken up by DEBUG_END. (At which |
||
| 228 | * point it must be back to the initial true value). |
||
| 229 | */ |
||
| 230 | THREAD->debug_stop = true; |
||
| 2825 | svoboda | 231 | |
| 2901 | svoboda | 232 | THREAD->cur_event = etype; |
| 2867 | svoboda | 233 | spinlock_unlock(&THREAD->debug_lock); |
| 2834 | svoboda | 234 | |
| 2867 | svoboda | 235 | spinlock_lock(&TASK->lock); |
| 236 | ipc_answer(&TASK->answerbox, THREAD->debug_go_call); |
||
| 237 | spinlock_unlock(&TASK->lock); |
||
| 238 | interrupts_restore(ipl); |
||
| 239 | |||
| 2917 | svoboda | 240 | udebug_wait_for_go(&THREAD->go_wq); |
| 2867 | svoboda | 241 | } |
| 242 | |||
| 2903 | svoboda | 243 | void udebug_thread_b_event(struct thread *t) |
| 2867 | svoboda | 244 | { |
| 245 | call_t *call; |
||
| 246 | ipl_t ipl; |
||
| 247 | |||
| 248 | ipl = interrupts_disable(); |
||
| 249 | spinlock_lock(&THREAD->debug_lock); |
||
| 250 | |||
| 2903 | svoboda | 251 | klog_printf("udebug_thread_b_event"); |
| 2867 | svoboda | 252 | klog_printf("- check state"); |
| 253 | |||
| 254 | /* Must only generate events when in debugging session */ |
||
| 255 | if (THREAD->debug_active != true) { |
||
| 256 | klog_printf("- debug_active: %s, debug_stop: %s", |
||
| 257 | THREAD->debug_active ? "yes(+)" : "no(-)", |
||
| 258 | THREAD->debug_stop ? "yes(-)" : "no(+)"); |
||
| 2848 | svoboda | 259 | spinlock_unlock(&THREAD->debug_lock); |
| 2823 | svoboda | 260 | interrupts_restore(ipl); |
| 2867 | svoboda | 261 | return; |
| 2801 | svoboda | 262 | } |
| 2867 | svoboda | 263 | |
| 264 | klog_printf("- trigger event"); |
||
| 265 | |||
| 266 | call = THREAD->debug_go_call; |
||
| 267 | IPC_SET_RETVAL(call->data, 0); |
||
| 2903 | svoboda | 268 | IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_B); |
| 2867 | svoboda | 269 | IPC_SET_ARG2(call->data, (unative_t)t); |
| 270 | |||
| 271 | /* |
||
| 272 | * Make sure debug_stop is true when going to sleep |
||
| 273 | * in case we get woken up by DEBUG_END. (At which |
||
| 274 | * point it must be back to the initial true value). |
||
| 275 | */ |
||
| 276 | THREAD->debug_stop = true; |
||
| 277 | |||
| 2903 | svoboda | 278 | THREAD->cur_event = UDEBUG_EVENT_THREAD_B; |
| 2867 | svoboda | 279 | spinlock_unlock(&THREAD->debug_lock); |
| 280 | |||
| 281 | spinlock_lock(&TASK->lock); |
||
| 282 | ipc_answer(&TASK->answerbox, THREAD->debug_go_call); |
||
| 283 | spinlock_unlock(&TASK->lock); |
||
| 284 | |||
| 285 | interrupts_restore(ipl); |
||
| 286 | klog_printf("- sleep"); |
||
| 2917 | svoboda | 287 | udebug_wait_for_go(&THREAD->go_wq); |
| 2801 | svoboda | 288 | } |
| 289 | |||
| 2903 | svoboda | 290 | void udebug_thread_e_event(void) |
| 291 | { |
||
| 292 | call_t *call; |
||
| 293 | ipl_t ipl; |
||
| 294 | |||
| 295 | ipl = interrupts_disable(); |
||
| 296 | spinlock_lock(&THREAD->debug_lock); |
||
| 297 | |||
| 298 | klog_printf("udebug_thread_e_event"); |
||
| 299 | klog_printf("- check state"); |
||
| 300 | |||
| 301 | /* Must only generate events when in debugging session */ |
||
| 302 | if (THREAD->debug_active != true) { |
||
| 303 | klog_printf("- debug_active: %s, debug_stop: %s", |
||
| 304 | THREAD->debug_active ? "yes(+)" : "no(-)", |
||
| 305 | THREAD->debug_stop ? "yes(-)" : "no(+)"); |
||
| 306 | spinlock_unlock(&THREAD->debug_lock); |
||
| 307 | interrupts_restore(ipl); |
||
| 308 | return; |
||
| 309 | } |
||
| 310 | |||
| 311 | klog_printf("- trigger event"); |
||
| 312 | |||
| 313 | call = THREAD->debug_go_call; |
||
| 314 | IPC_SET_RETVAL(call->data, 0); |
||
| 315 | IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E); |
||
| 316 | |||
| 2908 | svoboda | 317 | /* Prevent any further debug activity in thread */ |
| 318 | THREAD->debug_active = false; |
||
| 319 | THREAD->cur_event = 0; /* none */ |
||
| 320 | THREAD->debug_stop = true; /* set to initial value */ |
||
| 2903 | svoboda | 321 | spinlock_unlock(&THREAD->debug_lock); |
| 322 | |||
| 323 | spinlock_lock(&TASK->lock); |
||
| 324 | ipc_answer(&TASK->answerbox, THREAD->debug_go_call); |
||
| 325 | spinlock_unlock(&TASK->lock); |
||
| 326 | |||
| 327 | interrupts_restore(ipl); |
||
| 328 | |||
| 2908 | svoboda | 329 | /* This event does not sleep - debugging has finished in this thread */ |
| 2903 | svoboda | 330 | } |
| 331 | |||
| 2921 | svoboda | 332 | static void breakpoint_trap_event(uintptr_t addr, udebug_event_t etype) |
| 2918 | svoboda | 333 | { |
| 334 | call_t *call; |
||
| 335 | ipl_t ipl; |
||
| 2903 | svoboda | 336 | |
| 2918 | svoboda | 337 | ipl = interrupts_disable(); |
| 338 | spinlock_lock(&THREAD->debug_lock); |
||
| 339 | |||
| 340 | /* Must only generate events when in debugging session and have go */ |
||
| 341 | if (THREAD->debug_active != true || |
||
| 342 | THREAD->debug_stop == true || |
||
| 343 | (TASK->debug_evmask & UDEBUG_EVMASK(etype)) == 0) { |
||
| 344 | spinlock_unlock(&THREAD->debug_lock); |
||
| 345 | interrupts_restore(ipl); |
||
| 346 | return; |
||
| 347 | } |
||
| 348 | |||
| 2921 | svoboda | 349 | klog_printf("udebug_breakpoint/trap_event"); |
| 2918 | svoboda | 350 | call = THREAD->debug_go_call; |
| 351 | IPC_SET_RETVAL(call->data, 0); |
||
| 352 | IPC_SET_ARG1(call->data, etype); |
||
| 353 | IPC_SET_ARG2(call->data, addr); |
||
| 354 | |||
| 355 | /* |
||
| 356 | * Make sure debug_stop is true when going to sleep |
||
| 357 | * in case we get woken up by DEBUG_END. (At which |
||
| 358 | * point it must be back to the initial true value). |
||
| 359 | */ |
||
| 360 | THREAD->debug_stop = true; |
||
| 361 | |||
| 362 | THREAD->cur_event = etype; |
||
| 363 | spinlock_unlock(&THREAD->debug_lock); |
||
| 364 | klog_printf("- send answer"); |
||
| 365 | |||
| 366 | spinlock_lock(&TASK->lock); |
||
| 367 | ipc_answer(&TASK->answerbox, THREAD->debug_go_call); |
||
| 368 | spinlock_unlock(&TASK->lock); |
||
| 369 | interrupts_restore(ipl); |
||
| 370 | |||
| 371 | udebug_wait_for_go(&THREAD->go_wq); |
||
| 372 | } |
||
| 373 | |||
| 2921 | svoboda | 374 | void udebug_breakpoint_event(uintptr_t addr) |
| 375 | { |
||
| 376 | breakpoint_trap_event(addr, UDEBUG_EVENT_BREAKPOINT); |
||
| 377 | } |
||
| 2918 | svoboda | 378 | |
| 2921 | svoboda | 379 | void udebug_trap_event(uintptr_t addr) |
| 380 | { |
||
| 381 | breakpoint_trap_event(addr, UDEBUG_EVENT_TRAP); |
||
| 382 | } |
||
| 383 | |||
| 2870 | svoboda | 384 | /** |
| 385 | * Terminate task debugging session. |
||
| 386 | * |
||
| 387 | * \param ta Must be already locked and interrupts must be disabled. |
||
| 388 | * \return Zero on success or negative error code. |
||
| 389 | */ |
||
| 390 | int udebug_task_cleanup(struct task *ta) |
||
| 391 | { |
||
| 392 | thread_t *t; |
||
| 393 | link_t *cur; |
||
| 394 | int flags; |
||
| 2867 | svoboda | 395 | |
| 2870 | svoboda | 396 | klog_printf("udebug_task_cleanup()"); |
| 397 | klog_printf("task %llu", ta->taskid); |
||
| 398 | |||
| 399 | if (ta->dt_state == UDEBUG_TS_BEGINNING && |
||
| 400 | ta->dt_state != UDEBUG_TS_ACTIVE) { |
||
| 401 | klog_printf("udebug_task_cleanup(): task not being debugged"); |
||
| 402 | return EINVAL; |
||
| 403 | } |
||
| 404 | |||
| 405 | /* Finish debugging of all userspace threads */ |
||
| 406 | for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) { |
||
| 407 | t = list_get_instance(cur, thread_t, th_link); |
||
| 408 | |||
| 409 | spinlock_lock(&t->debug_lock); |
||
| 410 | spinlock_lock(&t->lock); |
||
| 411 | |||
| 412 | flags = t->flags; |
||
| 413 | |||
| 414 | spinlock_unlock(&t->lock); |
||
| 415 | |||
| 416 | /* Only process userspace threads */ |
||
| 417 | if ((flags & THREAD_FLAG_USPACE) != 0) { |
||
| 418 | /* Prevent any further debug activity in thread */ |
||
| 419 | t->debug_active = false; |
||
| 420 | t->cur_event = 0; /* none */ |
||
| 421 | |||
| 422 | /* Still has go? */ |
||
| 423 | if (t->debug_stop == false) { |
||
| 424 | /* |
||
| 425 | * Yes, so clear go. As debug_active == false, |
||
| 426 | * this doesn't affect anything. |
||
| 427 | */ |
||
| 428 | t->debug_stop = true; |
||
| 429 | |||
| 430 | /* Answer GO call */ |
||
| 431 | klog_printf("answer GO call with EVENT_FINISHED"); |
||
| 432 | IPC_SET_RETVAL(t->debug_go_call->data, 0); |
||
| 433 | IPC_SET_ARG1(t->debug_go_call->data, UDEBUG_EVENT_FINISHED); |
||
| 434 | ipc_answer(&ta->answerbox, t->debug_go_call); |
||
| 435 | } else { |
||
| 436 | /* |
||
| 437 | * Debug_stop is already at initial value. |
||
| 438 | * Yet this means the thread needs waking up. |
||
| 439 | */ |
||
| 440 | |||
| 441 | /* |
||
| 442 | * t's lock must not be held when calling |
||
| 443 | * waitq_wakeup. |
||
| 444 | */ |
||
| 445 | waitq_wakeup(&t->go_wq, WAKEUP_FIRST); |
||
| 446 | } |
||
| 447 | } |
||
| 448 | spinlock_unlock(&t->debug_lock); |
||
| 449 | } |
||
| 450 | |||
| 451 | ta->dt_state = UDEBUG_TS_INACTIVE; |
||
| 452 | ta->debugger = NULL; |
||
| 453 | |||
| 454 | return 0; |
||
| 455 | } |
||
| 456 | |||
| 457 | |||
| 2801 | svoboda | 458 | /** @} |
| 459 | */ |