Rev 2904 | Rev 3108 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2904 | Rev 2946 | ||
---|---|---|---|
Line 66... | Line 66... | ||
66 | 66 | ||
67 | void thread_trace_start(unsigned thread_hash); |
67 | void thread_trace_start(unsigned thread_hash); |
68 | 68 | ||
69 | static proto_t *proto_console; |
69 | static proto_t *proto_console; |
70 | 70 | ||
71 | int task_connect(int taskid) |
71 | static int task_connect(int taskid) |
72 | { |
72 | { |
73 | int rc; |
73 | int rc; |
74 | 74 | ||
75 | printf("ipc_connect_task(%d)... ", taskid); |
75 | printf("ipc_connect_task(%d)... ", taskid); |
76 | rc = ipc_connect_kbox(taskid); |
76 | rc = ipc_connect_kbox(taskid); |
Line 89... | Line 89... | ||
89 | if (rc < 0) return rc; |
89 | if (rc < 0) return rc; |
90 | 90 | ||
91 | return 0; |
91 | return 0; |
92 | } |
92 | } |
93 | 93 | ||
94 | int get_thread_list(void) |
94 | static int get_thread_list(void) |
95 | { |
95 | { |
96 | int rc; |
96 | int rc; |
97 | int tb_copied; |
97 | size_t tb_copied; |
98 | int tb_needed; |
98 | size_t tb_needed; |
99 | int i; |
99 | int i; |
100 | 100 | ||
101 | - | ||
102 | printf("send IPC_M_DEBUG_THREAD_READ message\n"); |
101 | printf("send IPC_M_DEBUG_THREAD_READ message\n"); |
103 | rc = udebug_thread_read(phoneid, (unsigned)thread_hash_buf, |
102 | rc = udebug_thread_read(phoneid, thread_hash_buf, |
104 | THBUF_SIZE*sizeof(unsigned), &tb_copied, &tb_needed); |
103 | THBUF_SIZE*sizeof(unsigned), &tb_copied, &tb_needed); |
105 | printf("-> %d\n", rc); |
104 | printf("-> %d\n", rc); |
106 | if (rc < 0) return rc; |
105 | if (rc < 0) return rc; |
107 | 106 | ||
108 | n_threads = tb_copied / sizeof(unsigned); |
107 | n_threads = tb_copied / sizeof(unsigned); |
Line 114... | Line 113... | ||
114 | printf("\ntotal of %u threads\n", tb_needed/sizeof(unsigned)); |
113 | printf("\ntotal of %u threads\n", tb_needed/sizeof(unsigned)); |
115 | 114 | ||
116 | return 0; |
115 | return 0; |
117 | } |
116 | } |
118 | 117 | ||
119 | void print_sc_retval(int retval, rv_type_t rv_type) |
118 | static void print_sc_retval(int retval, rv_type_t rv_type) |
120 | { |
119 | { |
121 | printf (" -> "); |
120 | printf (" -> "); |
122 | if (rv_type == RV_INTEGER) { |
121 | if (rv_type == RV_INTEGER) { |
123 | printf("%d", retval); |
122 | printf("%d", retval); |
124 | } else if (rv_type == RV_HASH) { |
123 | } else if (rv_type == RV_HASH) { |
Line 141... | Line 140... | ||
141 | } |
140 | } |
142 | } |
141 | } |
143 | putchar('\n'); |
142 | putchar('\n'); |
144 | } |
143 | } |
145 | 144 | ||
146 | void print_sc_args(unsigned *sc_args, int n) |
145 | static void print_sc_args(unsigned *sc_args, int n) |
147 | { |
146 | { |
148 | int i; |
147 | int i; |
149 | 148 | ||
150 | putchar('('); |
149 | putchar('('); |
151 | if (n > 0) printf("%d", sc_args[0]); |
150 | if (n > 0) printf("%d", sc_args[0]); |
Line 153... | Line 152... | ||
153 | printf(", %d", sc_args[i]); |
152 | printf(", %d", sc_args[i]); |
154 | } |
153 | } |
155 | putchar(')'); |
154 | putchar(')'); |
156 | } |
155 | } |
157 | 156 | ||
158 | void sc_ipc_call_async_fast(unsigned *sc_args, int sc_rc) |
157 | static void sc_ipc_call_async_fast(unsigned *sc_args, int sc_rc) |
159 | { |
158 | { |
160 | ipc_call_t call; |
159 | ipc_call_t call; |
161 | int phoneid; |
160 | int phoneid; |
162 | 161 | ||
163 | if (sc_rc == IPC_CALLRET_FATAL || sc_rc == IPC_CALLRET_TEMPORARY) |
162 | if (sc_rc == IPC_CALLRET_FATAL || sc_rc == IPC_CALLRET_TEMPORARY) |
Line 173... | Line 172... | ||
173 | IPC_SET_ARG5(call, 0); |
172 | IPC_SET_ARG5(call, 0); |
174 | 173 | ||
175 | ipcp_call_out(phoneid, &call, sc_rc); |
174 | ipcp_call_out(phoneid, &call, sc_rc); |
176 | } |
175 | } |
177 | 176 | ||
178 | void sc_ipc_call_async_slow(unsigned *sc_args, int sc_rc) |
177 | static void sc_ipc_call_async_slow(unsigned *sc_args, int sc_rc) |
179 | { |
178 | { |
180 | ipc_call_t call; |
179 | ipc_call_t call; |
181 | int rc; |
180 | int rc; |
182 | 181 | ||
183 | if (sc_rc == IPC_CALLRET_FATAL || sc_rc == IPC_CALLRET_TEMPORARY) |
182 | if (sc_rc == IPC_CALLRET_FATAL || sc_rc == IPC_CALLRET_TEMPORARY) |
Line 189... | Line 188... | ||
189 | if (rc >= 0) { |
188 | if (rc >= 0) { |
190 | ipcp_call_out(sc_args[0], &call, sc_rc); |
189 | ipcp_call_out(sc_args[0], &call, sc_rc); |
191 | } |
190 | } |
192 | } |
191 | } |
193 | 192 | ||
194 | void sc_ipc_call_sync_fast(unsigned *sc_args) |
193 | static void sc_ipc_call_sync_fast(unsigned *sc_args) |
195 | { |
194 | { |
196 | ipc_call_t question, reply; |
195 | ipc_call_t question, reply; |
197 | int rc; |
196 | int rc; |
198 | int phoneidx; |
197 | int phoneidx; |
199 | 198 | ||
Line 217... | Line 216... | ||
217 | 216 | ||
218 | // printf("call ipc_call_sync\n"); |
217 | // printf("call ipc_call_sync\n"); |
219 | ipcp_call_sync(phoneidx, &question, &reply); |
218 | ipcp_call_sync(phoneidx, &question, &reply); |
220 | } |
219 | } |
221 | 220 | ||
222 | void sc_ipc_call_sync_slow(unsigned *sc_args) |
221 | static void sc_ipc_call_sync_slow(unsigned *sc_args) |
223 | { |
222 | { |
224 | ipc_call_t question, reply; |
223 | ipc_call_t question, reply; |
225 | int rc; |
224 | int rc; |
226 | 225 | ||
227 | memset(&question, 0, sizeof(question)); |
226 | memset(&question, 0, sizeof(question)); |
Line 235... | Line 234... | ||
235 | if (rc < 0) return; |
234 | if (rc < 0) return; |
236 | 235 | ||
237 | ipcp_call_sync(sc_args[0], &question, &reply); |
236 | ipcp_call_sync(sc_args[0], &question, &reply); |
238 | } |
237 | } |
239 | 238 | ||
240 | void sc_ipc_wait(unsigned *sc_args, int sc_rc) |
239 | static void sc_ipc_wait(unsigned *sc_args, int sc_rc) |
241 | { |
240 | { |
242 | ipc_call_t call; |
241 | ipc_call_t call; |
243 | int rc; |
242 | int rc; |
244 | 243 | ||
245 | if (sc_rc == 0) return 0; |
244 | if (sc_rc == 0) return; |
246 | 245 | ||
247 | memset(&call, 0, sizeof(call)); |
246 | memset(&call, 0, sizeof(call)); |
248 | rc = udebug_mem_read(phoneid, &call, sc_args[0], sizeof(call)); |
247 | rc = udebug_mem_read(phoneid, &call, sc_args[0], sizeof(call)); |
249 | // printf("udebug_mem_read(phone %d, dest %d, app-mem src %d, size %d -> %d\n", |
248 | // printf("udebug_mem_read(phone %d, dest %d, app-mem src %d, size %d -> %d\n", |
250 | // phoneid, (int)&call, sc_args[0], sizeof(call), rc); |
249 | // phoneid, (int)&call, sc_args[0], sizeof(call), rc); |
Line 252... | Line 251... | ||
252 | if (rc >= 0) { |
251 | if (rc >= 0) { |
253 | ipcp_call_in(&call, sc_rc); |
252 | ipcp_call_in(&call, sc_rc); |
254 | } |
253 | } |
255 | } |
254 | } |
256 | 255 | ||
257 | void event_syscall_b(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
256 | static void event_syscall_b(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
258 | { |
257 | { |
259 | unsigned sc_args[6]; |
258 | unsigned sc_args[6]; |
260 | int rv_type; |
- | |
261 | int rc; |
259 | int rc; |
262 | 260 | ||
263 | /* Read syscall arguments */ |
261 | /* Read syscall arguments */ |
264 | rc = udebug_args_read(phoneid, thread_hash, sc_args); |
262 | rc = udebug_args_read(phoneid, thread_hash, sc_args); |
265 | 263 | ||
Line 278... | Line 276... | ||
278 | print_sc_args(sc_args, syscall_desc[sc_id].n_args); |
276 | print_sc_args(sc_args, syscall_desc[sc_id].n_args); |
279 | 277 | ||
280 | async_serialize_end(); |
278 | async_serialize_end(); |
281 | } |
279 | } |
282 | 280 | ||
283 | void event_syscall_e(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
281 | static void event_syscall_e(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
284 | { |
282 | { |
285 | unsigned sc_args[6]; |
283 | unsigned sc_args[6]; |
286 | int rv_type; |
284 | int rv_type; |
287 | int rc; |
285 | int rc; |
288 | 286 | ||
Line 323... | Line 321... | ||
323 | } |
321 | } |
324 | 322 | ||
325 | async_serialize_end(); |
323 | async_serialize_end(); |
326 | } |
324 | } |
327 | 325 | ||
328 | void event_thread_b(unsigned hash) |
326 | static void event_thread_b(unsigned hash) |
329 | { |
327 | { |
330 | async_serialize_start(); |
328 | async_serialize_start(); |
331 | printf("new thread, hash 0x%x\n", hash); |
329 | printf("new thread, hash 0x%x\n", hash); |
332 | async_serialize_end(); |
330 | async_serialize_end(); |
333 | 331 | ||
334 | thread_trace_start(hash); |
332 | thread_trace_start(hash); |
335 | } |
333 | } |
336 | 334 | ||
337 | void trace_loop(void *thread_hash_arg) |
335 | static int trace_loop(void *thread_hash_arg) |
338 | { |
336 | { |
339 | int rc; |
337 | int rc; |
340 | unsigned ev_type; |
338 | unsigned ev_type; |
341 | unsigned thread_hash; |
339 | unsigned thread_hash; |
342 | unsigned thread_id; |
340 | unsigned thread_id; |
Line 391... | Line 389... | ||
391 | } |
389 | } |
392 | 390 | ||
393 | } |
391 | } |
394 | 392 | ||
395 | printf("trace_loop(%d) exiting\n", thread_id); |
393 | printf("trace_loop(%d) exiting\n", thread_id); |
- | 394 | return 0; |
|
396 | } |
395 | } |
397 | 396 | ||
398 | void thread_trace_start(unsigned thread_hash) |
397 | void thread_trace_start(unsigned thread_hash) |
399 | { |
398 | { |
400 | fid_t fid; |
399 | fid_t fid; |
Line 406... | Line 405... | ||
406 | printf("Warning: Failed creating fibril\n"); |
405 | printf("Warning: Failed creating fibril\n"); |
407 | } |
406 | } |
408 | fibril_add_ready(fid); |
407 | fibril_add_ready(fid); |
409 | } |
408 | } |
410 | 409 | ||
411 | void trace_active_task(void) |
410 | static void trace_active_task(void) |
412 | { |
411 | { |
413 | int taskid; |
412 | int taskid; |
414 | int i; |
413 | int i; |
415 | int rc; |
414 | int rc; |
416 | int c; |
415 | int c; |