Subversion Repositories HelenOS

Rev

Rev 2894 | Rev 2899 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2894 Rev 2898
1
/*
1
/*
2
 * Copyright (c) 2008 Jiri Svoboda
2
 * Copyright (c) 2008 Jiri Svoboda
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @addtogroup generic
29
/** @addtogroup generic
30
 * @{
30
 * @{
31
 */
31
 */
32
 
32
 
33
/**
33
/**
34
 * @file
34
 * @file
35
 * @brief   Udebug.
35
 * @brief   Udebug.
36
 */
36
 */
37
 
37
 
38
#include <synch/waitq.h>
38
#include <synch/waitq.h>
39
#include <console/klog.h>
39
#include <console/klog.h>
40
#include <udebug/udebug.h>
40
#include <udebug/udebug.h>
41
#include <errno.h>
41
#include <errno.h>
42
#include <arch.h>
42
#include <arch.h>
43
 
43
 
44
void udebug_stoppable_begin(void)
44
void udebug_stoppable_begin(void)
45
{
45
{
46
    int nsc;
46
    int nsc;
47
    call_t *db_call;
47
    call_t *db_call, *go_call;
48
    ipl_t ipl;
48
    ipl_t ipl;
49
 
49
 
50
    ipl = interrupts_disable();
50
    ipl = interrupts_disable();
51
    spinlock_lock(&TASK->lock);
51
    spinlock_lock(&TASK->lock);
52
 
52
 
53
    nsc = --TASK->not_stoppable_count;
53
    nsc = --TASK->not_stoppable_count;
54
    db_call = TASK->debug_begin_call;
54
    db_call = TASK->debug_begin_call;
55
 
55
 
56
    if (TASK->dt_state == UDEBUG_TS_BEGINNING) {
56
    if (TASK->dt_state == UDEBUG_TS_BEGINNING) {
57
        klog_printf("udebug_stoppable_begin");
57
        klog_printf("udebug_stoppable_begin");
58
        klog_printf(" - nsc := %d", nsc);
58
        klog_printf(" - nsc := %d", nsc);
59
    }
59
    }
60
 
60
 
61
    if (TASK->dt_state == UDEBUG_TS_BEGINNING && nsc == 0) {
61
    if (TASK->dt_state == UDEBUG_TS_BEGINNING && nsc == 0) {
-
 
62
        /*
-
 
63
         * This was the last non-stoppable thread. Reply to
-
 
64
         * DEBUG_BEGIN call.
-
 
65
         */
-
 
66
 
-
 
67
        /* Lock order OK, THREAD->debug_lock is after TASK->lock */
-
 
68
        spinlock_lock(&THREAD->debug_lock);
-
 
69
        THREAD->debug_stoppable = true;
-
 
70
        spinlock_unlock(&THREAD->debug_lock);
-
 
71
 
62
        TASK->dt_state = UDEBUG_TS_ACTIVE;
72
        TASK->dt_state = UDEBUG_TS_ACTIVE;
63
        TASK->debug_begin_call = NULL;
73
        TASK->debug_begin_call = NULL;
64
        spinlock_unlock(&TASK->lock);
74
        spinlock_unlock(&TASK->lock);
65
        interrupts_restore(ipl);
75
        interrupts_restore(ipl);
66
 
76
 
67
        IPC_SET_RETVAL(db_call->data, 0);
77
        IPC_SET_RETVAL(db_call->data, 0);
68
        klog_printf("udebug_stoppable_begin/ipc_answer");
78
        klog_printf("udebug_stoppable_begin/ipc_answer");
69
        ipc_answer(&TASK->answerbox, db_call);     
79
        ipc_answer(&TASK->answerbox, db_call);     
-
 
80
 
-
 
81
    } else if (TASK->dt_state == UDEBUG_TS_ACTIVE) {
-
 
82
        /*
-
 
83
         * Active debugging session
-
 
84
         */
-
 
85
 
-
 
86
        /* Lock order OK, THREAD->debug_lock is after TASK->lock */
-
 
87
        spinlock_lock(&THREAD->debug_lock);
-
 
88
        THREAD->debug_stoppable = true;
-
 
89
 
-
 
90
        if (THREAD->debug_stop) {
-
 
91
            /*
-
 
92
             * Thread was requested to stop - answer go call
-
 
93
             */
-
 
94
 
-
 
95
            /* Make sure nobody takes this call away from us */
-
 
96
            go_call = THREAD->debug_go_call;
-
 
97
            THREAD->debug_go_call = NULL;
-
 
98
 
-
 
99
            IPC_SET_RETVAL(go_call->data, 0);
-
 
100
            IPC_SET_ARG1(go_call->data, UDEBUG_EVENT_STOP);
-
 
101
 
-
 
102
            THREAD->cur_event = UDEBUG_EVENT_STOP;
-
 
103
            spinlock_unlock(&THREAD->debug_lock);
-
 
104
 
-
 
105
                ipc_answer(&TASK->answerbox, go_call);
-
 
106
 
-
 
107
                spinlock_unlock(&TASK->lock);
-
 
108
            interrupts_restore(ipl);
-
 
109
        } else {
-
 
110
            /*
-
 
111
             * No stop request - nothing happens.
-
 
112
             */
-
 
113
            spinlock_unlock(&THREAD->debug_lock);
-
 
114
                spinlock_unlock(&TASK->lock);
-
 
115
            interrupts_restore(ipl);
-
 
116
        }
70
    } else {
117
    } else {
-
 
118
        /*
-
 
119
         * All other cases - nothing special happens.
-
 
120
         */
-
 
121
 
-
 
122
        /* Lock order OK, THREAD->debug_lock is after TASK->lock */
-
 
123
        spinlock_lock(&THREAD->debug_lock);
-
 
124
        THREAD->debug_stoppable = true;
-
 
125
        spinlock_unlock(&THREAD->debug_lock);
-
 
126
 
71
            spinlock_unlock(&TASK->lock);
127
            spinlock_unlock(&TASK->lock);
72
        interrupts_restore(ipl);
128
        interrupts_restore(ipl);
73
    }
129
    }
74
}
130
}
75
 
131
 
76
void udebug_stoppable_end(void)
132
void udebug_stoppable_end(void)
77
{
133
{
78
    ipl_t ipl;
134
    ipl_t ipl;
79
 
135
 
80
restart:
136
restart:
81
    ipl = interrupts_disable();
137
    ipl = interrupts_disable();
82
    spinlock_lock(&TASK->lock);
138
    spinlock_lock(&TASK->lock);
83
 
139
 
-
 
140
    /* Lock order OK, THREAD->debug_lock is after TASK->lock */
-
 
141
    spinlock_lock(&THREAD->debug_lock);
-
 
142
 
-
 
143
    if (TASK->dt_state == UDEBUG_TS_ACTIVE) {
-
 
144
        klog_printf("udebug_stoppable_end");
-
 
145
        klog_printf("debug_stop=%d", THREAD->debug_stop);
-
 
146
    }
-
 
147
 
84
    if ((TASK->dt_state == UDEBUG_TS_BEGINNING ||
148
    if ((TASK->dt_state == UDEBUG_TS_BEGINNING ||
85
        TASK->dt_state == UDEBUG_TS_ACTIVE) &&
149
        TASK->dt_state == UDEBUG_TS_ACTIVE) &&
86
        THREAD->debug_stop == true) {
150
        THREAD->debug_stop == true) {
87
        TASK->debug_begin_call = NULL;
151
        TASK->debug_begin_call = NULL;
-
 
152
        spinlock_unlock(&THREAD->debug_lock);
88
        spinlock_unlock(&TASK->lock);
153
        spinlock_unlock(&TASK->lock);
89
        interrupts_restore(ipl);
154
        interrupts_restore(ipl);
90
 
155
 
91
        klog_printf("udebug_stoppable_end: waitq_sleep");
156
        klog_printf("udebug_stoppable_end: waitq_sleep");
92
        waitq_sleep(&THREAD->go_wq);
157
        waitq_sleep(&THREAD->go_wq);
93
        goto restart;
158
        goto restart;
94
        /* must try again - have to lose stoppability atomically */
159
        /* must try again - have to lose stoppability atomically */
95
    } else {
160
    } else {
96
        ++TASK->not_stoppable_count;
161
        ++TASK->not_stoppable_count;
-
 
162
        THREAD->debug_stoppable = false;
-
 
163
 
-
 
164
        spinlock_unlock(&THREAD->debug_lock);
97
        spinlock_unlock(&TASK->lock);
165
        spinlock_unlock(&TASK->lock);
98
        interrupts_restore(ipl);
166
        interrupts_restore(ipl);
99
    }
167
    }
100
}
168
}
101
 
169
 
102
void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3,
170
void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3,
103
    unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc)
171
    unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc)
104
{
172
{
105
    call_t *call;
173
    call_t *call;
106
    ipl_t ipl;
174
    ipl_t ipl;
107
 
175
 
108
    ipl = interrupts_disable();
176
    ipl = interrupts_disable();
109
    spinlock_lock(&THREAD->debug_lock);
177
    spinlock_lock(&THREAD->debug_lock);
110
 
178
 
111
    /* Must only generate events when in debugging session and have go */
179
    /* Must only generate events when in debugging session and have go */
112
    if (THREAD->debug_active != true ||
180
    if (THREAD->debug_active != true ||
113
        THREAD->debug_stop == true) {
181
        THREAD->debug_stop == true) {
114
        spinlock_unlock(&THREAD->debug_lock);
182
        spinlock_unlock(&THREAD->debug_lock);
115
        interrupts_restore(ipl);
183
        interrupts_restore(ipl);
116
        return;
184
        return;
117
    }
185
    }
118
 
186
 
119
    klog_printf("udebug_syscall_event");
187
    klog_printf("udebug_syscall_event");
120
    call = THREAD->debug_go_call;
188
    call = THREAD->debug_go_call;
121
    IPC_SET_RETVAL(call->data, 0);
189
    IPC_SET_RETVAL(call->data, 0);
122
    IPC_SET_ARG1(call->data, UDEBUG_EVENT_SYSCALL);
190
    IPC_SET_ARG1(call->data, UDEBUG_EVENT_SYSCALL);
123
    IPC_SET_ARG2(call->data, id);
191
    IPC_SET_ARG2(call->data, id);
124
    IPC_SET_ARG3(call->data, rc);
192
    IPC_SET_ARG3(call->data, rc);
125
    klog_printf("udebug_syscall_event/ipc_answer");
193
    klog_printf("udebug_syscall_event/ipc_answer");
126
 
194
 
127
    THREAD->syscall_args[0] = a1;
195
    THREAD->syscall_args[0] = a1;
128
    THREAD->syscall_args[1] = a2;
196
    THREAD->syscall_args[1] = a2;
129
    THREAD->syscall_args[2] = a3;
197
    THREAD->syscall_args[2] = a3;
130
    THREAD->syscall_args[3] = a4;
198
    THREAD->syscall_args[3] = a4;
131
    THREAD->syscall_args[4] = a5;
199
    THREAD->syscall_args[4] = a5;
132
    THREAD->syscall_args[5] = a6;
200
    THREAD->syscall_args[5] = a6;
133
 
201
 
134
    /*
202
    /*
135
     * Make sure debug_stop is true when going to sleep
203
     * Make sure debug_stop is true when going to sleep
136
     * in case we get woken up by DEBUG_END. (At which
204
     * in case we get woken up by DEBUG_END. (At which
137
     * point it must be back to the initial true value).
205
     * point it must be back to the initial true value).
138
     */
206
     */
139
    THREAD->debug_stop = true;
207
    THREAD->debug_stop = true;
140
 
208
 
141
    THREAD->cur_event = UDEBUG_EVENT_SYSCALL;
209
    THREAD->cur_event = UDEBUG_EVENT_SYSCALL;
142
    spinlock_unlock(&THREAD->debug_lock);
210
    spinlock_unlock(&THREAD->debug_lock);
143
 
211
 
144
    spinlock_lock(&TASK->lock);
212
    spinlock_lock(&TASK->lock);
145
    ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
213
    ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
146
    spinlock_unlock(&TASK->lock);
214
    spinlock_unlock(&TASK->lock);
147
 
215
 
148
    interrupts_restore(ipl);
216
    interrupts_restore(ipl);
149
 
217
 
150
    waitq_sleep(&THREAD->go_wq);
218
    waitq_sleep(&THREAD->go_wq);
151
}
219
}
152
 
220
 
153
void udebug_new_thread_event(struct thread *t)
221
void udebug_new_thread_event(struct thread *t)
154
{
222
{
155
    call_t *call;
223
    call_t *call;
156
    ipl_t ipl;
224
    ipl_t ipl;
157
 
225
 
158
    ipl = interrupts_disable();
226
    ipl = interrupts_disable();
159
    spinlock_lock(&THREAD->debug_lock);
227
    spinlock_lock(&THREAD->debug_lock);
160
 
228
 
161
    klog_printf("udebug_new_thread_event");
229
    klog_printf("udebug_new_thread_event");
162
    klog_printf("- check state");
230
    klog_printf("- check state");
163
 
231
 
164
    /* Must only generate events when in debugging session */
232
    /* Must only generate events when in debugging session */
165
    if (THREAD->debug_active != true) {
233
    if (THREAD->debug_active != true) {
166
        klog_printf("- debug_active: %s, debug_stop: %s",
234
        klog_printf("- debug_active: %s, debug_stop: %s",
167
            THREAD->debug_active ? "yes(+)" : "no(-)",
235
            THREAD->debug_active ? "yes(+)" : "no(-)",
168
            THREAD->debug_stop ? "yes(-)" : "no(+)");
236
            THREAD->debug_stop ? "yes(-)" : "no(+)");
169
        spinlock_unlock(&THREAD->debug_lock);
237
        spinlock_unlock(&THREAD->debug_lock);
170
        interrupts_restore(ipl);
238
        interrupts_restore(ipl);
171
        return;
239
        return;
172
    }
240
    }
173
 
241
 
174
    klog_printf("- trigger event");
242
    klog_printf("- trigger event");
175
 
243
 
176
    call = THREAD->debug_go_call;
244
    call = THREAD->debug_go_call;
177
    IPC_SET_RETVAL(call->data, 0);
245
    IPC_SET_RETVAL(call->data, 0);
178
    IPC_SET_ARG1(call->data, UDEBUG_EVENT_NEW_THREAD);
246
    IPC_SET_ARG1(call->data, UDEBUG_EVENT_NEW_THREAD);
179
    IPC_SET_ARG2(call->data, (unative_t)t);
247
    IPC_SET_ARG2(call->data, (unative_t)t);
180
 
248
 
181
    /*
249
    /*
182
     * Make sure debug_stop is true when going to sleep
250
     * Make sure debug_stop is true when going to sleep
183
     * in case we get woken up by DEBUG_END. (At which
251
     * in case we get woken up by DEBUG_END. (At which
184
     * point it must be back to the initial true value).
252
     * point it must be back to the initial true value).
185
     */
253
     */
186
    THREAD->debug_stop = true;
254
    THREAD->debug_stop = true;
187
 
255
 
188
    THREAD->cur_event = UDEBUG_EVENT_NEW_THREAD;
256
    THREAD->cur_event = UDEBUG_EVENT_NEW_THREAD;
189
    spinlock_unlock(&THREAD->debug_lock);
257
    spinlock_unlock(&THREAD->debug_lock);
190
 
258
 
191
    spinlock_lock(&TASK->lock);
259
    spinlock_lock(&TASK->lock);
192
    ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
260
    ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
193
    spinlock_unlock(&TASK->lock);
261
    spinlock_unlock(&TASK->lock);
194
 
262
 
195
    interrupts_restore(ipl);
263
    interrupts_restore(ipl);
196
    klog_printf("- sleep");
264
    klog_printf("- sleep");
197
 
265
 
198
    waitq_sleep(&THREAD->go_wq);
266
    waitq_sleep(&THREAD->go_wq);
199
}
267
}
200
 
268
 
201
/**
269
/**
202
 * Terminate task debugging session.
270
 * Terminate task debugging session.
203
 *
271
 *
204
 * \param ta Must be already locked and interrupts must be disabled.
272
 * \param ta Must be already locked and interrupts must be disabled.
205
 * \return Zero on success or negative error code.
273
 * \return Zero on success or negative error code.
206
 */
274
 */
207
int udebug_task_cleanup(struct task *ta)
275
int udebug_task_cleanup(struct task *ta)
208
{
276
{
209
    thread_t *t;
277
    thread_t *t;
210
    link_t *cur;
278
    link_t *cur;
211
    int flags;
279
    int flags;
212
 
280
 
213
    klog_printf("udebug_task_cleanup()");
281
    klog_printf("udebug_task_cleanup()");
214
    klog_printf("task %llu", ta->taskid);
282
    klog_printf("task %llu", ta->taskid);
215
 
283
 
216
    if (ta->dt_state == UDEBUG_TS_BEGINNING &&
284
    if (ta->dt_state == UDEBUG_TS_BEGINNING &&
217
        ta->dt_state != UDEBUG_TS_ACTIVE) {
285
        ta->dt_state != UDEBUG_TS_ACTIVE) {
218
        klog_printf("udebug_task_cleanup(): task not being debugged");
286
        klog_printf("udebug_task_cleanup(): task not being debugged");
219
        return EINVAL;
287
        return EINVAL;
220
    }
288
    }
221
 
289
 
222
    /* Finish debugging of all userspace threads */
290
    /* Finish debugging of all userspace threads */
223
    for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) {
291
    for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) {
224
        t = list_get_instance(cur, thread_t, th_link);
292
        t = list_get_instance(cur, thread_t, th_link);
225
 
293
 
226
        spinlock_lock(&t->debug_lock);
294
        spinlock_lock(&t->debug_lock);
227
        spinlock_lock(&t->lock);
295
        spinlock_lock(&t->lock);
228
 
296
 
229
        flags = t->flags;
297
        flags = t->flags;
230
 
298
 
231
        spinlock_unlock(&t->lock);
299
        spinlock_unlock(&t->lock);
232
 
300
 
233
        /* Only process userspace threads */
301
        /* Only process userspace threads */
234
        if ((flags & THREAD_FLAG_USPACE) != 0) {
302
        if ((flags & THREAD_FLAG_USPACE) != 0) {
235
            /* Prevent any further debug activity in thread */
303
            /* Prevent any further debug activity in thread */
236
            t->debug_active = false;
304
            t->debug_active = false;
237
            t->cur_event = 0;   /* none */
305
            t->cur_event = 0;   /* none */
238
 
306
 
239
            /* Still has go? */
307
            /* Still has go? */
240
            if (t->debug_stop == false) {
308
            if (t->debug_stop == false) {
241
                /*
309
                /*
242
                * Yes, so clear go. As debug_active == false,
310
                * Yes, so clear go. As debug_active == false,
243
                 * this doesn't affect anything.
311
                 * this doesn't affect anything.
244
                 */
312
                 */
245
                t->debug_stop = true;  
313
                t->debug_stop = true;  
246
 
314
 
247
                /* Answer GO call */
315
                /* Answer GO call */
248
                klog_printf("answer GO call with EVENT_FINISHED");
316
                klog_printf("answer GO call with EVENT_FINISHED");
249
                IPC_SET_RETVAL(t->debug_go_call->data, 0);
317
                IPC_SET_RETVAL(t->debug_go_call->data, 0);
250
                IPC_SET_ARG1(t->debug_go_call->data, UDEBUG_EVENT_FINISHED);
318
                IPC_SET_ARG1(t->debug_go_call->data, UDEBUG_EVENT_FINISHED);
251
                ipc_answer(&ta->answerbox, t->debug_go_call);
319
                ipc_answer(&ta->answerbox, t->debug_go_call);
252
            } else {
320
            } else {
253
                /*
321
                /*
254
                 * Debug_stop is already at initial value.
322
                 * Debug_stop is already at initial value.
255
                 * Yet this means the thread needs waking up.
323
                 * Yet this means the thread needs waking up.
256
                 */
324
                 */
257
 
325
 
258
                /*
326
                /*
259
                 * t's lock must not be held when calling
327
                 * t's lock must not be held when calling
260
                 * waitq_wakeup.
328
                 * waitq_wakeup.
261
                 */
329
                 */
262
                waitq_wakeup(&t->go_wq, WAKEUP_FIRST);
330
                waitq_wakeup(&t->go_wq, WAKEUP_FIRST);
263
            }
331
            }
264
        }
332
        }
265
        spinlock_unlock(&t->debug_lock);
333
        spinlock_unlock(&t->debug_lock);
266
    }
334
    }
267
 
335
 
268
    ta->dt_state = UDEBUG_TS_INACTIVE;
336
    ta->dt_state = UDEBUG_TS_INACTIVE;
269
    ta->debugger = NULL;
337
    ta->debugger = NULL;
270
 
338
 
271
    return 0;
339
    return 0;
272
}
340
}
273
 
341
 
274
 
342
 
275
/** @}
343
/** @}
276
 */
344
 */
277
 
345