99,6 → 99,24 |
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; |
109,6 → 127,12 |
|
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; |
194,6 → 218,12 |
|
void udebug_stoppable_end(void) |
{ |
/* Early check for undebugged tasks */ |
if (!udebug_thread_precheck()) { |
udebug_int_unlock(); |
return; |
} |
|
restart: |
mutex_lock(&TASK->udebug.lock); |
|
273,6 → 303,12 |
|
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); |
|
426,13 → 462,21 |
|
/* Must only generate events when in debugging session and have go */ |
if (THREAD->udebug.debug_active != true || |
THREAD->udebug.stop == true || |
(TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) { |
THREAD->udebug.stop == true) { |
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; |