Changes in uspace/app/trace/trace.c [7e752b2:1ccafee] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/trace/trace.c
r7e752b2 r1ccafee 43 43 #include <task.h> 44 44 #include <mem.h> 45 #include <str .h>45 #include <string.h> 46 46 #include <bool.h> 47 47 #include <loader/loader.h> … … 161 161 if (rc < 0) { 162 162 printf("Error connecting\n"); 163 printf("ipc_connect_task(%" PRI u64") -> %d ", task_id, rc);163 printf("ipc_connect_task(%" PRIdTASKID ") -> %d ", task_id, rc); 164 164 return rc; 165 165 } … … 200 200 printf("Threads:"); 201 201 for (i = 0; i < n_threads; i++) { 202 printf(" [%d] (hash %p)", 1 + i, (void *)thread_hash_buf[i]);203 } 204 printf("\ntotal of % zu threads\n", tb_needed / sizeof(uintptr_t));202 printf(" [%d] (hash %p)", 1+i, thread_hash_buf[i]); 203 } 204 printf("\ntotal of %u threads\n", tb_needed / sizeof(uintptr_t)); 205 205 206 206 return 0; … … 224 224 case V_HASH: 225 225 case V_PTR: 226 printf("%p", (void *)val);226 printf("%p", val); 227 227 break; 228 228 … … 248 248 case V_CHAR: 249 249 if (sval >= 0x20 && sval < 0x7f) { 250 printf("'%c'", (char)sval);250 printf("'%c'", sval); 251 251 } else { 252 252 switch (sval) { … … 257 257 case '\t': printf("'\\t'"); break; 258 258 case '\\': printf("'\\\\'"); break; 259 default: printf("'\\x%02 " PRIxn "'", val); break;259 default: printf("'\\x%02lX'", val); break; 260 260 } 261 261 } … … 277 277 278 278 putchar('('); 279 if (n > 0) printf("%" PRI un, sc_args[0]);279 if (n > 0) printf("%" PRIdSYSARG, sc_args[0]); 280 280 for (i = 1; i < n; i++) { 281 printf(", %" PRI un, sc_args[i]);281 printf(", %" PRIdSYSARG, sc_args[i]); 282 282 } 283 283 putchar(')'); … … 489 489 { 490 490 async_serialize_start(); 491 printf("New thread, hash %p\n", (void *)hash);491 printf("New thread, hash 0x%lx\n", hash); 492 492 async_serialize_end(); 493 493 … … 510 510 } 511 511 512 printf("Start tracing thread [%u] (hash %p).\n", 513 thread_id, (void *) thread_hash); 512 printf("Start tracing thread [%d] (hash %p).\n", thread_id, thread_hash); 514 513 515 514 while (!abort_trace) { … … 517 516 fibril_mutex_lock(&state_lock); 518 517 if (paused) { 519 printf("Thread [% u] paused. Press R to resume.\n",518 printf("Thread [%d] paused. Press R to resume.\n", 520 519 thread_id); 521 520 … … 523 522 fibril_condvar_wait(&state_cv, &state_lock); 524 523 525 printf("Thread [% u] resumed.\n", thread_id);524 printf("Thread [%d] resumed.\n", thread_id); 526 525 } 527 526 fibril_mutex_unlock(&state_lock); … … 555 554 break; 556 555 case UDEBUG_EVENT_THREAD_E: 557 printf("Thread % " PRIun "exited.\n", val0);556 printf("Thread %p exited.\n", val0); 558 557 fibril_mutex_lock(&state_lock); 559 558 abort_trace = true; … … 586 585 } 587 586 588 static loader_t *preload_task(const char *path, char * *argv,587 static loader_t *preload_task(const char *path, char *const argv[], 589 588 task_id_t *task_id) 590 589 { … … 592 591 int rc; 593 592 594 /* Spawn a program loader */ 593 /* Spawn a program loader */ 595 594 ldr = loader_connect(); 596 595 if (ldr == NULL) … … 608 607 609 608 /* Send arguments */ 610 rc = loader_set_args(ldr, (const char **)argv);609 rc = loader_set_args(ldr, argv); 611 610 if (rc != EOK) 612 611 goto error; … … 871 870 } 872 871 873 static display_mask_t parse_display_mask(c onst char *text)872 static display_mask_t parse_display_mask(char *text) 874 873 { 875 874 display_mask_t dm; 876 const char *c = text; 877 875 char *c; 876 877 c = text; 878 878 879 while (*c) { 879 880 switch (*c) { 880 case 't': 881 dm = dm | DM_THREAD; 882 break; 883 case 's': 884 dm = dm | DM_SYSCALL; 885 break; 886 case 'i': 887 dm = dm | DM_IPC; 888 break; 889 case 'p': 890 dm = dm | DM_SYSTEM | DM_USER; 891 break; 881 case 't': dm = dm | DM_THREAD; break; 882 case 's': dm = dm | DM_SYSCALL; break; 883 case 'i': dm = dm | DM_IPC; break; 884 case 'p': dm = dm | DM_SYSTEM | DM_USER; break; 892 885 default: 893 886 printf("Unexpected event type '%c'.\n", *c); 894 887 exit(1); 895 888 } 896 889 897 890 ++c; 898 891 } 899 892 900 893 return dm; 901 894 } … … 903 896 static int parse_args(int argc, char *argv[]) 904 897 { 898 char *arg; 905 899 char *err_p; 906 900 907 901 task_id = 0; 908 902 909 --argc; 910 ++argv; 903 --argc; ++argv; 911 904 912 905 while (argc > 0) { 913 char *arg = *argv;906 arg = *argv; 914 907 if (arg[0] == '+') { 915 908 display_mask = parse_display_mask(&arg[1]); … … 917 910 if (arg[1] == 't') { 918 911 /* Trace an already running task */ 919 --argc; 920 ++argv; 912 --argc; ++argv; 921 913 task_id = strtol(*argv, &err_p, 10); 922 914 task_ldr = NULL; … … 928 920 } 929 921 } else { 930 printf("Uknown option '% c'\n", arg[0]);922 printf("Uknown option '%s'\n", arg[0]); 931 923 print_syntax(); 932 924 return -1; … … 935 927 break; 936 928 } 937 938 --argc; 939 ++argv; 929 930 --argc; ++argv; 940 931 } 941 932 942 933 if (task_id != 0) { 943 if (argc == 0) 944 return 0; 934 if (argc == 0) return 0; 945 935 printf("Extra arguments\n"); 946 936 print_syntax(); … … 956 946 /* Preload the specified program file. */ 957 947 printf("Spawning '%s' with arguments:\n", *argv); 958 959 char **cp = argv; 960 while (*cp) 961 printf("'%s'\n", *cp++); 962 948 { 949 char **cp = argv; 950 while (*cp) printf("'%s'\n", *cp++); 951 } 963 952 task_ldr = preload_task(*argv, argv, &task_id); 964 953 task_wait_for = true; … … 985 974 rc = connect_task(task_id); 986 975 if (rc < 0) { 987 printf("Failed connecting to task %" PRI u64".\n", task_id);976 printf("Failed connecting to task %" PRIdTASKID ".\n", task_id); 988 977 return 1; 989 978 } 990 979 991 printf("Connected to task %" PRI u64".\n", task_id);980 printf("Connected to task %" PRIdTASKID ".\n", task_id); 992 981 993 982 if (task_ldr != NULL)
Note:
See TracChangeset
for help on using the changeset viewer.