Rev 3468 | Rev 3601 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3468 | Rev 3600 | ||
|---|---|---|---|
| Line 245... | Line 245... | ||
| 245 | mutex_unlock(&TASK->udebug.lock); |
245 | mutex_unlock(&TASK->udebug.lock); |
| 246 | 246 | ||
| 247 | udebug_wait_for_go(&THREAD->udebug.go_wq); |
247 | udebug_wait_for_go(&THREAD->udebug.go_wq); |
| 248 | 248 | ||
| 249 | goto restart; |
249 | goto restart; |
| 250 | /* must try again - have to lose stoppability atomically */ |
250 | /* Must try again - have to lose stoppability atomically. */ |
| 251 | } else { |
251 | } else { |
| 252 | ++TASK->udebug.not_stoppable_count; |
252 | ++TASK->udebug.not_stoppable_count; |
| 253 | ASSERT(THREAD->udebug.stoppable == true); |
253 | ASSERT(THREAD->udebug.stoppable == true); |
| 254 | THREAD->udebug.stoppable = false; |
254 | THREAD->udebug.stoppable = false; |
| 255 | 255 | ||
| Line 319... | Line 319... | ||
| 319 | } |
319 | } |
| 320 | 320 | ||
| 321 | mutex_lock(&TASK->udebug.lock); |
321 | mutex_lock(&TASK->udebug.lock); |
| 322 | mutex_lock(&THREAD->udebug.lock); |
322 | mutex_lock(&THREAD->udebug.lock); |
| 323 | 323 | ||
| 324 | /* Must only generate events when in debugging session and have go */ |
324 | /* Must only generate events when in debugging session and is go. */ |
| 325 | if (THREAD->udebug.debug_active != true || |
325 | if (THREAD->udebug.debug_active != true || |
| 326 | THREAD->udebug.stop == true || |
326 | THREAD->udebug.stop == true || |
| 327 | (TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) { |
327 | (TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) { |
| 328 | mutex_unlock(&THREAD->udebug.lock); |
328 | mutex_unlock(&THREAD->udebug.lock); |
| 329 | mutex_unlock(&TASK->udebug.lock); |
329 | mutex_unlock(&TASK->udebug.lock); |
| Line 437... | Line 437... | ||
| 437 | mutex_lock(&THREAD->udebug.lock); |
437 | mutex_lock(&THREAD->udebug.lock); |
| 438 | 438 | ||
| 439 | LOG("udebug_thread_e_event\n"); |
439 | LOG("udebug_thread_e_event\n"); |
| 440 | LOG("- check state\n"); |
440 | LOG("- check state\n"); |
| 441 | 441 | ||
| 442 | /* Must only generate events when in debugging session */ |
442 | /* Must only generate events when in debugging session. */ |
| 443 | if (THREAD->udebug.debug_active != true) { |
443 | if (THREAD->udebug.debug_active != true) { |
| 444 | /* printf("- debug_active: %s, udebug.stop: %s\n", |
444 | /* printf("- debug_active: %s, udebug.stop: %s\n", |
| 445 | THREAD->udebug.debug_active ? "yes(+)" : "no(-)", |
445 | THREAD->udebug.debug_active ? "yes(+)" : "no(-)", |
| 446 | THREAD->udebug.stop ? "yes(-)" : "no(+)");*/ |
446 | THREAD->udebug.stop ? "yes(-)" : "no(+)");*/ |
| 447 | mutex_unlock(&THREAD->udebug.lock); |
447 | mutex_unlock(&THREAD->udebug.lock); |
| Line 454... | Line 454... | ||
| 454 | call = THREAD->udebug.go_call; |
454 | call = THREAD->udebug.go_call; |
| 455 | THREAD->udebug.go_call = NULL; |
455 | THREAD->udebug.go_call = NULL; |
| 456 | IPC_SET_RETVAL(call->data, 0); |
456 | IPC_SET_RETVAL(call->data, 0); |
| 457 | IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E); |
457 | IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E); |
| 458 | 458 | ||
| 459 | /* Prevent any further debug activity in thread */ |
459 | /* Prevent any further debug activity in thread. */ |
| 460 | THREAD->udebug.debug_active = false; |
460 | THREAD->udebug.debug_active = false; |
| 461 | THREAD->udebug.cur_event = 0; /* none */ |
461 | THREAD->udebug.cur_event = 0; /* none */ |
| 462 | THREAD->udebug.stop = true; /* set to initial value */ |
462 | THREAD->udebug.stop = true; /* set to initial value */ |
| 463 | 463 | ||
| 464 | ipc_answer(&TASK->answerbox, call); |
464 | ipc_answer(&TASK->answerbox, call); |
| 465 | 465 | ||
| 466 | mutex_unlock(&THREAD->udebug.lock); |
466 | mutex_unlock(&THREAD->udebug.lock); |
| 467 | mutex_unlock(&TASK->udebug.lock); |
467 | mutex_unlock(&TASK->udebug.lock); |
| 468 | 468 | ||
| 469 | /* Leave int_lock enabled */ |
469 | /* Leave int_lock enabled. */ |
| 470 | /* This event does not sleep - debugging has finished in this thread */ |
470 | /* This event does not sleep - debugging has finished in this thread. */ |
| 471 | } |
471 | } |
| 472 | 472 | ||
| 473 | /** |
473 | /** |
| 474 | * Terminate task debugging session. |
474 | * Terminate task debugging session. |
| 475 | * |
475 | * |
| Line 510... | Line 510... | ||
| 510 | flags = t->flags; |
510 | flags = t->flags; |
| 511 | 511 | ||
| 512 | spinlock_unlock(&t->lock); |
512 | spinlock_unlock(&t->lock); |
| 513 | interrupts_restore(ipl); |
513 | interrupts_restore(ipl); |
| 514 | 514 | ||
| 515 | /* Only process userspace threads */ |
515 | /* Only process userspace threads. */ |
| 516 | if ((flags & THREAD_FLAG_USPACE) != 0) { |
516 | if ((flags & THREAD_FLAG_USPACE) != 0) { |
| 517 | /* Prevent any further debug activity in thread */ |
517 | /* Prevent any further debug activity in thread. */ |
| 518 | t->udebug.debug_active = false; |
518 | t->udebug.debug_active = false; |
| 519 | t->udebug.cur_event = 0; /* none */ |
519 | t->udebug.cur_event = 0; /* none */ |
| 520 | 520 | ||
| 521 | /* Still has go? */ |
521 | /* Is the thread still go? */ |
| 522 | if (t->udebug.stop == false) { |
522 | if (t->udebug.stop == false) { |
| 523 | /* |
523 | /* |
| 524 | * Yes, so clear go. As debug_active == false, |
524 | * Yes, so clear go. As debug_active == false, |
| 525 | * this doesn't affect anything. |
525 | * this doesn't affect anything. |
| 526 | */ |
526 | */ |