Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2942 → Rev 2943

/branches/tracing/uspace/app/debug/arch/ia32/src/ia32.c
45,6 → 45,8
 
#define OPCODE_INT3 0xCC
 
static breakpoint_t *lifted_brkpt;
 
void arch_breakpoint_add(uintptr_t addr)
{
char brkp[1];
53,7 → 55,7
int i;
 
brk = NULL;
for (i = 0; i < MAX_BRKPTS; i++)
for (i = 1; i < MAX_BRKPTS; i++)
if (brk_list[i].set == 0) { brk = brk_list+i; break; }
 
if (!brk) {
69,10 → 71,42
 
brk->addr = addr;
brk->set = 1;
 
cons_printf("Added breakpoint %d\n", i);
}
 
static breakpoint_t *lifted_brkpt;
void arch_breakpoint_remove(int id)
{
int rc;
 
if (id < 1 || id >= MAX_BRKPTS || brk_list[id].set == 0) {
cons_printf("No such breakpoint\n");
return;
}
 
if (lifted_brkpt == &brk_list[id]) {
lifted_brkpt = NULL;
} else {
rc = udebug_mem_write(app_phone, &brk_list[id].arch.back, brk_list[id].addr, 1);
if (rc < 0) { printf("error writing mem\n"); return; }
}
 
brk_list[id].set = 0;
 
cons_printf("Breakpoint removed\n");
}
 
void arch_breakpoint_list(void)
{
int i;
 
for (i = 0; i < MAX_BRKPTS; ++i) {
if (brk_list[i].set != 0) {
printf("Breakpoint %d at 0x%lx\n", i, brk_list[i].addr);
}
}
}
 
void arch_event_breakpoint(thash_t thread_hash)
{
static istate_t istate;
161,7 → 195,7
if (rc < 0) { printf("regs read failed\n"); return; }
 
if (enable) istate.eflags |= 0x0100; /* trap flag */
else istate.eflags &= ~0x0100; /* trap flag */
else if (!lifted_brkpt) istate.eflags &= ~0x0100; /* trap flag */
 
rc = udebug_regs_write(app_phone, dt->hash, &istate);
if (rc < 0) { printf("regs write failed\n"); return; }