Rev 2924 | Rev 2936 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2924 | Rev 2935 | ||
---|---|---|---|
Line 43... | Line 43... | ||
43 | #include <async.h> |
43 | #include <async.h> |
44 | #include <string.h> |
44 | #include <string.h> |
45 | 45 | ||
46 | #include "cmd.h" |
46 | #include "cmd.h" |
47 | #include "include/arch.h" |
47 | #include "include/arch.h" |
- | 48 | #include "fib_synch.h" |
|
48 | #include "main.h" |
49 | #include "main.h" |
49 | 50 | ||
50 | void thread_debug_start(unsigned thread_hash); |
51 | void thread_debug_start(unsigned thread_hash); |
51 | 52 | ||
52 | #define INBUF_SIZE 64 |
53 | #define INBUF_SIZE 64 |
Line 69... | Line 70... | ||
69 | volatile int paused; |
70 | volatile int paused; |
70 | 71 | ||
71 | breakpoint_t brk_list[MAX_BRKPTS]; |
72 | breakpoint_t brk_list[MAX_BRKPTS]; |
72 | int lifted_brkpt; |
73 | int lifted_brkpt; |
73 | 74 | ||
- | 75 | fcv_t go_cv; |
|
- | 76 | ||
74 | void read_line(char *buffer, int n) |
77 | void read_line(char *buffer, int n) |
75 | { |
78 | { |
76 | char c; |
79 | char c; |
77 | int i; |
80 | int i; |
78 | 81 | ||
Line 159... | Line 162... | ||
159 | } |
162 | } |
160 | 163 | ||
161 | (*cmd_table[idx_found].proc)(cmd_argc, cmd_argv); |
164 | (*cmd_table[idx_found].proc)(cmd_argc, cmd_argv); |
162 | } |
165 | } |
163 | 166 | ||
- | 167 | /* |
|
- | 168 | * Called by a fibril (from arch code) when a breakpoint is hit. |
|
- | 169 | */ |
|
- | 170 | void breakpoint_hit(void) |
|
- | 171 | { |
|
- | 172 | fcv_wait(&go_cv); |
|
- | 173 | } |
|
164 | 174 | ||
165 | int task_connect(int taskid) |
175 | int task_connect(int taskid) |
166 | { |
176 | { |
167 | int rc; |
177 | int rc; |
168 | unsigned evmask; |
178 | unsigned evmask; |
Line 267... | Line 277... | ||
267 | 277 | ||
268 | printf("debug_loop(%d)\n", thread_id); |
278 | printf("debug_loop(%d)\n", thread_id); |
269 | 279 | ||
270 | while (!abort_debug) { |
280 | while (!abort_debug) { |
271 | 281 | ||
272 | printf("go\n"); |
282 | printf("[t%d] go...\n", thread_id); |
273 | /* Run thread until an event occurs */ |
283 | /* Run thread until an event occurs */ |
274 | rc = udebug_go(app_phone, thread_hash, |
284 | rc = udebug_go(app_phone, thread_hash, |
275 | &ev_type, &val0, &val1); |
285 | &ev_type, &val0, &val1); |
- | 286 | printf("[t%d] stopped\n", thread_id); |
|
276 | 287 | ||
277 | if (ev_type == UDEBUG_EVENT_FINISHED) { |
288 | if (ev_type == UDEBUG_EVENT_FINISHED) { |
278 | printf("thread %u debugging finished\n", thread_id); |
289 | printf("thread %u debugging finished\n", thread_id); |
279 | break; |
290 | break; |
280 | } |
291 | } |
281 | - | ||
282 | if (rc >= 0) debug_event(thread_hash, ev_type, val0); |
292 | if (rc >= 0) debug_event(thread_hash, ev_type, val0); |
283 | } |
293 | } |
284 | 294 | ||
285 | printf("debug_loop(%d) exiting\n", thread_id); |
295 | printf("debug_loop(%d) exiting\n", thread_id); |
286 | } |
296 | } |
Line 308... | Line 318... | ||
308 | printf("Breakpoint Debugger\n"); |
318 | printf("Breakpoint Debugger\n"); |
309 | printf("Press 'c' to connect\n"); |
319 | printf("Press 'c' to connect\n"); |
310 | while ((i = getchar()) != 'c') |
320 | while ((i = getchar()) != 'c') |
311 | putchar(i); |
321 | putchar(i); |
312 | 322 | ||
313 | taskid = 13; |
323 | taskid = 14; |
314 | rc = task_connect(taskid); |
324 | rc = task_connect(taskid); |
315 | if (rc < 0) { |
325 | if (rc < 0) { |
316 | printf("Failed to connect to task %d\n", taskid); |
326 | printf("Failed to connect to task %d\n", taskid); |
317 | return; |
327 | return; |
318 | } |
328 | } |
Line 351... | Line 361... | ||
351 | 361 | ||
352 | static void main_init(void) |
362 | static void main_init(void) |
353 | { |
363 | { |
354 | next_thread_id = 1; |
364 | next_thread_id = 1; |
355 | paused = 0; |
365 | paused = 0; |
- | 366 | ||
- | 367 | fcv_init(&go_cv); |
|
356 | } |
368 | } |
357 | 369 | ||
358 | int main(void) |
370 | int main(void) |
359 | { |
371 | { |
360 | main_init(); |
372 | main_init(); |