Rev 2901 | Rev 2903 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2901 | Rev 2902 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | { |
45 | { |
46 | int nsc; |
46 | int nsc; |
47 | call_t *db_call, *go_call; |
47 | call_t *db_call, *go_call; |
48 | ipl_t ipl; |
48 | ipl_t ipl; |
49 | 49 | ||
- | 50 | ASSERT(THREAD); |
|
- | 51 | ASSERT(TASK); |
|
- | 52 | ||
50 | ipl = interrupts_disable(); |
53 | ipl = interrupts_disable(); |
51 | spinlock_lock(&TASK->lock); |
54 | spinlock_lock(&TASK->lock); |
52 | 55 | ||
53 | nsc = --TASK->not_stoppable_count; |
56 | nsc = --TASK->not_stoppable_count; |
54 | db_call = TASK->debug_begin_call; |
- | |
55 | 57 | ||
56 | if (TASK->dt_state == UDEBUG_TS_BEGINNING) { |
58 | if (TASK->dt_state == UDEBUG_TS_BEGINNING) { |
57 | klog_printf("udebug_stoppable_begin"); |
59 | klog_printf("udebug_stoppable_begin"); |
58 | klog_printf(" - nsc := %d", nsc); |
60 | klog_printf(" - nsc := %d", nsc); |
59 | } |
61 | } |
Line 62... | Line 64... | ||
62 | /* |
64 | /* |
63 | * This was the last non-stoppable thread. Reply to |
65 | * This was the last non-stoppable thread. Reply to |
64 | * DEBUG_BEGIN call. |
66 | * DEBUG_BEGIN call. |
65 | */ |
67 | */ |
66 | 68 | ||
- | 69 | db_call = TASK->debug_begin_call; |
|
- | 70 | ASSERT(db_call); |
|
- | 71 | ||
67 | /* Lock order OK, THREAD->debug_lock is after TASK->lock */ |
72 | /* Lock order OK, THREAD->debug_lock is after TASK->lock */ |
68 | spinlock_lock(&THREAD->debug_lock); |
73 | spinlock_lock(&THREAD->debug_lock); |
69 | THREAD->debug_stoppable = true; |
74 | THREAD->debug_stoppable = true; |
70 | spinlock_unlock(&THREAD->debug_lock); |
75 | spinlock_unlock(&THREAD->debug_lock); |
71 | 76 | ||
Line 85... | Line 90... | ||
85 | 90 | ||
86 | /* Lock order OK, THREAD->debug_lock is after TASK->lock */ |
91 | /* Lock order OK, THREAD->debug_lock is after TASK->lock */ |
87 | spinlock_lock(&THREAD->debug_lock); |
92 | spinlock_lock(&THREAD->debug_lock); |
88 | THREAD->debug_stoppable = true; |
93 | THREAD->debug_stoppable = true; |
89 | 94 | ||
90 | if (THREAD->debug_stop) { |
95 | if (THREAD->debug_active && THREAD->debug_stop) { |
91 | /* |
96 | /* |
92 | * Thread was requested to stop - answer go call |
97 | * Thread was requested to stop - answer go call |
93 | */ |
98 | */ |
94 | 99 | ||
95 | /* Make sure nobody takes this call away from us */ |
100 | /* Make sure nobody takes this call away from us */ |
96 | go_call = THREAD->debug_go_call; |
101 | go_call = THREAD->debug_go_call; |
97 | THREAD->debug_go_call = NULL; |
102 | THREAD->debug_go_call = NULL; |
- | 103 | ASSERT(go_call); |
|
98 | 104 | ||
99 | IPC_SET_RETVAL(go_call->data, 0); |
105 | IPC_SET_RETVAL(go_call->data, 0); |
100 | IPC_SET_ARG1(go_call->data, UDEBUG_EVENT_STOP); |
106 | IPC_SET_ARG1(go_call->data, UDEBUG_EVENT_STOP); |
101 | 107 | ||
102 | THREAD->cur_event = UDEBUG_EVENT_STOP; |
108 | THREAD->cur_event = UDEBUG_EVENT_STOP; |
Line 143... | Line 149... | ||
143 | if (TASK->dt_state == UDEBUG_TS_ACTIVE) { |
149 | if (TASK->dt_state == UDEBUG_TS_ACTIVE) { |
144 | klog_printf("udebug_stoppable_end"); |
150 | klog_printf("udebug_stoppable_end"); |
145 | klog_printf("debug_stop=%d", THREAD->debug_stop); |
151 | klog_printf("debug_stop=%d", THREAD->debug_stop); |
146 | } |
152 | } |
147 | 153 | ||
148 | if ((TASK->dt_state == UDEBUG_TS_BEGINNING || |
- | |
149 | TASK->dt_state == UDEBUG_TS_ACTIVE) && |
154 | if (THREAD->debug_active && |
150 | THREAD->debug_stop == true) { |
155 | THREAD->debug_stop == true) { |
151 | TASK->debug_begin_call = NULL; |
156 | TASK->debug_begin_call = NULL; |
152 | spinlock_unlock(&THREAD->debug_lock); |
157 | spinlock_unlock(&THREAD->debug_lock); |
153 | spinlock_unlock(&TASK->lock); |
158 | spinlock_unlock(&TASK->lock); |
154 | interrupts_restore(ipl); |
159 | interrupts_restore(ipl); |