Changeset c9a29d6 in mainline
- Timestamp:
- 2008-09-17T14:12:18Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8c125ad
- Parents:
- 0108984a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/trace/trace.c
r0108984a rc9a29d6 73 73 int rc; 74 74 75 printf("ipc_connect_task(%lld)... ", task_id);76 75 rc = ipc_connect_kbox(task_id); 77 printf("-> %d\n", rc);78 76 79 77 if (rc == ENOTSUP) { … … 82 80 printf("Compile kernel with 'Support for userspace debuggers' " 83 81 "(CONFIG_UDEBUG) enabled.\n"); 82 return rc; 83 } 84 85 if (rc < 0) { 86 printf("Error connecting\n"); 87 printf("ipc_connect_task(%lld) -> %d ", task_id, rc); 88 return rc; 84 89 } 85 90 86 91 phoneid = rc; 87 if (rc < 0) return rc; 88 89 printf("udebug_begin()... "); 92 90 93 rc = udebug_begin(phoneid); 91 printf("-> %d\n", rc); 92 if (rc < 0) return rc; 93 94 printf("udebug_set_evmask(0x%x)... ", UDEBUG_EM_ALL); 94 if (rc < 0) { 95 printf("udebug_begin() -> %d\n", rc); 96 return rc; 97 } 98 95 99 rc = udebug_set_evmask(phoneid, UDEBUG_EM_ALL); 96 printf("-> %d\n", rc); 97 if (rc < 0) return rc; 100 if (rc < 0) { 101 printf("udebug_set_evmask(0x%x) -> %d\n ", UDEBUG_EM_ALL, rc); 102 return rc; 103 } 98 104 99 105 return 0; … … 107 113 int i; 108 114 109 printf("send IPC_M_DEBUG_THREAD_READ message\n");110 115 rc = udebug_thread_read(phoneid, thread_hash_buf, 111 116 THBUF_SIZE*sizeof(unsigned), &tb_copied, &tb_needed); 112 printf("-> %d\n", rc); 113 if (rc < 0) return rc; 117 if (rc < 0) { 118 printf("udebug_thread_read() -> %d\n", rc); 119 return rc; 120 } 114 121 115 122 n_threads = tb_copied / sizeof(unsigned); 116 123 117 printf(" thread IDs:");118 for (i =0; i<n_threads; i++) {119 printf(" %u", thread_hash_buf[i]);124 printf("Threads:"); 125 for (i = 0; i < n_threads; i++) { 126 printf(" [%d] (hash 0x%u)", 1+i, thread_hash_buf[i]); 120 127 } 121 128 printf("\ntotal of %u threads\n", tb_needed/sizeof(unsigned)); … … 335 342 { 336 343 async_serialize_start(); 337 printf(" new thread, hash 0x%x\n", hash);344 printf("New thread, hash 0x%x\n", hash); 338 345 async_serialize_end(); 339 346 … … 352 359 thread_id = next_thread_id++; 353 360 354 printf(" trace_loop(%d)\n", thread_id);361 printf("Start tracing thread [%d] (hash 0x%x)\n", thread_id, thread_hash); 355 362 356 363 while (!abort_trace) { … … 362 369 // printf("rc = %d, ev_type=%d\n", rc, ev_type); 363 370 if (ev_type == UDEBUG_EVENT_FINISHED) { 364 printf("thread %u debugging finished\n", thread_id);371 /* Done tracing this thread */ 365 372 break; 366 373 } … … 375 382 break; 376 383 case UDEBUG_EVENT_STOP: 377 printf(" stop event\n");378 printf(" waiting for resume\n");384 printf("Stop event\n"); 385 printf("Waiting for resume\n"); 379 386 while (paused) { 380 387 usleep(1000000); … … 382 389 printf("."); 383 390 } 384 printf(" resumed\n");391 printf("Resumed\n"); 385 392 break; 386 393 case UDEBUG_EVENT_THREAD_B: … … 388 395 break; 389 396 case UDEBUG_EVENT_THREAD_E: 390 printf(" thread 0x%x exited\n", val0);397 printf("Thread 0x%x exited\n", val0); 391 398 abort_trace = 1; 392 399 break; 393 400 default: 394 printf(" unknown event type %d\n", ev_type);401 printf("Unknown event type %d\n", ev_type); 395 402 break; 396 403 } … … 399 406 } 400 407 401 printf(" trace_loop(%d) exiting\n", thread_id);408 printf("Finished tracing thread [%d]\n", thread_id); 402 409 return 0; 403 410 } … … 433 440 434 441 ipcp_init(); 435 ipcp_connection_set(1, 0, proto_console); 442 443 /* 444 * User apps now typically have console on phone 3. 445 * (Phones 1 and 2 are used by the loader). 446 */ 447 ipcp_connection_set(3, 0, proto_console); 436 448 437 449 rc = get_thread_list(); … … 460 472 } 461 473 462 printf(" terminate debugging session...\n");474 printf("\nTerminate debugging session...\n"); 463 475 abort_trace = 1; 464 476 udebug_end(phoneid); … … 467 479 ipcp_cleanup(); 468 480 469 printf(" done\n");481 printf("Done\n"); 470 482 return; 471 483 } … … 521 533 static void print_syntax() 522 534 { 523 printf(" syntax: trace <task_id>\n");535 printf("Syntax: trace <task_id>\n"); 524 536 } 525 537
Note:
See TracChangeset
for help on using the changeset viewer.