Subversion Repositories HelenOS

Rev

Rev 4343 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4343 Rev 4346
Line 35... Line 35...
35
#include <arch/debugger.h>
35
#include <arch/debugger.h>
36
#include <arch/barrier.h>
36
#include <arch/barrier.h>
37
#include <memstr.h>
37
#include <memstr.h>
38
#include <console/kconsole.h>
38
#include <console/kconsole.h>
39
#include <console/cmd.h>
39
#include <console/cmd.h>
40
#include <symtab.h>
-
 
41
#include <print.h>
40
#include <print.h>
42
#include <panic.h>
41
#include <panic.h>
43
#include <arch.h>
42
#include <arch.h>
44
#include <arch/cp0.h>
43
#include <arch/cp0.h>
45
#include <func.h>
44
#include <func.h>
-
 
45
#include <symtab.h>
46
 
46
 
47
bpinfo_t breakpoints[BKPOINTS_MAX];
47
bpinfo_t breakpoints[BKPOINTS_MAX];
48
SPINLOCK_INITIALIZE(bkpoint_lock);
48
SPINLOCK_INITIALIZE(bkpoint_lock);
49
 
49
 
50
#ifdef CONFIG_KCONSOLE
50
#ifdef CONFIG_KCONSOLE
Line 257... Line 257...
257
    printf("#  Count Address    INPROG ONESHOT FUNCCALL In symbol\n");
257
    printf("#  Count Address    INPROG ONESHOT FUNCCALL In symbol\n");
258
    printf("-- ----- ---------- ------ ------- -------- ---------\n");
258
    printf("-- ----- ---------- ------ ------- -------- ---------\n");
259
   
259
   
260
    for (i = 0; i < BKPOINTS_MAX; i++)
260
    for (i = 0; i < BKPOINTS_MAX; i++)
261
        if (breakpoints[i].address) {
261
        if (breakpoints[i].address) {
-
 
262
            symbol = symtab_fmt_name_lookup(
262
            symbol = get_symtab_entry(breakpoints[i].address);
263
                breakpoints[i].address);
263
           
264
 
264
            printf("%-2u %-5d %#10zx %-6s %-7s %-8s %s\n", i,
265
            printf("%-2u %-5d %#10zx %-6s %-7s %-8s %s\n", i,
265
                breakpoints[i].counter, breakpoints[i].address,
266
                breakpoints[i].counter, breakpoints[i].address,
266
                ((breakpoints[i].flags & BKPOINT_INPROG) ? "true" :
267
                ((breakpoints[i].flags & BKPOINT_INPROG) ? "true" :
267
                "false"), ((breakpoints[i].flags & BKPOINT_ONESHOT)
268
                "false"), ((breakpoints[i].flags & BKPOINT_ONESHOT)
268
                ? "true" : "false"), ((breakpoints[i].flags &
269
                ? "true" : "false"), ((breakpoints[i].flags &
Line 346... Line 347...
346
            return;
347
            return;
347
        }
348
        }
348
        if (cur->flags & BKPOINT_INPROG)
349
        if (cur->flags & BKPOINT_INPROG)
349
            printf("Warning: breakpoint recursion\n");
350
            printf("Warning: breakpoint recursion\n");
350
       
351
       
351
        if (!(cur->flags & BKPOINT_FUNCCALL))
352
        if (!(cur->flags & BKPOINT_FUNCCALL)) {
352
            printf("***Breakpoint %d: %p in %s.\n", i, fireaddr,
353
            printf("***Breakpoint %d: %p in %s.\n", i, fireaddr,
353
                get_symtab_entry(istate->epc));
354
                symtab_fmt_name_lookup(istate->epc));
-
 
355
        }
354
 
356
 
355
        /* Return first instruction back */
357
        /* Return first instruction back */
356
        ((uint32_t *)cur->address)[0] = cur->instruction;
358
        ((uint32_t *)cur->address)[0] = cur->instruction;
357
        smc_coherence(cur->address);
359
        smc_coherence(cur->address);
358
 
360
 
Line 361... Line 363...
361
            ((uint32_t *)cur->address)[1] = 0x0d;
363
            ((uint32_t *)cur->address)[1] = 0x0d;
362
            cur->flags |= BKPOINT_REINST;
364
            cur->flags |= BKPOINT_REINST;
363
        }
365
        }
364
        cur->flags |= BKPOINT_INPROG;
366
        cur->flags |= BKPOINT_INPROG;
365
    } else {
367
    } else {
366
        printf("***Breakpoint %p in %s.\n", fireaddr,
368
        printf("***Breakpoint %d: %p in %s.\n", i, fireaddr,
367
               get_symtab_entry(fireaddr));
369
            symtab_fmt_name_lookup(fireaddr));
-
 
370
 
368
        /* Move on to next instruction */
371
        /* Move on to next instruction */
369
        istate->epc += 4;
372
        istate->epc += 4;
370
    }
373
    }
371
    if (cur)
374
    if (cur)
372
        cur->counter++;
375
        cur->counter++;
Line 382... Line 385...
382
         *   so this is a good idea
385
         *   so this is a good idea
383
         */
386
         */
384
        atomic_set(&haltstate, 1);
387
        atomic_set(&haltstate, 1);
385
        spinlock_unlock(&bkpoint_lock);
388
        spinlock_unlock(&bkpoint_lock);
386
       
389
       
387
        kconsole("debug", "Debug console ready (type 'exit' to continue)\n", false);
390
        kconsole("debug", "Debug console ready.\n", false);
388
       
391
       
389
        spinlock_lock(&bkpoint_lock);
392
        spinlock_lock(&bkpoint_lock);
390
        atomic_set(&haltstate, 0);
393
        atomic_set(&haltstate, 0);
391
#endif
394
#endif
392
    }
395
    }