Rev 2809 | Rev 2850 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2809 | Rev 2812 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include <stdio.h> |
1 | #include <stdio.h> |
2 | #include <unistd.h> |
2 | #include <unistd.h> |
3 | #include <syscall.h> |
3 | #include <syscall.h> |
4 | #include <ipc/ipc.h> |
4 | #include <ipc/ipc.h> |
- | 5 | #include <udebug.h> |
|
5 | #include "../tester.h" |
6 | #include "../tester.h" |
6 | 7 | ||
7 | const char *syscall_name[] = { |
8 | const char *syscall_name[] = { |
8 | "sys_io", |
9 | "sys_io", |
9 | "sys_tls_set", |
10 | "sys_tls_set", |
Line 61... | Line 62... | ||
61 | rc = ipc_connect_kbox(taskid); |
62 | rc = ipc_connect_kbox(taskid); |
62 | printf("-> %d\n", rc); |
63 | printf("-> %d\n", rc); |
63 | phoneid = rc; |
64 | phoneid = rc; |
64 | 65 | ||
65 | printf("send IPC_M_DEBUG_BEGIN message\n"); |
66 | printf("send IPC_M_DEBUG_BEGIN message\n"); |
66 | rc = ipc_call_sync_0_0(phoneid, IPC_M_DEBUG_BEGIN); |
67 | rc = ipc_call_sync_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_BEGIN); |
67 | printf("-> %d\n", rc); |
68 | printf("-> %d\n", rc); |
68 | 69 | ||
69 | printf("send IPC_M_DEBUG_THREAD_READ message\n"); |
70 | printf("send IPC_M_DEBUG_THREAD_READ message\n"); |
70 | rc = ipc_call_sync_2_2(phoneid, IPC_M_DEBUG_THREAD_READ, |
71 | rc = ipc_call_sync_3_2(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_THREAD_READ, |
71 | &threadid_buf, TIDBUF_SIZE*sizeof(unsigned), |
72 | (sysarg_t)threadid_buf, TIDBUF_SIZE*sizeof(unsigned), |
72 | &tb_copied, &tb_needed); |
73 | &tb_copied, &tb_needed); |
73 | printf("-> %d\n", rc); |
74 | printf("-> %d\n", rc); |
74 | 75 | ||
75 | printf("thread IDs:"); |
76 | printf("thread IDs:"); |
76 | for (i=0; i<tb_copied / sizeof(unsigned); i++) { |
77 | for (i=0; i<tb_copied / sizeof(unsigned); i++) { |
77 | printf(" %u", threadid_buf[i]); |
78 | printf(" %u", threadid_buf[i]); |
78 | } |
79 | } |
79 | printf("\ntotal of %u threads\n", tb_needed/sizeof(unsigned)); |
80 | printf("\ntotal of %u threads\n", tb_needed/sizeof(unsigned)); |
80 | 81 | ||
81 | while (1) { |
82 | while (1) { |
82 | rc = ipc_call_sync_1_3(phoneid, IPC_M_DEBUG_GO, threadid_buf[0], |
83 | rc = ipc_call_sync_2_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_GO, |
83 | &ev_type, &sc_id, &sc_rc); |
84 | threadid_buf[0], &ev_type, &sc_id, &sc_rc); |
84 | if (rc >= 0) { |
85 | if (rc >= 0) { |
85 | rc = ipc_call_sync_3_1(phoneid, IPC_M_DEBUG_ARGS_READ, |
86 | rc = ipc_call_sync_4_1(phoneid, IPC_M_DEBUG_ALL, |
- | 87 | UDEBUG_M_ARGS_READ, threadid_buf[0], sc_args, |
|
86 | threadid_buf[0], sc_args, 6 * sizeof(unsigned), &copied); |
88 | 6 * sizeof(unsigned), &copied); |
87 | } |
89 | } |
88 | if (rc >= 0) { |
90 | if (rc >= 0) { |
89 | printf("%s[%d](%u, %u, %u, %u, %u, %u) -> %d\n", |
91 | printf("%s[%d](%u, %u, %u, %u, %u, %u) -> %d\n", |
90 | syscall_name[sc_id], sc_id, |
92 | syscall_name[sc_id], sc_id, |
91 | sc_args[0], sc_args[1], sc_args[2], |
93 | sc_args[0], sc_args[1], sc_args[2], |
Line 95... | Line 97... | ||
95 | if (sc_id == SYS_IPC_CALL_ASYNC_SLOW) { |
97 | if (sc_id == SYS_IPC_CALL_ASYNC_SLOW) { |
96 | memset(ipc_args, 0, sizeof(ipc_args)); |
98 | memset(ipc_args, 0, sizeof(ipc_args)); |
97 | printf("read async call args..\n"); |
99 | printf("read async call args..\n"); |
98 | printf("dest=%u, ptr=%u, len=%u\n", |
100 | printf("dest=%u, ptr=%u, len=%u\n", |
99 | (sysarg_t)ipc_args, sc_args[1], sizeof(ipc_args)); |
101 | (sysarg_t)ipc_args, sc_args[1], sizeof(ipc_args)); |
100 | rc = ipc_call_sync_3_0(phoneid, IPC_M_DEBUG_MEM_READ, |
102 | rc = ipc_call_sync_4_0(phoneid, IPC_M_DEBUG_ALL, |
- | 103 | UDEBUG_M_MEM_READ, (sysarg_t)ipc_args, |
|
101 | (sysarg_t)ipc_args, sc_args[1], sizeof(ipc_args)); |
104 | sc_args[1], sizeof(ipc_args)); |
102 | printf("-> %d\n", rc); |
105 | printf("-> %d\n", rc); |
103 | printf("args: (%u, %u, %u, %u, %u, %u)\n", |
106 | printf("args: (%u, %u, %u, %u, %u, %u)\n", |
104 | ipc_args[0], ipc_args[1], ipc_args[2], |
107 | ipc_args[0], ipc_args[1], ipc_args[2], |
105 | ipc_args[3], ipc_args[4], ipc_args[5]); |
108 | ipc_args[3], ipc_args[4], ipc_args[5]); |
106 | } |
109 | } |