Exemplo n.º 1
0
static 
int breakpoint_add_checkpoint(MON_ADDR start_addr, MON_ADDR end_addr,
                                  bool is_trace, bool is_load, bool is_store,
                                  bool is_temp, bool do_print)
{
    breakpoint_t *new_bp;
    MEMSPACE mem;
    long len;

    len = mon_evaluate_address_range(&start_addr, &end_addr, FALSE, 0);
    new_bp = (breakpoint_t *)lib_malloc(sizeof(breakpoint_t));

    new_bp->brknum = breakpoint_count++;
    new_bp->start_addr = start_addr;
    new_bp->end_addr = end_addr;
    new_bp->trace = is_trace;
    new_bp->enabled = e_ON;
    new_bp->hit_count = 0;
    new_bp->ignore_count = 0;
    new_bp->condition = NULL;
    new_bp->command = NULL;
    new_bp->watch_load = is_load;
    new_bp->watch_store = is_store;
    new_bp->temporary = is_temp;

    mem = addr_memspace(start_addr);
    if (!is_load && !is_store) {
        if (!any_breakpoints(mem)) {
            monitor_mask[mem] |= MI_BREAK;
            interrupt_monitor_trap_on(mon_interfaces[mem]->int_status);
        }

        add_to_checkpoint_list(&(breakpoints[mem]), new_bp);
    } else {
        if (!any_watchpoints(mem)) {
            monitor_mask[mem] |= MI_WATCH;
            mon_interfaces[mem]->toggle_watchpoints_func(1,
                mon_interfaces[mem]->context);
            interrupt_monitor_trap_on(mon_interfaces[mem]->int_status);
        }

        if (is_load)
            add_to_checkpoint_list(&(watchpoints_load[mem]), new_bp);
        if (is_store)
            add_to_checkpoint_list(&(watchpoints_store[mem]), new_bp);
    }

    if (is_temp)
        exit_mon = 1;

    if (do_print)
        print_checkpoint_info(new_bp);

    return new_bp->brknum;
}
Exemplo n.º 2
0
static
int breakpoint_add_checkpoint(MON_ADDR start_addr, MON_ADDR end_addr,
                              bool stop, MEMORY_OP memory_op,
                              bool is_temp, bool do_print)
{
    checkpoint_t *new_cp;
    MEMSPACE mem;

    mon_evaluate_address_range(&start_addr, &end_addr, FALSE, 0);
    new_cp = lib_malloc(sizeof(checkpoint_t));

    new_cp->checknum = breakpoint_count++;
    new_cp->start_addr = start_addr;
    new_cp->end_addr = end_addr;
    new_cp->stop = stop;
    new_cp->enabled = e_ON;
    new_cp->hit_count = 0;
    new_cp->ignore_count = 0;
    new_cp->condition = NULL;
    new_cp->command = NULL;
    new_cp->check_load = memory_op & e_load;
    new_cp->check_store = memory_op & e_store;
    new_cp->check_exec = memory_op & e_exec;
    new_cp->temporary = is_temp;

    mem = addr_memspace(start_addr);
    if (new_cp->check_exec) {
        add_to_checkpoint_list(&(breakpoints[mem]), new_cp);
    }
    if (new_cp->check_load) {
        add_to_checkpoint_list(&(watchpoints_load[mem]), new_cp);
    }
    if (new_cp->check_store) {
        add_to_checkpoint_list(&(watchpoints_store[mem]), new_cp);
    }

    update_checkpoint_state(mem);

    if (is_temp) {
        exit_mon = 1;
    }

    if (do_print) {
        print_checkpoint_info(new_cp);
    }

    return new_cp->checknum;
}