/trunk/kernel/generic/include/udebug/udebug.h |
---|
175,6 → 175,7 |
waitq_t go_wq; |
call_t *go_call; |
unative_t syscall_args[6]; |
istate_t *uspace_state; |
/** What type of event are we stopped in or 0 if none. */ |
udebug_event_t cur_event; |
/trunk/kernel/generic/src/interrupt/interrupt.c |
---|
86,8 → 86,17 |
void exc_dispatch(int n, istate_t *istate) |
{ |
ASSERT(n < IVT_ITEMS); |
#ifdef CONFIG_UDEBUG |
if (THREAD) THREAD->udebug.uspace_state = istate; |
#endif |
exc_table[n].f(n + IVT_FIRST, istate); |
#ifdef CONFIG_UDEBUG |
if (THREAD) THREAD->udebug.uspace_state = NULL; |
#endif |
/* This is a safe place to exit exiting thread */ |
if (THREAD && THREAD->interrupted && istate_from_uspace(istate)) |
thread_exit(); |
/trunk/kernel/generic/src/time/clock.c |
---|
190,6 → 190,14 |
if (!ticks && !PREEMPTION_DISABLED) { |
scheduler(); |
#ifdef CONFIG_UDEBUG |
/* |
* Give udebug chance to stop the thread |
* before it begins executing. |
*/ |
if (istate_from_uspace(THREAD->udebug.uspace_state)) |
udebug_before_thread_runs(); |
#endif |
} |
} |
/trunk/kernel/generic/src/udebug/udebug.c |
---|
69,6 → 69,7 |
waitq_initialize(&ut->go_wq); |
ut->go_call = NULL; |
ut->uspace_state = NULL; |
ut->go = false; |
ut->stoppable = true; |
ut->debug_active = false; |
231,26 → 232,13 |
/** Upon being scheduled to run, check if the current thread should stop. |
* |
* This function is called from clock(). Preemption is enabled. |
* interrupts are disabled, but since this is called after |
* being scheduled-in, we can enable them, if we're careful enough |
* not to allow arbitrary recursion or deadlock with the thread context. |
* This function is called from clock(). |
*/ |
void udebug_before_thread_runs(void) |
{ |
ipl_t ipl; |
return; |
ipl = interrupts_enable(); |
/* Now we're free to do whatever we need (lock mutexes, sleep, etc.) */ |
/* Check if we're supposed to stop */ |
udebug_stoppable_begin(); |
udebug_stoppable_end(); |
interrupts_restore(ipl); |
} |
/** Syscall event hook. |