Subversion Repositories HelenOS

Rev

Rev 3100 | Rev 3472 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3100 Rev 3429
Line 169... Line 169...
169
{
169
{
170
    cons_printf("singlestep hit\n");
170
    cons_printf("singlestep hit\n");
171
    thread_stop();
171
    thread_stop();
172
}
172
}
173
 
173
 
174
static int task_connect(int taskid)
174
static int task_connect(task_id_t task_id)
175
{
175
{
176
    int rc;
176
    int rc;
177
    unsigned evmask;
177
    unsigned evmask;
178
 
178
 
179
    cons_printf("ipc_connect_kbox(%d)... ", taskid);
179
    cons_printf("ipc_connect_kbox(%;;d)... ", task_id);
180
    rc = ipc_connect_kbox(taskid);
180
    rc = ipc_connect_kbox(task_id);
181
    cons_printf("-> %d\n", rc);
181
    cons_printf("-> %d\n", rc);
182
    app_phone = rc;
182
    app_phone = rc;
183
    if (rc < 0) return rc;
183
    if (rc < 0) return rc;
184
 
184
 
185
    cons_printf("udebug_begin()... ");
185
    cons_printf("udebug_begin()... ");
Line 326... Line 326...
326
    dt->fid = fid;
326
    dt->fid = fid;
327
 
327
 
328
    fibril_add_ready(fid);
328
    fibril_add_ready(fid);
329
}
329
}
330
 
330
 
331
static void debug_active_task(void)
331
static void debug_active_task(task_id_t task_id)
332
{
332
{
333
    int taskid;
333
    int taskid;
334
    int i;
334
    int i;
335
    int rc;
335
    int rc;
336
 
336
 
337
    thash_t *thash_buffer;
337
    thash_t *thash_buffer;
338
    int n_threads;
338
    int n_threads;
339
 
339
 
340
    cons_printf("Breakpoint Debugger\n");
340
    cons_printf("Breakpoint Debugger\n");
341
    cons_printf("Press 'c' to connect\n");
-
 
342
    while ((i = getchar()) != 'c')
-
 
343
        putchar(i);
-
 
344
 
341
 
345
    taskid = /*13 mips32*/13;
-
 
346
    rc = task_connect(taskid);
342
    rc = task_connect(task_id);
347
    if (rc < 0) {
343
    if (rc < 0) {
348
        cons_printf("Failed to connect to task %d\n", taskid);
344
        cons_printf("Failed to connect to task %lld\n", task_id);
349
        return;
345
        return;
350
    }
346
    }
351
 
347
 
352
    cons_printf("Connected to task %d\n", taskid);
348
    cons_printf("Connected to task %lld\n", task_id);
353
 
349
 
354
    rc = get_thread_list(&thash_buffer, &n_threads);
350
    rc = get_thread_list(&thash_buffer, &n_threads);
355
    if (rc < 0) {
351
    if (rc < 0) {
356
        cons_printf("Failed to get thread list\n", rc);
352
        cons_printf("Failed to get thread list\n", rc);
357
        return;
353
        return;
Line 388... Line 384...
388
    list_initialize(&dthreads);
384
    list_initialize(&dthreads);
389
    breakpoint_init();
385
    breakpoint_init();
390
    cwt = NULL;
386
    cwt = NULL;
391
}
387
}
392
 
388
 
393
int main(void)
389
static void print_syntax()
394
{
390
{
395
    main_init();
391
    printf("syntax: debug <task_id>\n");
-
 
392
}
396
 
393
 
-
 
394
int main(int argc, char *argv[])
-
 
395
{
-
 
396
    task_id_t task_id;
-
 
397
    char *err_p;
-
 
398
 
397
    while (1) {
399
    if (argc != 2) {
-
 
400
        printf("Mising argument\n");
398
        debug_active_task();
401
        print_syntax();
-
 
402
        return 1;
399
    }
403
    }
-
 
404
 
-
 
405
    task_id = strtol(argv[1], &err_p, 10);
-
 
406
 
-
 
407
    if (*err_p) {
-
 
408
        printf("Task ID syntax error\n");
-
 
409
        print_syntax();
-
 
410
        return 1;
-
 
411
    }
-
 
412
 
-
 
413
    main_init();
-
 
414
    debug_active_task(task_id);
400
}
415
}
401
 
416
 
402
/** @}
417
/** @}
403
 */
418
 */