Subversion Repositories HelenOS

Rev

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

Rev 3071 Rev 3138
Line 120... Line 120...
120
    for (i = 0; i < BKPOINTS_MAX; i++)
120
    for (i = 0; i < BKPOINTS_MAX; i++)
121
        if (breakpoints[i].address) {
121
        if (breakpoints[i].address) {
122
            symbol = get_symtab_entry(breakpoints[i].address);
122
            symbol = get_symtab_entry(breakpoints[i].address);
123
 
123
 
124
#ifdef __32_BITS__
124
#ifdef __32_BITS__
125
            printf("%-2u %-5d %#10zx %s\n", i, breakpoints[i].counter,
125
            printf("%-2u %-5d %#10zx %s\n", i,
126
                breakpoints[i].address, symbol);
126
                breakpoints[i].counter, breakpoints[i].address,
-
 
127
                symbol);
127
#endif
128
#endif
128
 
129
 
129
#ifdef __64_BITS__
130
#ifdef __64_BITS__
130
            printf("%-2u %-5d %#18zx %s\n", i, breakpoints[i].counter,
131
            printf("%-2u %-5d %#18zx %s\n", i,
131
                breakpoints[i].address, symbol);
132
                breakpoints[i].counter, breakpoints[i].address,
-
 
133
                symbol);
132
#endif
134
#endif
133
 
135
 
134
        }
136
        }
135
    return 1;
137
    return 1;
136
}
138
}
Line 182... Line 184...
182
            else if ((flags & BKPOINT_READ_WRITE))
184
            else if ((flags & BKPOINT_READ_WRITE))
183
                dr7 |= ((unative_t) 0x3) << (16 + 4 * curidx);
185
                dr7 |= ((unative_t) 0x3) << (16 + 4 * curidx);
184
        }
186
        }
185
 
187
 
186
        /* Enable global breakpoint */
188
        /* Enable global breakpoint */
187
        dr7 |= 0x2 << (curidx*2);
189
        dr7 |= 0x2 << (curidx * 2);
188
 
190
 
189
        write_dr7(dr7);
191
        write_dr7(dr7);
190
       
192
       
191
    }
193
    }
192
}
194
}
Line 254... Line 256...
254
    /* Handle zero checker */
256
    /* Handle zero checker */
255
    if (! (breakpoints[slot].flags & BKPOINT_INSTR)) {
257
    if (! (breakpoints[slot].flags & BKPOINT_INSTR)) {
256
        if ((breakpoints[slot].flags & BKPOINT_CHECK_ZERO)) {
258
        if ((breakpoints[slot].flags & BKPOINT_CHECK_ZERO)) {
257
            if (*((unative_t *) breakpoints[slot].address) != 0)
259
            if (*((unative_t *) breakpoints[slot].address) != 0)
258
                return;
260
                return;
259
            printf("**** Found ZERO on address %lx (slot %d) ****\n",
261
            printf("*** Found ZERO on address %lx (slot %d) ***\n",
260
                breakpoints[slot].address, slot);
262
                breakpoints[slot].address, slot);
261
        } else {
263
        } else {
262
            printf("Data watchpoint - new data: %lx\n",
264
            printf("Data watchpoint - new data: %lx\n",
263
                   *((unative_t *) breakpoints[slot].address));
265
                *((unative_t *) breakpoints[slot].address));
264
        }
266
        }
265
    }
267
    }
266
    printf("Reached breakpoint %d:%lx(%s)\n", slot, getip(istate),
268
    printf("Reached breakpoint %d:%lx(%s)\n", slot, getip(istate),
267
           get_symtab_entry(getip(istate)));
269
        get_symtab_entry(getip(istate)));
268
    printf("***Type 'exit' to exit kconsole.\n");
270
    printf("***Type 'exit' to exit kconsole.\n");
269
    atomic_set(&haltstate,1);
271
    atomic_set(&haltstate,1);
270
    kconsole((void *) "debug");
272
    kconsole((void *) "debug");
271
    atomic_set(&haltstate,0);
273
    atomic_set(&haltstate,0);
272
}
274
}
Line 355... Line 357...
355
        }
357
        }
356
    }
358
    }
357
}
359
}
358
 
360
 
359
#ifdef CONFIG_SMP
361
#ifdef CONFIG_SMP
-
 
362
static void
-
 
363
debug_ipi(int n __attribute__((unused)),
360
static void debug_ipi(int n __attribute__((unused)), istate_t *istate __attribute__((unused)))
364
    istate_t *istate __attribute__((unused)))
361
{
365
{
362
    int i;
366
    int i;
363
 
367
 
364
    spinlock_lock(&bkpoint_lock);
368
    spinlock_lock(&bkpoint_lock);
365
    for (i = 0; i < BKPOINTS_MAX; i++)
369
    for (i = 0; i < BKPOINTS_MAX; i++)
Line 371... Line 375...
371
/** Initialize debugger */
375
/** Initialize debugger */
372
void debugger_init()
376
void debugger_init()
373
{
377
{
374
    int i;
378
    int i;
375
 
379
 
376
    for (i=0; i<BKPOINTS_MAX; i++)
380
    for (i = 0; i < BKPOINTS_MAX; i++)
377
        breakpoints[i].address = NULL;
381
        breakpoints[i].address = NULL;
378
   
382
   
379
    cmd_initialize(&bkpts_info);
383
    cmd_initialize(&bkpts_info);
380
    if (!cmd_register(&bkpts_info))
384
    if (!cmd_register(&bkpts_info))
381
        panic("could not register command %s\n", bkpts_info.name);
385
        panic("could not register command %s\n", bkpts_info.name);
Line 392... Line 396...
392
    cmd_initialize(&addwatchp_info);
396
    cmd_initialize(&addwatchp_info);
393
    if (!cmd_register(&addwatchp_info))
397
    if (!cmd_register(&addwatchp_info))
394
        panic("could not register command %s\n", addwatchp_info.name);
398
        panic("could not register command %s\n", addwatchp_info.name);
395
#endif
399
#endif
396
   
400
   
397
    exc_register(VECTOR_DEBUG, "debugger",
401
    exc_register(VECTOR_DEBUG, "debugger", debug_exception);
398
             debug_exception);
-
 
399
#ifdef CONFIG_SMP
402
#ifdef CONFIG_SMP
400
    exc_register(VECTOR_DEBUG_IPI, "debugger_smp",
403
    exc_register(VECTOR_DEBUG_IPI, "debugger_smp", debug_ipi);
401
             debug_ipi);
-
 
402
#endif
404
#endif
403
}
405
}
404
 
406
 
405
/** @}
407
/** @}
406
 */
408
 */