Rev 3603 | Rev 3747 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3603 | Rev 3605 | ||
---|---|---|---|
Line 443... | Line 443... | ||
443 | sysarg_t val0, val1; |
443 | sysarg_t val0, val1; |
444 | 444 | ||
445 | thread_hash = (uintptr_t)thread_hash_arg; |
445 | thread_hash = (uintptr_t)thread_hash_arg; |
446 | thread_id = next_thread_id++; |
446 | thread_id = next_thread_id++; |
447 | 447 | ||
448 | printf("Start tracing thread [%d] (hash 0x%lx)\n", thread_id, thread_hash); |
448 | printf("Start tracing thread [%d] (hash 0x%lx).\n", thread_id, thread_hash); |
449 | 449 | ||
450 | while (!abort_trace) { |
450 | while (!abort_trace) { |
451 | 451 | ||
452 | if (paused) { |
452 | if (paused) { |
453 | printf("Waiting for resume\n"); |
453 | printf("Press R to resume (and be patient).\n"); |
454 | while (paused) { |
454 | while (paused) { |
455 | usleep(1000000); |
455 | usleep(1000000); |
456 | fibril_yield(); |
456 | fibril_yield(); |
457 | printf("."); |
457 | printf("."); |
458 | } |
458 | } |
Line 482... | Line 482... | ||
482 | break; |
482 | break; |
483 | case UDEBUG_EVENT_THREAD_B: |
483 | case UDEBUG_EVENT_THREAD_B: |
484 | event_thread_b(val0); |
484 | event_thread_b(val0); |
485 | break; |
485 | break; |
486 | case UDEBUG_EVENT_THREAD_E: |
486 | case UDEBUG_EVENT_THREAD_E: |
487 | printf("Thread 0x%lx exited\n", val0); |
487 | printf("Thread 0x%lx exited.\n", val0); |
488 | abort_trace = 1; |
488 | abort_trace = 1; |
489 | break; |
489 | break; |
490 | default: |
490 | default: |
491 | printf("Unknown event type %d\n", ev_type); |
491 | printf("Unknown event type %d.\n", ev_type); |
492 | break; |
492 | break; |
493 | } |
493 | } |
494 | } |
494 | } |
495 | 495 | ||
496 | } |
496 | } |
497 | 497 | ||
498 | printf("Finished tracing thread [%d]\n", thread_id); |
498 | printf("Finished tracing thread [%d].\n", thread_id); |
499 | return 0; |
499 | return 0; |
500 | } |
500 | } |
501 | 501 | ||
502 | void thread_trace_start(uintptr_t thread_hash) |
502 | void thread_trace_start(uintptr_t thread_hash) |
503 | { |
503 | { |
Line 705... | Line 705... | ||
705 | case 't': dm = dm | DM_THREAD; break; |
705 | case 't': dm = dm | DM_THREAD; break; |
706 | case 's': dm = dm | DM_SYSCALL; break; |
706 | case 's': dm = dm | DM_SYSCALL; break; |
707 | case 'i': dm = dm | DM_IPC; break; |
707 | case 'i': dm = dm | DM_IPC; break; |
708 | case 'p': dm = dm | DM_SYSTEM | DM_USER; break; |
708 | case 'p': dm = dm | DM_SYSTEM | DM_USER; break; |
709 | default: |
709 | default: |
710 | printf("Unexpected event type '%c'\n", *c); |
710 | printf("Unexpected event type '%c'.\n", *c); |
711 | exit(1); |
711 | exit(1); |
712 | } |
712 | } |
713 | 713 | ||
714 | ++c; |
714 | ++c; |
715 | } |
715 | } |
Line 780... | Line 780... | ||
780 | int main(int argc, char *argv[]) |
780 | int main(int argc, char *argv[]) |
781 | { |
781 | { |
782 | int rc; |
782 | int rc; |
783 | 783 | ||
784 | printf("System Call / IPC Tracer\n"); |
784 | printf("System Call / IPC Tracer\n"); |
- | 785 | printf("Controls: Q - Quit, P - Pause, R - Resume\n"); |
|
785 | 786 | ||
786 | display_mask = DM_THREAD | DM_SYSTEM | DM_USER; |
787 | display_mask = DM_THREAD | DM_SYSTEM | DM_USER; |
787 | 788 | ||
788 | if (parse_args(argc, argv) < 0) |
789 | if (parse_args(argc, argv) < 0) |
789 | return 1; |
790 | return 1; |
790 | 791 | ||
791 | main_init(); |
792 | main_init(); |
792 | 793 | ||
793 | rc = connect_task(task_id); |
794 | rc = connect_task(task_id); |
794 | if (rc < 0) { |
795 | if (rc < 0) { |
795 | printf("Failed connecting to task %lld\n", task_id); |
796 | printf("Failed connecting to task %lld.\n", task_id); |
796 | return 1; |
797 | return 1; |
797 | } |
798 | } |
798 | 799 | ||
799 | printf("Connected to task %lld\n", task_id); |
800 | printf("Connected to task %lld.\n", task_id); |
800 | 801 | ||
801 | if (task_ldr != NULL) { |
802 | if (task_ldr != NULL) { |
802 | program_run(); |
803 | program_run(); |
803 | } |
804 | } |
804 | 805 |