Subversion Repositories HelenOS

Rev

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

Rev 2894 Rev 2898
Line 60... Line 60...
60
int next_thread_id;
60
int next_thread_id;
61
 
61
 
62
int phoneid;
62
int phoneid;
63
int abort_trace;
63
int abort_trace;
64
 
64
 
-
 
65
unsigned thash;
-
 
66
volatile int paused;
-
 
67
 
65
void thread_trace_start(unsigned thread_hash);
68
void thread_trace_start(unsigned thread_hash);
66
 
69
 
67
static proto_t *proto_console;
70
static proto_t *proto_console;
68
 
71
 
69
int task_connect(int taskid)
72
int task_connect(int taskid)
Line 332... Line 335...
332
        if (rc >= 0) {
335
        if (rc >= 0) {
333
            switch (ev_type) {
336
            switch (ev_type) {
334
            case UDEBUG_EVENT_SYSCALL:
337
            case UDEBUG_EVENT_SYSCALL:
335
                event_syscall(thread_id, thread_hash, val0, (int)val1);
338
                event_syscall(thread_id, thread_hash, val0, (int)val1);
336
                break;
339
                break;
-
 
340
            case UDEBUG_EVENT_STOP:
-
 
341
                printf("stop event\n");
-
 
342
                printf("waiting for resume\n");
-
 
343
                while (paused) {
-
 
344
                    usleep(1000000);
-
 
345
                    fibril_yield();
-
 
346
                    printf(".");
-
 
347
                }
-
 
348
                printf("resumed\n");
-
 
349
                break;
337
            case UDEBUG_EVENT_NEW_THREAD:
350
            case UDEBUG_EVENT_NEW_THREAD:
338
                event_new_thread(val0);
351
                event_new_thread(val0);
339
                break;
352
                break;
340
            default:
353
            default:
341
                printf("unknown event type %d\n", ev_type);
354
                printf("unknown event type %d\n", ev_type);
Line 350... Line 363...
350
 
363
 
351
void thread_trace_start(unsigned thread_hash)
364
void thread_trace_start(unsigned thread_hash)
352
{
365
{
353
    fid_t fid;
366
    fid_t fid;
354
 
367
 
-
 
368
    thash = thread_hash;
-
 
369
 
355
    fid = fibril_create(trace_loop, (void *)thread_hash);
370
    fid = fibril_create(trace_loop, (void *)thread_hash);
356
    if (fid == 0) {
371
    if (fid == 0) {
357
        printf("Warning: Failed creating fibril\n");
372
        printf("Warning: Failed creating fibril\n");
358
    }
373
    }
359
    fibril_add_ready(fid);
374
    fibril_add_ready(fid);
Line 362... Line 377...
362
void trace_active_task(void)
377
void trace_active_task(void)
363
{
378
{
364
    int taskid;
379
    int taskid;
365
    int i;
380
    int i;
366
    int rc;
381
    int rc;
-
 
382
    int c;
367
 
383
 
368
    printf("Syscall Tracer\n");
384
    printf("Syscall Tracer\n");
369
    printf("Press 'c' to connect\n");
385
    printf("Press 'c' to connect\n");
370
    while ((i = getchar()) != 'c')
386
    while ((i = getchar()) != 'c')
371
        putchar(i);
387
        putchar(i);
Line 392... Line 408...
392
 
408
 
393
    for (i = 0; i < n_threads; i++) {
409
    for (i = 0; i < n_threads; i++) {
394
        thread_trace_start(thread_hash_buf[i]);
410
        thread_trace_start(thread_hash_buf[i]);
395
    }
411
    }
396
 
412
 
-
 
413
    while(1) {
397
    getchar();
414
        c = getchar();
-
 
415
        if (c == 'q') break;
-
 
416
        if (c == 'p') {
-
 
417
            paused = 1;
-
 
418
            rc = debug_stop(phoneid, thash);
-
 
419
            printf("stop -> %d\n", rc);
-
 
420
        }
-
 
421
        if (c == 'r') {
-
 
422
            paused = 0;
-
 
423
        }
-
 
424
    }
398
 
425
 
399
    printf("terminate debugging session...\n");
426
    printf("terminate debugging session...\n");
400
    abort_trace = 1;
427
    abort_trace = 1;
401
    debug_end(phoneid);
428
    debug_end(phoneid);
402
    ipc_hangup(phoneid);
429
    ipc_hangup(phoneid);
Line 411... Line 438...
411
{
438
{
412
    proto_t *p;
439
    proto_t *p;
413
    oper_t *o;
440
    oper_t *o;
414
 
441
 
415
    next_thread_id = 1;
442
    next_thread_id = 1;
-
 
443
    paused = 0;
416
 
444
 
417
    proto_init();
445
    proto_init();
418
 
446
 
419
    p = proto_new("vfs");
447
    p = proto_new("vfs");
420
    o = oper_new("read");
448
    o = oper_new("read");