Subversion Repositories HelenOS

Rev

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

Rev 2947 Rev 3005
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 debug
29
/** @addtogroup debug
30
 * @{
30
 * @{
31
 */
31
 */
32
/** @file
32
/** @file
33
 */
33
 */
34
 
34
 
35
#include <stdio.h>
35
#include <stdio.h>
36
#include <stdlib.h>
36
#include <stdlib.h>
37
#include <unistd.h>
37
#include <unistd.h>
38
#include <syscall.h>
38
#include <syscall.h>
39
#include <ipc/ipc.h>
39
#include <ipc/ipc.h>
40
#include <fibril.h>
40
#include <fibril.h>
41
#include <errno.h>
41
#include <errno.h>
42
#include <udebug.h>
42
#include <udebug.h>
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 "cons.h"
47
#include "cons.h"
48
#include "dthread.h"
48
#include "dthread.h"
-
 
49
#include "breakpoint.h"
49
#include "include/arch.h"
50
#include "include/arch.h"
50
#include "fib_synch.h"
51
#include "fib_synch.h"
51
#include "main.h"
52
#include "main.h"
52
 
53
 
53
void thread_debug_start(unsigned thread_hash);
54
void thread_debug_start(unsigned thread_hash);
54
 
55
 
55
#define IN_BUF_SIZE 64
56
#define IN_BUF_SIZE 64
56
static char in_buf[IN_BUF_SIZE];
57
static char in_buf[IN_BUF_SIZE];
57
 
58
 
58
#define MAX_ARGC 10
59
#define MAX_ARGC 10
59
int cmd_argc;
60
int cmd_argc;
60
char *cmd_argv[MAX_ARGC + 1];   /* need one spare field for cmd_split() */
61
char *cmd_argv[MAX_ARGC + 1];   /* need one spare field for cmd_split() */
61
 
62
 
62
 
63
 
63
int next_thread_id;
64
int next_thread_id;
64
 
65
 
65
int app_phone;
66
int app_phone;
66
volatile bool abort_debug;
67
volatile bool abort_debug;
67
 
68
 
68
volatile int paused;
69
volatile int paused;
69
 
70
 
70
breakpoint_t brk_list[MAX_BRKPTS];
-
 
71
int lifted_brkpt;
-
 
72
 
-
 
73
fcv_t go_cv;
71
fcv_t go_cv;
74
 
72
 
75
static void command_split(char *cmd_str)
73
static void command_split(char *cmd_str)
76
{
74
{
77
    char *p = cmd_str;
75
    char *p = cmd_str;
78
 
76
 
79
    if (*p == '\0') {
77
    if (*p == '\0') {
80
        cmd_argc = 0;
78
        cmd_argc = 0;
81
        return;
79
        return;
82
    }
80
    }
83
 
81
 
84
    cmd_argc = 1;
82
    cmd_argc = 1;
85
    cmd_argv[0] = p;
83
    cmd_argv[0] = p;
86
 
84
 
87
    while (*p != '\0') {
85
    while (*p != '\0') {
88
        if (*p == ' ') {
86
        if (*p == ' ') {
89
            cmd_argv[cmd_argc++] = p + 1;
87
            cmd_argv[cmd_argc++] = p + 1;
90
            *p = '\0';
88
            *p = '\0';
91
        }
89
        }
92
        ++p;
90
        ++p;
93
    }
91
    }
94
}
92
}
95
 
93
 
96
static void command_run(void)
94
static void command_run(void)
97
{
95
{
98
    int i;
96
    int i;
99
    int cmp_len;
97
    int cmp_len;
100
    int len;
98
    int len;
101
 
99
 
102
    int idx_found;
100
    int idx_found;
103
    int num_found;
101
    int num_found;
104
 
102
 
105
    len = strlen(cmd_argv[0]);
103
    len = strlen(cmd_argv[0]);
106
    cmp_len = 1;
104
    cmp_len = 1;
107
 
105
 
108
    /* Silence warnings */
106
    /* Silence warnings */
109
    num_found = 0;
107
    num_found = 0;
110
    idx_found = 0;
108
    idx_found = 0;
111
 
109
 
112
    while (cmp_len <= len + 1) {
110
    while (cmp_len <= len + 1) {
113
 
111
 
114
        num_found = 0;
112
        num_found = 0;
115
        i = 0;
113
        i = 0;
116
        while (cmd_table[i].name != NULL) {
114
        while (cmd_table[i].name != NULL) {
117
            if (strncmp(cmd_table[i].name, cmd_argv[0], cmp_len) == 0) {
115
            if (strncmp(cmd_table[i].name, cmd_argv[0], cmp_len) == 0) {
118
                idx_found = i;
116
                idx_found = i;
119
                ++num_found;
117
                ++num_found;
120
            }
118
            }
121
            ++i;
119
            ++i;
122
        }
120
        }
123
 
121
 
124
        if (num_found < 2) break;
122
        if (num_found < 2) break;
125
 
123
 
126
        ++cmp_len;
124
        ++cmp_len;
127
    }
125
    }
128
 
126
 
129
    if (num_found == 0) {
127
    if (num_found == 0) {
130
        cons_printf("Unknown command. Try one of:\n");
128
        cons_printf("Unknown command. Try one of:\n");
131
        cmd_help(0, NULL);
129
        cmd_help(0, NULL);
132
        return;
130
        return;
133
    }
131
    }
134
 
132
 
135
    if (cmd_argc - 1 != cmd_table[idx_found].argc) {
133
    if (cmd_argc - 1 != cmd_table[idx_found].argc) {
136
        cons_printf("Command '%s' expects %d arguments\n",
134
        cons_printf("Command '%s' expects %d arguments\n",
137
        cmd_table[idx_found].name, cmd_table[idx_found].argc);
135
        cmd_table[idx_found].name, cmd_table[idx_found].argc);
138
        return;
136
        return;
139
    }
137
    }
140
 
138
 
141
    (*cmd_table[idx_found].proc)(cmd_argc, cmd_argv);
139
    (*cmd_table[idx_found].proc)(cmd_argc, cmd_argv);
142
}
140
}
143
 
141
 
144
static void thread_stop(void)
142
static void thread_stop(void)
145
{
143
{
146
    dthread_t *dt;
144
    dthread_t *dt;
147
    uintptr_t pc;
145
    uintptr_t pc;
148
 
146
 
149
    dt = dthread_get();
147
    dt = dthread_get();
150
    pc = dthread_get_pc(dt);
148
    pc = dthread_get_pc(dt);
151
    cons_printf("[thread %d] stopped at 0x%lx\n", dt->id, pc);
149
    cons_printf("[thread %d] stopped at 0x%lx\n", dt->id, pc);
152
    dthread_stop_me();
150
    dthread_stop_me();
153
    cons_printf("[thread %d] go\n", dt->id);
151
    cons_printf("[thread %d] go\n", dt->id);
154
}
152
}
155
 
153
 
156
/*
154
/*
157
 * Called by a fibril (from arch code) when a breakpoint is hit.
155
 * Called by a fibril (from arch code) when a breakpoint is hit.
158
 */
156
 */
159
void breakpoint_hit(void)
157
void breakpoint_hit(breakpoint_t *b)
160
{
158
{
-
 
159
    dthread_t *dt;
-
 
160
 
-
 
161
    dt = dthread_get();
161
    cons_printf("breakpoint hit\n");
162
    cons_printf("Thread %d hit breakpoint %d at 0x%lx\n",
-
 
163
        dt->id, b->id, b->addr);
162
    thread_stop();
164
    thread_stop();
163
}
165
}
164
 
166
 
165
/*
167
/*
166
 * Called by a fibril (from arch code) when a single instruction
168
 * Called by a fibril (from arch code) when a single instruction
167
 * in singlestep is executed
169
 * in singlestep is executed
168
 */
170
 */
169
void singlestep_hit(void)
171
void singlestep_hit(void)
170
{
172
{
171
    cons_printf("singlestep hit\n");
173
    cons_printf("singlestep hit\n");
172
    thread_stop();
174
    thread_stop();
173
}
175
}
174
 
176
 
175
static int task_connect(int taskid)
177
static int task_connect(int taskid)
176
{
178
{
177
    int rc;
179
    int rc;
178
    unsigned evmask;
180
    unsigned evmask;
179
 
181
 
180
    cons_printf("ipc_connect_kbox(%d)... ", taskid);
182
    cons_printf("ipc_connect_kbox(%d)... ", taskid);
181
    rc = ipc_connect_kbox(taskid);
183
    rc = ipc_connect_kbox(taskid);
182
    cons_printf("-> %d\n", rc);
184
    cons_printf("-> %d\n", rc);
183
    app_phone = rc;
185
    app_phone = rc;
184
    if (rc < 0) return rc;
186
    if (rc < 0) return rc;
185
 
187
 
186
    cons_printf("udebug_begin()... ");
188
    cons_printf("udebug_begin()... ");
187
    rc = udebug_begin(app_phone);
189
    rc = udebug_begin(app_phone);
188
    cons_printf("-> %d\n", rc);
190
    cons_printf("-> %d\n", rc);
189
    if (rc < 0) return rc;
191
    if (rc < 0) return rc;
190
 
192
 
191
    evmask = UDEBUG_EM_ALL & ~(UDEBUG_EM_SYSCALL_B | UDEBUG_EM_SYSCALL_E);
193
    evmask = UDEBUG_EM_ALL & ~(UDEBUG_EM_SYSCALL_B | UDEBUG_EM_SYSCALL_E);
192
    cons_printf("udebug_set_evmask(0x%x)... ", evmask);
194
    cons_printf("udebug_set_evmask(0x%x)... ", evmask);
193
    rc = udebug_set_evmask(app_phone, evmask);
195
    rc = udebug_set_evmask(app_phone, evmask);
194
    cons_printf("-> %d\n", rc);
196
    cons_printf("-> %d\n", rc);
195
    if (rc < 0) return rc;
197
    if (rc < 0) return rc;
196
 
198
 
197
    return 0;
199
    return 0;
198
}
200
}
199
 
201
 
200
#define THASH_BUF_INIT_LENGTH 32
202
#define THASH_BUF_INIT_LENGTH 32
201
 
203
 
202
static int get_thread_list(thash_t **thash_buf_ptr, int *n)
204
static int get_thread_list(thash_t **thash_buf_ptr, int *n)
203
{
205
{
204
    int rc;
206
    int rc;
205
    size_t tb_copied;
207
    size_t tb_copied;
206
    size_t tb_needed;
208
    size_t tb_needed;
207
    int i;
209
    int i;
208
    size_t tb_size;
210
    size_t tb_size;
209
    thash_t *thash_buf;
211
    thash_t *thash_buf;
210
 
212
 
211
    tb_size = THASH_BUF_INIT_LENGTH * sizeof(thash_t);
213
    tb_size = THASH_BUF_INIT_LENGTH * sizeof(thash_t);
212
    thash_buf = malloc(tb_size);
214
    thash_buf = malloc(tb_size);
213
 
215
 
214
    rc = udebug_thread_read(app_phone, thash_buf,
216
    rc = udebug_thread_read(app_phone, thash_buf,
215
        tb_size, &tb_copied, &tb_needed);
217
        tb_size, &tb_copied, &tb_needed);
216
    if (rc < 0) return rc;
218
    if (rc < 0) return rc;
217
 
219
 
218
    if (tb_needed > tb_size) {
220
    if (tb_needed > tb_size) {
219
        /* Larger buffer needed  */
221
        /* Larger buffer needed  */
220
 
222
 
221
        free(thash_buf);
223
        free(thash_buf);
222
 
224
 
223
        tb_size = tb_needed;
225
        tb_size = tb_needed;
224
        thash_buf = malloc(tb_size);
226
        thash_buf = malloc(tb_size);
225
 
227
 
226
        if (!thash_buf) {
228
        if (!thash_buf) {
227
            printf("malloc failed\n");
229
            printf("malloc failed\n");
228
            exit(1);
230
            exit(1);
229
        }
231
        }
230
 
232
 
231
        /* Try again */
233
        /* Try again */
232
       
234
       
233
        rc = udebug_thread_read(app_phone, thash_buf,
235
        rc = udebug_thread_read(app_phone, thash_buf,
234
            tb_size, &tb_copied, &tb_needed);
236
            tb_size, &tb_copied, &tb_needed);
235
 
237
 
236
        if (rc < 0) return rc;
238
        if (rc < 0) return rc;
237
    }
239
    }
238
 
240
 
239
    *n = tb_copied / sizeof(thash_t);
241
    *n = tb_copied / sizeof(thash_t);
240
 
242
 
241
    cons_printf("thread hashes:");
243
    cons_printf("thread hashes:");
242
 
244
 
243
    for (i = 0; i < *n; ++i) {
245
    for (i = 0; i < *n; ++i) {
244
        cons_printf("0x%x\n", thash_buf[i]);
246
        cons_printf("0x%x\n", thash_buf[i]);
245
    }
247
    }
246
 
248
 
247
    cons_printf("Total of %u threads\n", *n);
249
    cons_printf("Total of %u threads\n", *n);
248
 
250
 
249
    *thash_buf_ptr = thash_buf;
251
    *thash_buf_ptr = thash_buf;
250
 
252
 
251
    return 0;
253
    return 0;
252
}
254
}
253
 
255
 
254
static void event_thread_b(unsigned hash)
256
static void event_thread_b(unsigned hash)
255
{
257
{
256
    async_serialize_start();
258
    async_serialize_start();
257
    cons_printf("new thread, hash 0x%x\n", hash);
259
    cons_printf("new thread, hash 0x%x\n", hash);
258
    async_serialize_end();
260
    async_serialize_end();
259
 
261
 
260
    thread_debug_start(hash);
262
    thread_debug_start(hash);
261
}
263
}
262
 
264
 
263
static void debug_event(thash_t thash, udebug_event_t ev_type, sysarg_t val0)
265
static void debug_event(thash_t thash, udebug_event_t ev_type, sysarg_t val0)
264
{
266
{
265
    switch (ev_type) {
267
    switch (ev_type) {
266
    case UDEBUG_EVENT_STOP:
268
    case UDEBUG_EVENT_STOP:
267
        cons_printf("stop event\n");
269
        cons_printf("stop event\n");
268
        thread_stop();
270
        thread_stop();
269
        break;
271
        break;
270
    case UDEBUG_EVENT_THREAD_B:
272
    case UDEBUG_EVENT_THREAD_B:
271
        event_thread_b(val0);
273
        event_thread_b(val0);
272
        break;
274
        break;
273
    case UDEBUG_EVENT_THREAD_E:
275
    case UDEBUG_EVENT_THREAD_E:
274
        cons_printf("thread 0x%x exited\n", val0);
276
        cons_printf("thread 0x%x exited\n", val0);
275
        abort_debug = true;
277
        abort_debug = true;
276
        break;
278
        break;
277
    case UDEBUG_EVENT_BREAKPOINT:
279
    case UDEBUG_EVENT_BREAKPOINT:
278
        arch_event_breakpoint(thash);
280
        arch_event_breakpoint(thash);
279
        break;
281
        break;
280
    case UDEBUG_EVENT_TRAP:
282
    case UDEBUG_EVENT_TRAP:
281
        arch_event_trap(dthread_get());
283
        arch_event_trap(dthread_get());
282
        break;
284
        break;
283
    default:
285
    default:
284
        cons_printf("unknown event type %d\n", ev_type);
286
        cons_printf("unknown event type %d\n", ev_type);
285
        break;
287
        break;
286
    }
288
    }
287
}
289
}
288
 
290
 
289
static int debug_loop(void *dt_arg)
291
static int debug_loop(void *dt_arg)
290
{
292
{
291
    int rc;
293
    int rc;
292
    udebug_event_t ev_type;
294
    udebug_event_t ev_type;
293
    unsigned val0, val1;
295
    unsigned val0, val1;
294
    dthread_t *dt;
296
    dthread_t *dt;
295
 
297
 
296
    dt = (dthread_t *)dt_arg;
298
    dt = (dthread_t *)dt_arg;
297
 
299
 
298
    cons_printf("debug_loop(%d)\n", dt->id);
300
    cons_printf("debug_loop(%d)\n", dt->id);
299
 
301
 
300
    while (!abort_debug) {
302
    while (!abort_debug) {
301
 
303
 
302
        /* Run thread until an event occurs */
304
        /* Run thread until an event occurs */
303
        rc = udebug_go(app_phone, dt->hash, &ev_type, &val0, &val1);
305
        rc = udebug_go(app_phone, dt->hash, &ev_type, &val0, &val1);
304
 
306
 
305
        if (ev_type == UDEBUG_EVENT_FINISHED) {
307
        if (ev_type == UDEBUG_EVENT_FINISHED) {
306
            cons_printf("thread %u debugging finished\n", dt->id);
308
            cons_printf("thread %u debugging finished\n", dt->id);
307
            break;
309
            break;
308
        }
310
        }
309
        if (rc >= 0) debug_event(dt->hash, ev_type, val0);
311
        if (rc >= 0) debug_event(dt->hash, ev_type, val0);
310
    }
312
    }
311
 
313
 
312
    cons_printf("debug_loop(%d) exiting\n", dt->id);
314
    cons_printf("debug_loop(%d) exiting\n", dt->id);
313
    return 0;
315
    return 0;
314
}
316
}
315
 
317
 
316
void thread_debug_start(unsigned thash)
318
void thread_debug_start(unsigned thash)
317
{
319
{
318
    fid_t fid;
320
    fid_t fid;
319
    dthread_t *dt;
321
    dthread_t *dt;
320
 
322
 
321
    dt = dthread_new(thash);
323
    dt = dthread_new(thash);
322
 
324
 
323
    fid = fibril_create(debug_loop, (void *)dt);
325
    fid = fibril_create(debug_loop, (void *)dt);
324
    if (fid == 0) {
326
    if (fid == 0) {
325
        cons_printf("Warning: Failed creating fibril\n");
327
        cons_printf("Warning: Failed creating fibril\n");
326
    }
328
    }
327
    dt->fid = fid;
329
    dt->fid = fid;
328
 
330
 
329
    fibril_add_ready(fid);
331
    fibril_add_ready(fid);
330
}
332
}
331
 
333
 
332
static void debug_active_task(void)
334
static void debug_active_task(void)
333
{
335
{
334
    int taskid;
336
    int taskid;
335
    int i;
337
    int i;
336
    int rc;
338
    int rc;
337
 
339
 
338
    thash_t *thash_buffer;
340
    thash_t *thash_buffer;
339
    int n_threads;
341
    int n_threads;
340
 
342
 
341
    cons_printf("Breakpoint Debugger\n");
343
    cons_printf("Breakpoint Debugger\n");
342
    cons_printf("Press 'c' to connect\n");
344
    cons_printf("Press 'c' to connect\n");
343
    while ((i = getchar()) != 'c')
345
    while ((i = getchar()) != 'c')
344
        putchar(i);
346
        putchar(i);
345
 
347
 
346
    taskid = 14;
348
    taskid = 14;
347
    rc = task_connect(taskid);
349
    rc = task_connect(taskid);
348
    if (rc < 0) {
350
    if (rc < 0) {
349
        cons_printf("Failed to connect to task %d\n", taskid);
351
        cons_printf("Failed to connect to task %d\n", taskid);
350
        return;
352
        return;
351
    }
353
    }
352
 
354
 
353
    cons_printf("Connected to task %d\n", taskid);
355
    cons_printf("Connected to task %d\n", taskid);
354
 
356
 
355
    rc = get_thread_list(&thash_buffer, &n_threads);
357
    rc = get_thread_list(&thash_buffer, &n_threads);
356
    if (rc < 0) {
358
    if (rc < 0) {
357
        cons_printf("Failed to get thread list\n", rc);
359
        cons_printf("Failed to get thread list\n", rc);
358
        return;
360
        return;
359
    }
361
    }
360
 
362
 
361
    abort_debug = false;
363
    abort_debug = false;
362
 
364
 
363
    for (i = 0; i < n_threads; i++) {
365
    for (i = 0; i < n_threads; i++) {
364
        thread_debug_start(thash_buffer[i]);
366
        thread_debug_start(thash_buffer[i]);
365
    }
367
    }
366
 
368
 
367
    while (!quit) {
369
    while (!quit) {
368
        cons_read_line(in_buf, IN_BUF_SIZE);
370
        cons_read_line(in_buf, IN_BUF_SIZE);
369
        command_split(in_buf);
371
        command_split(in_buf);
370
        if (cmd_argc == 0) continue;
372
        if (cmd_argc == 0) continue;
371
 
373
 
372
        command_run();
374
        command_run();
373
    }
375
    }
374
 
376
 
375
    cons_printf("terminate debugging session...\n");
377
    cons_printf("terminate debugging session...\n");
376
    abort_debug = true;
378
    abort_debug = true;
377
    udebug_end(app_phone);
379
    udebug_end(app_phone);
378
    ipc_hangup(app_phone);
380
    ipc_hangup(app_phone);
379
 
381
 
380
    cons_printf("done\n");
382
    cons_printf("done\n");
381
    return;
383
    return;
382
}
384
}
383
 
385
 
384
static void main_init(void)
386
static void main_init(void)
385
{
387
{
386
    next_thread_id = 1;
388
    next_thread_id = 1;
387
    paused = 0;
389
    paused = 0;
388
   
390
   
389
    list_initialize(&dthreads);
391
    list_initialize(&dthreads);
-
 
392
    breakpoint_init();
390
    cwt = NULL;
393
    cwt = NULL;
391
 
394
 
392
    fcv_init(&go_cv);
395
    fcv_init(&go_cv);
393
}
396
}
394
 
397
 
395
int main(void)
398
int main(void)
396
{
399
{
397
    main_init();
400
    main_init();
398
 
401
 
399
    while (1) {
402
    while (1) {
400
        debug_active_task();
403
        debug_active_task();
401
    }
404
    }
402
}
405
}
403
 
406
 
404
/** @}
407
/** @}
405
 */
408
 */
406
 
409