Rev 2917 | Rev 2921 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2917 | Rev 2918 | ||
|---|---|---|---|
| Line 327... | Line 327... | ||
| 327 | interrupts_restore(ipl); |
327 | interrupts_restore(ipl); |
| 328 | 328 | ||
| 329 | /* This event does not sleep - debugging has finished in this thread */ |
329 | /* This event does not sleep - debugging has finished in this thread */ |
| 330 | } |
330 | } |
| 331 | 331 | ||
| - | 332 | void udebug_breakpoint_event(uintptr_t addr) |
|
| - | 333 | { |
|
| - | 334 | call_t *call; |
|
| - | 335 | ipl_t ipl; |
|
| - | 336 | udebug_event_t etype; |
|
| - | 337 | ||
| - | 338 | etype = UDEBUG_EVENT_BREAKPOINT; |
|
| - | 339 | ||
| - | 340 | ipl = interrupts_disable(); |
|
| - | 341 | spinlock_lock(&THREAD->debug_lock); |
|
| - | 342 | ||
| - | 343 | /* Must only generate events when in debugging session and have go */ |
|
| - | 344 | if (THREAD->debug_active != true || |
|
| - | 345 | THREAD->debug_stop == true || |
|
| - | 346 | (TASK->debug_evmask & UDEBUG_EVMASK(etype)) == 0) { |
|
| - | 347 | spinlock_unlock(&THREAD->debug_lock); |
|
| - | 348 | interrupts_restore(ipl); |
|
| - | 349 | return; |
|
| - | 350 | } |
|
| - | 351 | ||
| - | 352 | klog_printf("udebug_breakpoint_event"); |
|
| - | 353 | call = THREAD->debug_go_call; |
|
| - | 354 | IPC_SET_RETVAL(call->data, 0); |
|
| - | 355 | IPC_SET_ARG1(call->data, etype); |
|
| - | 356 | IPC_SET_ARG2(call->data, addr); |
|
| - | 357 | ||
| - | 358 | /* |
|
| - | 359 | * Make sure debug_stop is true when going to sleep |
|
| - | 360 | * in case we get woken up by DEBUG_END. (At which |
|
| - | 361 | * point it must be back to the initial true value). |
|
| - | 362 | */ |
|
| - | 363 | THREAD->debug_stop = true; |
|
| - | 364 | ||
| - | 365 | THREAD->cur_event = etype; |
|
| - | 366 | spinlock_unlock(&THREAD->debug_lock); |
|
| - | 367 | klog_printf("- send answer"); |
|
| - | 368 | ||
| - | 369 | spinlock_lock(&TASK->lock); |
|
| - | 370 | ipc_answer(&TASK->answerbox, THREAD->debug_go_call); |
|
| - | 371 | spinlock_unlock(&TASK->lock); |
|
| - | 372 | interrupts_restore(ipl); |
|
| - | 373 | ||
| - | 374 | udebug_wait_for_go(&THREAD->go_wq); |
|
| - | 375 | } |
|
| - | 376 | ||
| 332 | 377 | ||
| 333 | /** |
378 | /** |
| 334 | * Terminate task debugging session. |
379 | * Terminate task debugging session. |
| 335 | * |
380 | * |
| 336 | * \param ta Must be already locked and interrupts must be disabled. |
381 | * \param ta Must be already locked and interrupts must be disabled. |