Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3682 → Rev 3683

/trunk/kernel/generic/include/udebug/udebug.h
177,9 → 177,9
 
/** What type of event are we stopped in or 0 if none. */
udebug_event_t cur_event;
bool go; /**< thread is GO */
bool stoppable; /**< thread is stoppable */
bool debug_active; /**< thread is in a debugging session */
bool go; /**< thread is GO */
bool stoppable; /**< thread is stoppable */
bool active; /**< thread is in a debugging session */
} udebug_thread_t;
 
struct task;
/trunk/kernel/generic/src/udebug/udebug.c
72,7 → 72,7
ut->uspace_state = NULL;
ut->go = false;
ut->stoppable = true;
ut->debug_active = false;
ut->active = false;
ut->cur_event = 0; /* none */
}
 
112,7 → 112,7
bool res;
 
mutex_lock(&THREAD->udebug.lock);
res = THREAD->udebug.debug_active;
res = THREAD->udebug.active;
mutex_unlock(&THREAD->udebug.lock);
 
return res;
170,7 → 170,7
* Active debugging session
*/
 
if (THREAD->udebug.debug_active == true &&
if (THREAD->udebug.active == true &&
THREAD->udebug.go == false) {
/*
* Thread was requested to stop - answer go call
210,8 → 210,7
mutex_lock(&TASK->udebug.lock);
mutex_lock(&THREAD->udebug.lock);
 
if (THREAD->udebug.debug_active &&
THREAD->udebug.go == false) {
if (THREAD->udebug.active && THREAD->udebug.go == false) {
TASK->udebug.begin_call = NULL;
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
264,8 → 263,7
mutex_lock(&THREAD->udebug.lock);
 
/* Must only generate events when in debugging session and is go. */
if (THREAD->udebug.debug_active != true ||
THREAD->udebug.go == false ||
if (THREAD->udebug.active != true || THREAD->udebug.go == false ||
(TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) {
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
334,9 → 332,9
LOG("- check state\n");
 
/* Must only generate events when in debugging session */
if (THREAD->udebug.debug_active != true) {
LOG("- debug_active: %s, udebug.go: %s\n",
THREAD->udebug.debug_active ? "yes(+)" : "no(-)",
if (THREAD->udebug.active != true) {
LOG("- udebug.active: %s, udebug.go: %s\n",
THREAD->udebug.active ? "yes(+)" : "no(-)",
THREAD->udebug.go ? "yes(-)" : "no(+)");
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
384,9 → 382,9
LOG("- check state\n");
 
/* Must only generate events when in debugging session. */
if (THREAD->udebug.debug_active != true) {
/* printf("- debug_active: %s, udebug.go: %s\n",
THREAD->udebug.debug_active ? "yes(+)" : "no(-)",
if (THREAD->udebug.active != true) {
/* printf("- udebug.active: %s, udebug.go: %s\n",
THREAD->udebug.active ? "yes(+)" : "no(-)",
THREAD->udebug.go ? "yes(-)" : "no(+)");*/
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
401,7 → 399,7
IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E);
 
/* Prevent any further debug activity in thread. */
THREAD->udebug.debug_active = false;
THREAD->udebug.active = false;
THREAD->udebug.cur_event = 0; /* none */
THREAD->udebug.go = false; /* set to initial value */
 
459,13 → 457,13
/* Only process userspace threads. */
if ((flags & THREAD_FLAG_USPACE) != 0) {
/* Prevent any further debug activity in thread. */
t->udebug.debug_active = false;
t->udebug.active = false;
t->udebug.cur_event = 0; /* none */
 
/* Is the thread still go? */
if (t->udebug.go == true) {
/*
* Yes, so clear go. As debug_active == false,
* Yes, so clear go. As active == false,
* this doesn't affect anything.
*/
t->udebug.go = false;
/trunk/kernel/generic/src/udebug/udebug_ops.c
58,7 → 58,7
* Specifically, verifies that thread t exists, is a userspace thread,
* and belongs to the current task (TASK). Verifies, that the thread
* is (or is not) go according to being_go (typically false).
* It also locks t->udebug.lock, making sure that t->udebug.debug_active
* It also locks t->udebug.lock, making sure that t->udebug.active
* is true - that the thread is in a valid debugging session.
*
* With this verified and the t->udebug.lock mutex held, it is ensured
108,7 → 108,7
}
 
/* Verify debugging state. */
if (t->udebug.debug_active != true) {
if (t->udebug.active != true) {
/* Not in debugging session or undesired GO state */
spinlock_unlock(&t->lock);
interrupts_restore(ipl);
117,8 → 117,8
}
 
/*
* Since the thread has debug_active == true, TASK->udebug.lock
* is enough to ensure its existence and that debug_active remains
* Since the thread has active == true, TASK->udebug.lock
* is enough to ensure its existence and that active remains
* true.
*/
spinlock_unlock(&t->lock);
204,7 → 204,7
reply = 0; /* no reply */
}
/* Set udebug.debug_active on all of the task's userspace threads. */
/* Set udebug.active on all of the task's userspace threads. */
 
for (cur = TASK->th_head.next; cur != &TASK->th_head; cur = cur->next) {
t = list_get_instance(cur, thread_t, th_link);
211,7 → 211,7
 
mutex_lock(&t->udebug.lock);
if ((t->flags & THREAD_FLAG_USPACE) != 0)
t->udebug.debug_active = true;
t->udebug.active = true;
mutex_unlock(&t->udebug.lock);
}