Subversion Repositories HelenOS-historic

Rev

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

Rev 851 Rev 958
Line 177... Line 177...
177
    cur->nextinstruction = ((__native *)cur->address)[1];
177
    cur->nextinstruction = ((__native *)cur->address)[1];
178
    if (argv == &add_argv) {
178
    if (argv == &add_argv) {
179
        cur->flags = 0;
179
        cur->flags = 0;
180
    } else { /* We are add extended */
180
    } else { /* We are add extended */
181
        cur->flags = BKPOINT_FUNCCALL;
181
        cur->flags = BKPOINT_FUNCCALL;
182
        cur->bkfunc =   (void (*)(void *, struct exception_regdump *)) argv[1].intval;
182
        cur->bkfunc =   (void (*)(void *, istate_t *)) argv[1].intval;
183
    }
183
    }
184
    if (is_jump(cur->instruction))
184
    if (is_jump(cur->instruction))
185
        cur->flags |= BKPOINT_ONESHOT;
185
        cur->flags |= BKPOINT_ONESHOT;
186
    cur->counter = 0;
186
    cur->counter = 0;
187
 
187
 
Line 287... Line 287...
287
 * If found, call kconsole, set break on next instruction and reexecute.
287
 * If found, call kconsole, set break on next instruction and reexecute.
288
 * If we are on "next instruction", set it back on the first and reexecute.
288
 * If we are on "next instruction", set it back on the first and reexecute.
289
 * If breakpoint not found in breakpoint table, call kconsole and start
289
 * If breakpoint not found in breakpoint table, call kconsole and start
290
 * next instruction.
290
 * next instruction.
291
 */
291
 */
292
void debugger_bpoint(struct exception_regdump *pstate)
292
void debugger_bpoint(istate_t *istate)
293
{
293
{
294
    bpinfo_t *cur = NULL;
294
    bpinfo_t *cur = NULL;
295
    __address fireaddr = pstate->epc;
295
    __address fireaddr = istate->epc;
296
    int i;
296
    int i;
297
 
297
 
298
    /* test branch delay slot */
298
    /* test branch delay slot */
299
    if (cp0_cause_read() & 0x80000000)
299
    if (cp0_cause_read() & 0x80000000)
300
        panic("Breakpoint in branch delay slot not supported.\n");
300
        panic("Breakpoint in branch delay slot not supported.\n");
Line 327... Line 327...
327
        if (cur->flags & BKPOINT_INPROG)
327
        if (cur->flags & BKPOINT_INPROG)
328
            printf("Warning: breakpoint recursion\n");
328
            printf("Warning: breakpoint recursion\n");
329
       
329
       
330
        if (!(cur->flags & BKPOINT_FUNCCALL))
330
        if (!(cur->flags & BKPOINT_FUNCCALL))
331
            printf("***Breakpoint %d: 0x%p in %s.\n", i,
331
            printf("***Breakpoint %d: 0x%p in %s.\n", i,
332
                   fireaddr, get_symtab_entry(pstate->epc));
332
                   fireaddr, get_symtab_entry(istate->epc));
333
 
333
 
334
        /* Return first instruction back */
334
        /* Return first instruction back */
335
        ((__u32 *)cur->address)[0] = cur->instruction;
335
        ((__u32 *)cur->address)[0] = cur->instruction;
336
 
336
 
337
        if (! (cur->flags & BKPOINT_ONESHOT)) {
337
        if (! (cur->flags & BKPOINT_ONESHOT)) {
Line 342... Line 342...
342
        cur->flags |= BKPOINT_INPROG;
342
        cur->flags |= BKPOINT_INPROG;
343
    } else {
343
    } else {
344
        printf("***Breakpoint 0x%p in %s.\n", fireaddr,
344
        printf("***Breakpoint 0x%p in %s.\n", fireaddr,
345
               get_symtab_entry(fireaddr));
345
               get_symtab_entry(fireaddr));
346
        /* Move on to next instruction */
346
        /* Move on to next instruction */
347
        pstate->epc += 4;
347
        istate->epc += 4;
348
    }
348
    }
349
    if (cur)
349
    if (cur)
350
        cur->counter++;
350
        cur->counter++;
351
    if (cur && (cur->flags & BKPOINT_FUNCCALL)) {
351
    if (cur && (cur->flags & BKPOINT_FUNCCALL)) {
352
        /* Allow zero bkfunc, just for counting */
352
        /* Allow zero bkfunc, just for counting */
353
        if (cur->bkfunc)
353
        if (cur->bkfunc)
354
            cur->bkfunc(cur, pstate);
354
            cur->bkfunc(cur, istate);
355
    } else {
355
    } else {
356
        printf("***Type 'exit' to exit kconsole.\n");
356
        printf("***Type 'exit' to exit kconsole.\n");
357
        /* This disables all other processors - we are not SMP,
357
        /* This disables all other processors - we are not SMP,
358
         * actually this gets us to cpu_halt, if scheduler() is run
358
         * actually this gets us to cpu_halt, if scheduler() is run
359
         * - we generally do not want scheduler to be run from debug,
359
         * - we generally do not want scheduler to be run from debug,