Rev 4657 | Rev 4659 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4657 | Rev 4658 | ||
---|---|---|---|
Line 81... | Line 81... | ||
81 | void thread_trace_start(uintptr_t thread_hash); |
81 | void thread_trace_start(uintptr_t thread_hash); |
82 | 82 | ||
83 | static proto_t *proto_console; |
83 | static proto_t *proto_console; |
84 | static task_id_t task_id; |
84 | static task_id_t task_id; |
85 | static loader_t *task_ldr; |
85 | static loader_t *task_ldr; |
- | 86 | static int task_wait_for; |
|
86 | 87 | ||
87 | /** Combination of events/data to print. */ |
88 | /** Combination of events/data to print. */ |
88 | display_mask_t display_mask; |
89 | display_mask_t display_mask; |
89 | 90 | ||
90 | static int program_run_fibril(void *arg); |
91 | static int program_run_fibril(void *arg); |
Line 858... | Line 859... | ||
858 | if (arg[1] == 't') { |
859 | if (arg[1] == 't') { |
859 | /* Trace an already running task */ |
860 | /* Trace an already running task */ |
860 | --argc; ++argv; |
861 | --argc; ++argv; |
861 | task_id = strtol(*argv, &err_p, 10); |
862 | task_id = strtol(*argv, &err_p, 10); |
862 | task_ldr = NULL; |
863 | task_ldr = NULL; |
- | 864 | task_wait_for = 0; |
|
863 | if (*err_p) { |
865 | if (*err_p) { |
864 | printf("Task ID syntax error\n"); |
866 | printf("Task ID syntax error\n"); |
865 | print_syntax(); |
867 | print_syntax(); |
866 | return -1; |
868 | return -1; |
867 | } |
869 | } |
Line 895... | Line 897... | ||
895 | { |
897 | { |
896 | char **cp = argv; |
898 | char **cp = argv; |
897 | while (*cp) printf("'%s'\n", *cp++); |
899 | while (*cp) printf("'%s'\n", *cp++); |
898 | } |
900 | } |
899 | task_ldr = preload_task(*argv, argv, &task_id); |
901 | task_ldr = preload_task(*argv, argv, &task_id); |
- | 902 | task_wait_for = 1; |
|
900 | 903 | ||
901 | return 0; |
904 | return 0; |
902 | } |
905 | } |
903 | 906 | ||
904 | int main(int argc, char *argv[]) |
907 | int main(int argc, char *argv[]) |
905 | { |
908 | { |
906 | int rc; |
909 | int rc; |
- | 910 | task_exit_t texit; |
|
- | 911 | int retval; |
|
907 | 912 | ||
908 | printf("System Call / IPC Tracer\n"); |
913 | printf("System Call / IPC Tracer\n"); |
909 | printf("Controls: Q - Quit, P - Pause, R - Resume\n"); |
914 | printf("Controls: Q - Quit, P - Pause, R - Resume\n"); |
910 | 915 | ||
911 | display_mask = DM_THREAD | DM_SYSTEM | DM_USER; |
916 | display_mask = DM_THREAD | DM_SYSTEM | DM_USER; |
Line 921... | Line 926... | ||
921 | return 1; |
926 | return 1; |
922 | } |
927 | } |
923 | 928 | ||
924 | printf("Connected to task %lld.\n", task_id); |
929 | printf("Connected to task %lld.\n", task_id); |
925 | 930 | ||
926 | if (task_ldr != NULL) { |
931 | if (task_ldr != NULL) |
927 | program_run(); |
932 | program_run(); |
928 | } |
- | |
929 | 933 | ||
930 | cev_fibril_start(); |
934 | cev_fibril_start(); |
931 | trace_task(task_id); |
935 | trace_task(task_id); |
932 | 936 | ||
- | 937 | if (task_wait_for) { |
|
- | 938 | printf("Waiting for task to exit.\n"); |
|
- | 939 | ||
- | 940 | rc = task_wait(task_id, &texit, &retval); |
|
- | 941 | if (rc != EOK) { |
|
- | 942 | printf("Failed waiting for task.\n"); |
|
- | 943 | return -1; |
|
- | 944 | } |
|
- | 945 | ||
- | 946 | if (texit == TASK_EXIT_NORMAL) { |
|
- | 947 | printf("Task exited normally, return value %d.\n", |
|
- | 948 | retval); |
|
- | 949 | } else { |
|
- | 950 | printf("Task exited unexpectedly.\n"); |
|
- | 951 | } |
|
- | 952 | } |
|
- | 953 | ||
933 | return 0; |
954 | return 0; |
934 | } |
955 | } |
935 | 956 | ||
936 | /** @} |
957 | /** @} |
937 | */ |
958 | */ |