Rev 4584 | Rev 4654 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4584 | Rev 4653 | ||
|---|---|---|---|
| Line 42... | Line 42... | ||
| 42 | #include <async.h> |
42 | #include <async.h> |
| 43 | #include <task.h> |
43 | #include <task.h> |
| 44 | #include <mem.h> |
44 | #include <mem.h> |
| 45 | #include <string.h> |
45 | #include <string.h> |
| 46 | #include <loader/loader.h> |
46 | #include <loader/loader.h> |
| - | 47 | #include <io/console.h> |
|
| - | 48 | #include <io/keycode.h> |
|
| 47 | 49 | ||
| 48 | #include <libc.h> |
50 | #include <libc.h> |
| 49 | 51 | ||
| 50 | // Temporary: service and method names |
52 | // Temporary: service and method names |
| 51 | #include "proto.h" |
53 | #include "proto.h" |
| Line 450... | Line 452... | ||
| 450 | printf("Start tracing thread [%d] (hash 0x%lx).\n", thread_id, thread_hash); |
452 | printf("Start tracing thread [%d] (hash 0x%lx).\n", thread_id, thread_hash); |
| 451 | 453 | ||
| 452 | while (!abort_trace) { |
454 | while (!abort_trace) { |
| 453 | 455 | ||
| 454 | if (paused) { |
456 | if (paused) { |
| 455 | printf("Press R to resume (and be patient).\n"); |
457 | printf("Press R to resume.\n"); |
| 456 | while (paused) { |
458 | while (paused) { |
| 457 | usleep(1000000); |
459 | async_usleep(1000000); |
| 458 | fibril_yield(); |
- | |
| 459 | printf("."); |
- | |
| 460 | } |
460 | } |
| 461 | printf("Resumed\n"); |
461 | printf("Resumed\n"); |
| 462 | } |
462 | } |
| 463 | 463 | ||
| 464 | /* Run thread until an event occurs */ |
464 | /* Run thread until an event occurs */ |
| Line 555... | Line 555... | ||
| 555 | return NULL; |
555 | return NULL; |
| 556 | } |
556 | } |
| 557 | 557 | ||
| 558 | static void trace_task(task_id_t task_id) |
558 | static void trace_task(task_id_t task_id) |
| 559 | { |
559 | { |
| - | 560 | console_event_t ev; |
|
| - | 561 | bool done; |
|
| 560 | int i; |
562 | int i; |
| 561 | int rc; |
563 | int rc; |
| 562 | int c; |
- | |
| 563 | 564 | ||
| 564 | ipcp_init(); |
565 | ipcp_init(); |
| 565 | 566 | ||
| 566 | /* |
567 | /* |
| 567 | * User apps now typically have console on phone 3. |
568 | * User apps now typically have console on phone 3. |
| Line 579... | Line 580... | ||
| 579 | 580 | ||
| 580 | for (i = 0; i < n_threads; i++) { |
581 | for (i = 0; i < n_threads; i++) { |
| 581 | thread_trace_start(thread_hash_buf[i]); |
582 | thread_trace_start(thread_hash_buf[i]); |
| 582 | } |
583 | } |
| 583 | 584 | ||
| - | 585 | done = false; |
|
| - | 586 | ||
| 584 | while(1) { |
587 | while (!done) { |
| - | 588 | if (!console_get_event(fphone(stdin), &ev)) |
|
| 585 | c = getchar(); |
589 | return; |
| - | 590 | ||
| 586 | if (c == 'q') break; |
591 | if (ev.type != KEY_PRESS) |
| - | 592 | continue; |
|
| - | 593 | ||
| 587 | if (c == 'p') { |
594 | switch (ev.key) { |
| - | 595 | case KC_Q: |
|
| - | 596 | done = true; |
|
| - | 597 | break; |
|
| - | 598 | case KC_P: |
|
| 588 | printf("Pause...\n"); |
599 | printf("Pause...\n"); |
| 589 | paused = 1; |
- | |
| 590 | rc = udebug_stop(phoneid, thash); |
600 | rc = udebug_stop(phoneid, thash); |
| - | 601 | if (rc == EOK) |
|
| - | 602 | paused = 1; |
|
| - | 603 | else |
|
| 591 | printf("stop -> %d\n", rc); |
604 | printf("stop -> %d\n", rc); |
| 592 | } |
605 | break; |
| 593 | if (c == 'r') { |
606 | case KC_R: |
| 594 | paused = 0; |
607 | paused = 0; |
| 595 | printf("Resume...\n"); |
608 | printf("Resume...\n"); |
| - | 609 | break; |
|
| 596 | } |
610 | } |
| 597 | } |
611 | } |
| 598 | 612 | ||
| 599 | printf("\nTerminate debugging session...\n"); |
613 | printf("\nTerminate debugging session...\n"); |
| 600 | abort_trace = 1; |
614 | abort_trace = 1; |