Subversion Repositories HelenOS

Rev

Rev 4386 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4386 Rev 4387
Line 96... Line 96...
96
    rc = waitq_sleep_timeout_unsafe(wq, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
96
    rc = waitq_sleep_timeout_unsafe(wq, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
97
 
97
 
98
    waitq_sleep_finish(wq, rc, ipl);
98
    waitq_sleep_finish(wq, rc, ipl);
99
}
99
}
100
 
100
 
101
/** Do a preliminary check that a debugging session is in progress.
-
 
102
 *
-
 
103
 * This only requires the THREAD->udebug.lock mutex (and not TASK->udebug.lock
-
 
104
 * mutex). For an undebugged task, this will never block (while there could be
-
 
105
 * collisions by different threads on the TASK mutex), thus improving SMP
-
 
106
 * perormance for undebugged tasks.
-
 
107
 *
-
 
108
 * @return  True if the thread was in a debugging session when the function
-
 
109
 *      checked, false otherwise.
-
 
110
 */
-
 
111
static bool udebug_thread_precheck(void)
-
 
112
{
-
 
113
    bool res;
-
 
114
 
-
 
115
    mutex_lock(&THREAD->udebug.lock);
-
 
116
    res = THREAD->udebug.active;
-
 
117
    mutex_unlock(&THREAD->udebug.lock);
-
 
118
 
-
 
119
    return res;
-
 
120
}
-
 
121
 
-
 
122
/** Start of stoppable section.
101
/** Start of stoppable section.
123
 *
102
 *
124
 * A stoppable section is a section of code where if the thread can be stoped. In other words,
103
 * A stoppable section is a section of code where if the thread can be stoped. In other words,
125
 * if a STOP operation is issued, the thread is guaranteed not to execute
104
 * if a STOP operation is issued, the thread is guaranteed not to execute
126
 * any userspace instructions until the thread is resumed.
105
 * any userspace instructions until the thread is resumed.
Line 243... Line 222...
243
    call_t *call;
222
    call_t *call;
244
    udebug_event_t etype;
223
    udebug_event_t etype;
245
 
224
 
246
    etype = end_variant ? UDEBUG_EVENT_SYSCALL_E : UDEBUG_EVENT_SYSCALL_B;
225
    etype = end_variant ? UDEBUG_EVENT_SYSCALL_E : UDEBUG_EVENT_SYSCALL_B;
247
 
226
 
248
    /* Early check for undebugged tasks */
-
 
249
    if (!udebug_thread_precheck()) {
-
 
250
        return;
-
 
251
    }
-
 
252
 
-
 
253
    mutex_lock(&TASK->udebug.lock);
227
    mutex_lock(&TASK->udebug.lock);
254
    mutex_lock(&THREAD->udebug.lock);
228
    mutex_lock(&THREAD->udebug.lock);
255
 
229
 
256
    /* Must only generate events when in debugging session and is go. */
230
    /* Must only generate events when in debugging session and is go. */
257
    if (THREAD->udebug.active != true || THREAD->udebug.go == false ||
231
    if (THREAD->udebug.active != true || THREAD->udebug.go == false ||