Пример #1
0
void mon_breakpoint_delete_checkpoint(int brknum)
{
    int i;
    breakpoint_t *bp = NULL;
    MEMSPACE mem;

    if (brknum == -1) {
        /* Add user confirmation here. */
        mon_out("Deleting all breakpoints\n");
        for (i = 1; i < breakpoint_count; i++) {
            bp = find_checkpoint(i);
            if (bp)
                mon_breakpoint_delete_checkpoint(i);
        }
    }
    else if (!(bp = find_checkpoint(brknum))) {
        mon_out("#%d not a valid breakpoint\n", brknum);
        return;
    } else {
        mem = addr_memspace(bp->start_addr);

        if (!(bp->watch_load) && !(bp->watch_store)) {
            remove_checkpoint_from_list(&(breakpoints[mem]), bp);

            if (!any_breakpoints(mem)) {
                monitor_mask[mem] &= ~MI_BREAK;
                if (!monitor_mask[mem])
                    interrupt_monitor_trap_off(mon_interfaces[mem]->int_status);            }
        } else {
            if (bp->watch_load)
                remove_checkpoint_from_list(&(watchpoints_load[mem]), bp);
            if (bp->watch_store)
                remove_checkpoint_from_list(&(watchpoints_store[mem]), bp);

            if (!any_watchpoints(mem)) {
                monitor_mask[mem] &= ~MI_WATCH;
                mon_interfaces[mem]->toggle_watchpoints_func(0,
                    mon_interfaces[mem]->context);

                if (!monitor_mask[mem])
                    interrupt_monitor_trap_off(mon_interfaces[mem]->int_status);            }
        }
    }
    if (bp != NULL) {
        mon_delete_conditional(bp->condition);
        if (bp->command)
            lib_free(bp->command);
    }
}
Пример #2
0
static void update_checkpoint_state(MEMSPACE mem)
{
    if (watchpoints_load[mem] != NULL || watchpoints_store[mem] != NULL) {
        monitor_mask[mem] |= MI_WATCH;
        mon_interfaces[mem]->toggle_watchpoints_func(
                1, mon_interfaces[mem]->context);
    } else {
        monitor_mask[mem] &= ~MI_WATCH;
        mon_interfaces[mem]->toggle_watchpoints_func(
                0, mon_interfaces[mem]->context);
    }

    if (breakpoints[mem] != NULL) {
        monitor_mask[mem] |= MI_BREAK;
    } else {
        monitor_mask[mem] &= ~MI_BREAK;
    }

    if (monitor_mask[mem]) {
        interrupt_monitor_trap_on(mon_interfaces[mem]->int_status);
    } else {
        interrupt_monitor_trap_off(mon_interfaces[mem]->int_status);
    }
}