Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3030 → Rev 3026

/branches/tracing/kernel/generic/src/udebug/udebug.c
99,24 → 99,6
waitq_sleep_finish(wq, rc, ipl);
}
 
/** Do a preliminary check that a debugging session is in progress.
*
* This only requires the THREAD->udebug.lock mutex (and not
* TASK->udebug.lock mutex). For an undebugged task, this will
* never block (while there could be collisions by different threads
* on the TASK mutex), thus improving SMP perormance for undebugged tasks.
*/
static bool udebug_thread_precheck(void)
{
bool res;
 
mutex_lock(&THREAD->udebug.lock);
res = THREAD->udebug.debug_active;
mutex_unlock(&THREAD->udebug.lock);
 
return res;
}
 
void udebug_stoppable_begin(void)
{
int nsc;
127,12 → 109,6
 
udebug_int_lock();
 
/* Early check for undebugged tasks */
if (!udebug_thread_precheck()) {
udebug_int_unlock();
return;
}
 
mutex_lock(&TASK->udebug.lock);
 
nsc = --TASK->udebug.not_stoppable_count;
218,12 → 194,6
 
void udebug_stoppable_end(void)
{
/* Early check for undebugged tasks */
if (!udebug_thread_precheck()) {
udebug_int_unlock();
return;
}
 
restart:
mutex_lock(&TASK->udebug.lock);
 
303,12 → 273,6
 
udebug_int_lock();
 
/* Early check for undebugged tasks */
if (!udebug_thread_precheck()) {
udebug_int_unlock();
return;
}
 
mutex_lock(&TASK->udebug.lock);
mutex_lock(&THREAD->udebug.lock);
 
462,21 → 426,13
 
/* Must only generate events when in debugging session and have go */
if (THREAD->udebug.debug_active != true ||
THREAD->udebug.stop == true) {
THREAD->udebug.stop == true ||
(TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) {
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
udebug_int_unlock();
return;
}
 
/* Verify that the event is enabled */
if ((TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) {
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
udebug_int_unlock();
return;
}
 
klog_printf("udebug_breakpoint/trap_event");
call = THREAD->udebug.go_call;
THREAD->udebug.go_call = NULL;