Subversion Repositories HelenOS

Rev

Rev 3611 | Rev 3684 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3611 Rev 3623
Line 303... Line 303...
303
    mutex_unlock(&TASK->udebug.lock);
303
    mutex_unlock(&TASK->udebug.lock);
304
 
304
 
305
    udebug_wait_for_go(&THREAD->udebug.go_wq);
305
    udebug_wait_for_go(&THREAD->udebug.go_wq);
306
}
306
}
307
 
307
 
308
/** Thread-creation event hook.
308
/** Thread-creation event hook combined with attaching the thread.
309
 *
309
 *
310
 * Must be called when a new userspace thread is created in the debugged
310
 * Must be called when a new userspace thread is created in the debugged
-
 
311
 * task. Generates a THREAD_B event. Also attaches the thread @a t
-
 
312
 * to the task @a ta.
-
 
313
 *
-
 
314
 * This is necessary to avoid a race condition where the BEGIN and THREAD_READ
-
 
315
 * requests would be handled inbetween attaching the thread and checking it
-
 
316
 * for being in a debugging session to send the THREAD_B event. We could then
-
 
317
 * either miss threads or get some threads both in the thread list
311
 * task. Generates a THREAD_B event.
318
 * and get a THREAD_B event for them.
312
 *
319
 *
313
 * @param t Structure of the thread being created. Not locked, as the
320
 * @param t Structure of the thread being created. Not locked, as the
314
 *      thread is not executing yet.
321
 *      thread is not executing yet.
-
 
322
 * @param ta    Task to which the thread should be attached.
315
 */
323
 */
316
void udebug_thread_b_event(struct thread *t)
324
void udebug_thread_b_event_attach(struct thread *t, struct task *ta)
317
{
325
{
318
    call_t *call;
326
    call_t *call;
319
 
327
 
320
    mutex_lock(&TASK->udebug.lock);
328
    mutex_lock(&TASK->udebug.lock);
321
    mutex_lock(&THREAD->udebug.lock);
329
    mutex_lock(&THREAD->udebug.lock);
322
 
330
 
-
 
331
    thread_attach(t, ta);
-
 
332
 
323
    LOG("udebug_thread_b_event\n");
333
    LOG("udebug_thread_b_event\n");
324
    LOG("- check state\n");
334
    LOG("- check state\n");
325
 
335
 
326
    /* Must only generate events when in debugging session */
336
    /* Must only generate events when in debugging session */
327
    if (THREAD->udebug.debug_active != true) {
337
    if (THREAD->udebug.debug_active != true) {