Subversion Repositories HelenOS

Rev

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

Rev 3870 Rev 4384
Line 269... Line 269...
269
        mutex_unlock(&THREAD->udebug.lock);
269
        mutex_unlock(&THREAD->udebug.lock);
270
        mutex_unlock(&TASK->udebug.lock);
270
        mutex_unlock(&TASK->udebug.lock);
271
        return;
271
        return;
272
    }
272
    }
273
 
273
 
274
    //printf("udebug_syscall_event\n");
274
    /* Fill in the GO response. */
275
    call = THREAD->udebug.go_call;
275
    call = THREAD->udebug.go_call;
276
    THREAD->udebug.go_call = NULL;
276
    THREAD->udebug.go_call = NULL;
277
 
277
 
278
    IPC_SET_RETVAL(call->data, 0);
278
    IPC_SET_RETVAL(call->data, 0);
279
    IPC_SET_ARG1(call->data, etype);
279
    IPC_SET_ARG1(call->data, etype);
280
    IPC_SET_ARG2(call->data, id);
280
    IPC_SET_ARG2(call->data, id);
281
    IPC_SET_ARG3(call->data, rc);
281
    IPC_SET_ARG3(call->data, rc);
282
    //printf("udebug_syscall_event/ipc_answer\n");
-
 
283
 
282
 
284
    THREAD->udebug.syscall_args[0] = a1;
283
    THREAD->udebug.syscall_args[0] = a1;
285
    THREAD->udebug.syscall_args[1] = a2;
284
    THREAD->udebug.syscall_args[1] = a2;
286
    THREAD->udebug.syscall_args[2] = a3;
285
    THREAD->udebug.syscall_args[2] = a3;
287
    THREAD->udebug.syscall_args[3] = a4;
286
    THREAD->udebug.syscall_args[3] = a4;
Line 327... Line 326...
327
    mutex_lock(&TASK->udebug.lock);
326
    mutex_lock(&TASK->udebug.lock);
328
    mutex_lock(&THREAD->udebug.lock);
327
    mutex_lock(&THREAD->udebug.lock);
329
 
328
 
330
    thread_attach(t, ta);
329
    thread_attach(t, ta);
331
 
330
 
332
    LOG("udebug_thread_b_event\n");
-
 
333
    LOG("- check state\n");
331
    LOG("Check state");
334
 
332
 
335
    /* Must only generate events when in debugging session */
333
    /* Must only generate events when in debugging session */
336
    if (THREAD->udebug.active != true) {
334
    if (THREAD->udebug.active != true) {
337
        LOG("- udebug.active: %s, udebug.go: %s\n",
335
        LOG("udebug.active: %s, udebug.go: %s",
338
            THREAD->udebug.active ? "yes(+)" : "no(-)",
336
            THREAD->udebug.active ? "Yes(+)" : "No",
339
            THREAD->udebug.go ? "yes(-)" : "no(+)");
337
            THREAD->udebug.go ? "Yes(-)" : "No");
340
        mutex_unlock(&THREAD->udebug.lock);
338
        mutex_unlock(&THREAD->udebug.lock);
341
        mutex_unlock(&TASK->udebug.lock);
339
        mutex_unlock(&TASK->udebug.lock);
342
        return;
340
        return;
343
    }
341
    }
344
 
342
 
345
    LOG("- trigger event\n");
343
    LOG("Trigger event");
346
 
-
 
347
    call = THREAD->udebug.go_call;
344
    call = THREAD->udebug.go_call;
348
    THREAD->udebug.go_call = NULL;
345
    THREAD->udebug.go_call = NULL;
349
    IPC_SET_RETVAL(call->data, 0);
346
    IPC_SET_RETVAL(call->data, 0);
350
    IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_B);
347
    IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_B);
351
    IPC_SET_ARG2(call->data, (unative_t)t);
348
    IPC_SET_ARG2(call->data, (unative_t)t);
Line 361... Line 358...
361
    ipc_answer(&TASK->answerbox, call);
358
    ipc_answer(&TASK->answerbox, call);
362
 
359
 
363
    mutex_unlock(&THREAD->udebug.lock);
360
    mutex_unlock(&THREAD->udebug.lock);
364
    mutex_unlock(&TASK->udebug.lock);
361
    mutex_unlock(&TASK->udebug.lock);
365
 
362
 
366
    LOG("- sleep\n");
363
    LOG("Wait for Go");
367
    udebug_wait_for_go(&THREAD->udebug.go_wq);
364
    udebug_wait_for_go(&THREAD->udebug.go_wq);
368
}
365
}
369
 
366
 
370
/** Thread-termination event hook.
367
/** Thread-termination event hook.
371
 *
368
 *
Line 377... Line 374...
377
    call_t *call;
374
    call_t *call;
378
 
375
 
379
    mutex_lock(&TASK->udebug.lock);
376
    mutex_lock(&TASK->udebug.lock);
380
    mutex_lock(&THREAD->udebug.lock);
377
    mutex_lock(&THREAD->udebug.lock);
381
 
378
 
382
    LOG("udebug_thread_e_event\n");
-
 
383
    LOG("- check state\n");
379
    LOG("Check state");
384
 
380
 
385
    /* Must only generate events when in debugging session. */
381
    /* Must only generate events when in debugging session. */
386
    if (THREAD->udebug.active != true) {
382
    if (THREAD->udebug.active != true) {
387
/*      printf("- udebug.active: %s, udebug.go: %s\n",
383
        LOG("udebug.active: %s, udebug.go: %s",
388
            THREAD->udebug.active ? "yes(+)" : "no(-)",
384
            THREAD->udebug.active ? "Yes" : "No",
389
            THREAD->udebug.go ? "yes(-)" : "no(+)");*/
385
            THREAD->udebug.go ? "Yes" : "No");
390
        mutex_unlock(&THREAD->udebug.lock);
386
        mutex_unlock(&THREAD->udebug.lock);
391
        mutex_unlock(&TASK->udebug.lock);
387
        mutex_unlock(&TASK->udebug.lock);
392
        return;
388
        return;
393
    }
389
    }
394
 
390
 
395
    LOG("- trigger event\n");
391
    LOG("Trigger event");
396
 
-
 
397
    call = THREAD->udebug.go_call;
392
    call = THREAD->udebug.go_call;
398
    THREAD->udebug.go_call = NULL;
393
    THREAD->udebug.go_call = NULL;
399
    IPC_SET_RETVAL(call->data, 0);
394
    IPC_SET_RETVAL(call->data, 0);
400
    IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E);
395
    IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E);
401
 
396
 
Line 430... Line 425...
430
    thread_t *t;
425
    thread_t *t;
431
    link_t *cur;
426
    link_t *cur;
432
    int flags;
427
    int flags;
433
    ipl_t ipl;
428
    ipl_t ipl;
434
 
429
 
435
    LOG("udebug_task_cleanup()\n");
-
 
436
    LOG("task %" PRIu64 "\n", ta->taskid);
-
 
437
 
-
 
438
    if (ta->udebug.dt_state != UDEBUG_TS_BEGINNING &&
430
    if (ta->udebug.dt_state != UDEBUG_TS_BEGINNING &&
439
        ta->udebug.dt_state != UDEBUG_TS_ACTIVE) {
431
        ta->udebug.dt_state != UDEBUG_TS_ACTIVE) {
440
        LOG("udebug_task_cleanup(): task not being debugged\n");
-
 
441
        return EINVAL;
432
        return EINVAL;
442
    }
433
    }
443
 
434
 
-
 
435
    LOG("Task %" PRIu64, ta->taskid);
-
 
436
 
444
    /* Finish debugging of all userspace threads */
437
    /* Finish debugging of all userspace threads */
445
    for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) {
438
    for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) {
446
        t = list_get_instance(cur, thread_t, th_link);
439
        t = list_get_instance(cur, thread_t, th_link);
447
 
440
 
448
        mutex_lock(&t->udebug.lock);
441
        mutex_lock(&t->udebug.lock);
Line 468... Line 461...
468
                 * this doesn't affect anything.
461
                 * this doesn't affect anything.
469
                 */
462
                 */
470
                t->udebug.go = false;  
463
                t->udebug.go = false;  
471
 
464
 
472
                /* Answer GO call */
465
                /* Answer GO call */
473
                LOG("answer GO call with EVENT_FINISHED\n");
466
                LOG("Answer GO call with EVENT_FINISHED.");
474
                IPC_SET_RETVAL(t->udebug.go_call->data, 0);
467
                IPC_SET_RETVAL(t->udebug.go_call->data, 0);
475
                IPC_SET_ARG1(t->udebug.go_call->data,
468
                IPC_SET_ARG1(t->udebug.go_call->data,
476
                    UDEBUG_EVENT_FINISHED);
469
                    UDEBUG_EVENT_FINISHED);
477
 
470
 
478
                ipc_answer(&ta->answerbox, t->udebug.go_call);
471
                ipc_answer(&ta->answerbox, t->udebug.go_call);