/branches/tracing/kernel/generic/include/proc/thread.h |
---|
211,6 → 211,8 |
call_t *debug_go_call; |
unative_t syscall_args[6]; |
istate_t *uspace_state; |
bool debug_in_before_thread_runs; |
/** What type of event are we stopped in or 0 if none */ |
udebug_event_t cur_event; |
bool debug_stop; |
/branches/tracing/kernel/generic/include/udebug/udebug.h |
---|
211,6 → 211,8 |
void udebug_stoppable_begin(void); |
void udebug_stoppable_end(void); |
void udebug_before_thread_runs(void); |
void udebug_breakpoint_event(uintptr_t addr); |
void udebug_trap_event(uintptr_t addr); |
/branches/tracing/kernel/generic/src/time/clock.c |
---|
190,16 → 190,14 |
spinlock_unlock(&THREAD->lock); |
if (!ticks && !PREEMPTION_DISABLED) { |
/* |
* Make thread stoppable when preempted. |
* Necessary to be able to stop CPU-bound threads |
* that don't do any syscalls. |
*/ |
udebug_stoppable_begin(); |
scheduler(); |
udebug_stoppable_end(); |
/* |
* Give udebug chance to stop the thread |
* before it begins executing. |
*/ |
udebug_before_thread_runs(); |
} |
} |
/branches/tracing/kernel/generic/src/udebug/udebug.c |
---|
193,6 → 193,34 |
} |
} |
/** 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. |
*/ |
void udebug_before_thread_runs(void) |
{ |
ipl_t ipl; |
/* This will happen if we get preempted inside this function. */ |
if (THREAD->debug_in_before_thread_runs) |
return; |
THREAD->debug_in_before_thread_runs = true; |
ipl = interrupts_enable(); |
/* Now we're free to do whatever we need (lock mutexes, etc.) */ |
/* Check if we're supposed to stop */ |
udebug_stoppable_begin(); |
udebug_stoppable_end(); |
interrupts_restore(ipl); |
THREAD->debug_in_before_thread_runs = false; |
} |
void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3, |
unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc, |
bool end_variant) |