445,10 → 445,20 |
thread_hash = (uintptr_t)thread_hash_arg; |
thread_id = next_thread_id++; |
|
printf("Start tracing thread [%d] (hash 0x%lx)\n", thread_id, thread_hash); |
printf("Start tracing thread [%d] (hash 0x%lx).\n", thread_id, thread_hash); |
|
while (!abort_trace) { |
|
if (paused) { |
printf("Press R to resume (and be patient).\n"); |
while (paused) { |
usleep(1000000); |
fibril_yield(); |
printf("."); |
} |
printf("Resumed\n"); |
} |
|
/* Run thread until an event occurs */ |
rc = udebug_go(phoneid, thread_hash, |
&ev_type, &val0, &val1); |
469,23 → 479,16 |
break; |
case UDEBUG_EVENT_STOP: |
printf("Stop event\n"); |
printf("Waiting for resume\n"); |
while (paused) { |
usleep(1000000); |
fibril_yield(); |
printf("."); |
} |
printf("Resumed\n"); |
break; |
case UDEBUG_EVENT_THREAD_B: |
event_thread_b(val0); |
break; |
case UDEBUG_EVENT_THREAD_E: |
printf("Thread 0x%lx exited\n", val0); |
printf("Thread 0x%lx exited.\n", val0); |
abort_trace = 1; |
break; |
default: |
printf("Unknown event type %d\n", ev_type); |
printf("Unknown event type %d.\n", ev_type); |
break; |
} |
} |
492,7 → 495,7 |
|
} |
|
printf("Finished tracing thread [%d]\n", thread_id); |
printf("Finished tracing thread [%d].\n", thread_id); |
return 0; |
} |
|
580,6 → 583,7 |
c = getchar(); |
if (c == 'q') break; |
if (c == 'p') { |
printf("Pause...\n"); |
paused = 1; |
rc = udebug_stop(phoneid, thash); |
printf("stop -> %d\n", rc); |
586,6 → 590,7 |
} |
if (c == 'r') { |
paused = 0; |
printf("Resume...\n"); |
} |
} |
|
702,7 → 707,7 |
case 'i': dm = dm | DM_IPC; break; |
case 'p': dm = dm | DM_SYSTEM | DM_USER; break; |
default: |
printf("Unexpected event type '%c'\n", *c); |
printf("Unexpected event type '%c'.\n", *c); |
exit(1); |
} |
|
777,6 → 782,7 |
int rc; |
|
printf("System Call / IPC Tracer\n"); |
printf("Controls: Q - Quit, P - Pause, R - Resume\n"); |
|
display_mask = DM_THREAD | DM_SYSTEM | DM_USER; |
|
787,11 → 793,11 |
|
rc = connect_task(task_id); |
if (rc < 0) { |
printf("Failed connecting to task %lld\n", task_id); |
printf("Failed connecting to task %lld.\n", task_id); |
return 1; |
} |
|
printf("Connected to task %lld\n", task_id); |
printf("Connected to task %lld.\n", task_id); |
|
if (task_ldr != NULL) { |
program_run(); |