Rev 3617 | Rev 3870 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3617 | Rev 3683 | ||
---|---|---|---|
Line 70... | Line 70... | ||
70 | 70 | ||
71 | ut->go_call = NULL; |
71 | ut->go_call = NULL; |
72 | ut->uspace_state = NULL; |
72 | ut->uspace_state = NULL; |
73 | ut->go = false; |
73 | ut->go = false; |
74 | ut->stoppable = true; |
74 | ut->stoppable = true; |
75 | ut->debug_active = false; |
75 | ut->active = false; |
76 | ut->cur_event = 0; /* none */ |
76 | ut->cur_event = 0; /* none */ |
77 | } |
77 | } |
78 | 78 | ||
79 | /** Wait for a GO message. |
79 | /** Wait for a GO message. |
80 | * |
80 | * |
Line 110... | Line 110... | ||
110 | static bool udebug_thread_precheck(void) |
110 | static bool udebug_thread_precheck(void) |
111 | { |
111 | { |
112 | bool res; |
112 | bool res; |
113 | 113 | ||
114 | mutex_lock(&THREAD->udebug.lock); |
114 | mutex_lock(&THREAD->udebug.lock); |
115 | res = THREAD->udebug.debug_active; |
115 | res = THREAD->udebug.active; |
116 | mutex_unlock(&THREAD->udebug.lock); |
116 | mutex_unlock(&THREAD->udebug.lock); |
117 | 117 | ||
118 | return res; |
118 | return res; |
119 | } |
119 | } |
120 | 120 | ||
Line 168... | Line 168... | ||
168 | } else if (TASK->udebug.dt_state == UDEBUG_TS_ACTIVE) { |
168 | } else if (TASK->udebug.dt_state == UDEBUG_TS_ACTIVE) { |
169 | /* |
169 | /* |
170 | * Active debugging session |
170 | * Active debugging session |
171 | */ |
171 | */ |
172 | 172 | ||
173 | if (THREAD->udebug.debug_active == true && |
173 | if (THREAD->udebug.active == true && |
174 | THREAD->udebug.go == false) { |
174 | THREAD->udebug.go == false) { |
175 | /* |
175 | /* |
176 | * Thread was requested to stop - answer go call |
176 | * Thread was requested to stop - answer go call |
177 | */ |
177 | */ |
178 | 178 | ||
Line 208... | Line 208... | ||
208 | 208 | ||
209 | restart: |
209 | restart: |
210 | mutex_lock(&TASK->udebug.lock); |
210 | mutex_lock(&TASK->udebug.lock); |
211 | mutex_lock(&THREAD->udebug.lock); |
211 | mutex_lock(&THREAD->udebug.lock); |
212 | 212 | ||
213 | if (THREAD->udebug.debug_active && |
- | |
214 | THREAD->udebug.go == false) { |
213 | if (THREAD->udebug.active && THREAD->udebug.go == false) { |
215 | TASK->udebug.begin_call = NULL; |
214 | TASK->udebug.begin_call = NULL; |
216 | mutex_unlock(&THREAD->udebug.lock); |
215 | mutex_unlock(&THREAD->udebug.lock); |
217 | mutex_unlock(&TASK->udebug.lock); |
216 | mutex_unlock(&TASK->udebug.lock); |
218 | 217 | ||
219 | udebug_wait_for_go(&THREAD->udebug.go_wq); |
218 | udebug_wait_for_go(&THREAD->udebug.go_wq); |
Line 262... | Line 261... | ||
262 | 261 | ||
263 | mutex_lock(&TASK->udebug.lock); |
262 | mutex_lock(&TASK->udebug.lock); |
264 | mutex_lock(&THREAD->udebug.lock); |
263 | mutex_lock(&THREAD->udebug.lock); |
265 | 264 | ||
266 | /* Must only generate events when in debugging session and is go. */ |
265 | /* Must only generate events when in debugging session and is go. */ |
267 | if (THREAD->udebug.debug_active != true || |
- | |
268 | THREAD->udebug.go == false || |
266 | if (THREAD->udebug.active != true || THREAD->udebug.go == false || |
269 | (TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) { |
267 | (TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) { |
270 | mutex_unlock(&THREAD->udebug.lock); |
268 | mutex_unlock(&THREAD->udebug.lock); |
271 | mutex_unlock(&TASK->udebug.lock); |
269 | mutex_unlock(&TASK->udebug.lock); |
272 | return; |
270 | return; |
273 | } |
271 | } |
Line 332... | Line 330... | ||
332 | 330 | ||
333 | LOG("udebug_thread_b_event\n"); |
331 | LOG("udebug_thread_b_event\n"); |
334 | LOG("- check state\n"); |
332 | LOG("- check state\n"); |
335 | 333 | ||
336 | /* Must only generate events when in debugging session */ |
334 | /* Must only generate events when in debugging session */ |
337 | if (THREAD->udebug.debug_active != true) { |
335 | if (THREAD->udebug.active != true) { |
338 | LOG("- debug_active: %s, udebug.go: %s\n", |
336 | LOG("- udebug.active: %s, udebug.go: %s\n", |
339 | THREAD->udebug.debug_active ? "yes(+)" : "no(-)", |
337 | THREAD->udebug.active ? "yes(+)" : "no(-)", |
340 | THREAD->udebug.go ? "yes(-)" : "no(+)"); |
338 | THREAD->udebug.go ? "yes(-)" : "no(+)"); |
341 | mutex_unlock(&THREAD->udebug.lock); |
339 | mutex_unlock(&THREAD->udebug.lock); |
342 | mutex_unlock(&TASK->udebug.lock); |
340 | mutex_unlock(&TASK->udebug.lock); |
343 | return; |
341 | return; |
344 | } |
342 | } |
Line 382... | Line 380... | ||
382 | 380 | ||
383 | LOG("udebug_thread_e_event\n"); |
381 | LOG("udebug_thread_e_event\n"); |
384 | LOG("- check state\n"); |
382 | LOG("- check state\n"); |
385 | 383 | ||
386 | /* Must only generate events when in debugging session. */ |
384 | /* Must only generate events when in debugging session. */ |
387 | if (THREAD->udebug.debug_active != true) { |
385 | if (THREAD->udebug.active != true) { |
388 | /* printf("- debug_active: %s, udebug.go: %s\n", |
386 | /* printf("- udebug.active: %s, udebug.go: %s\n", |
389 | THREAD->udebug.debug_active ? "yes(+)" : "no(-)", |
387 | THREAD->udebug.active ? "yes(+)" : "no(-)", |
390 | THREAD->udebug.go ? "yes(-)" : "no(+)");*/ |
388 | THREAD->udebug.go ? "yes(-)" : "no(+)");*/ |
391 | mutex_unlock(&THREAD->udebug.lock); |
389 | mutex_unlock(&THREAD->udebug.lock); |
392 | mutex_unlock(&TASK->udebug.lock); |
390 | mutex_unlock(&TASK->udebug.lock); |
393 | return; |
391 | return; |
394 | } |
392 | } |
Line 399... | Line 397... | ||
399 | THREAD->udebug.go_call = NULL; |
397 | THREAD->udebug.go_call = NULL; |
400 | IPC_SET_RETVAL(call->data, 0); |
398 | IPC_SET_RETVAL(call->data, 0); |
401 | IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E); |
399 | IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E); |
402 | 400 | ||
403 | /* Prevent any further debug activity in thread. */ |
401 | /* Prevent any further debug activity in thread. */ |
404 | THREAD->udebug.debug_active = false; |
402 | THREAD->udebug.active = false; |
405 | THREAD->udebug.cur_event = 0; /* none */ |
403 | THREAD->udebug.cur_event = 0; /* none */ |
406 | THREAD->udebug.go = false; /* set to initial value */ |
404 | THREAD->udebug.go = false; /* set to initial value */ |
407 | 405 | ||
408 | ipc_answer(&TASK->answerbox, call); |
406 | ipc_answer(&TASK->answerbox, call); |
409 | 407 | ||
Line 457... | Line 455... | ||
457 | interrupts_restore(ipl); |
455 | interrupts_restore(ipl); |
458 | 456 | ||
459 | /* Only process userspace threads. */ |
457 | /* Only process userspace threads. */ |
460 | if ((flags & THREAD_FLAG_USPACE) != 0) { |
458 | if ((flags & THREAD_FLAG_USPACE) != 0) { |
461 | /* Prevent any further debug activity in thread. */ |
459 | /* Prevent any further debug activity in thread. */ |
462 | t->udebug.debug_active = false; |
460 | t->udebug.active = false; |
463 | t->udebug.cur_event = 0; /* none */ |
461 | t->udebug.cur_event = 0; /* none */ |
464 | 462 | ||
465 | /* Is the thread still go? */ |
463 | /* Is the thread still go? */ |
466 | if (t->udebug.go == true) { |
464 | if (t->udebug.go == true) { |
467 | /* |
465 | /* |
468 | * Yes, so clear go. As debug_active == false, |
466 | * Yes, so clear go. As active == false, |
469 | * this doesn't affect anything. |
467 | * this doesn't affect anything. |
470 | */ |
468 | */ |
471 | t->udebug.go = false; |
469 | t->udebug.go = false; |
472 | 470 | ||
473 | /* Answer GO call */ |
471 | /* Answer GO call */ |