Ejemplo n.º 1
0
void tryWatchpoint(DbgDeviceType devType, int address, UInt8 value, void* ref, WatchpointReadMemCallback callback) {
    Watchpoint* watchpoint = watchpoints[devType];
    while (watchpoint != NULL) {
        if (address >= watchpoint->address && address < watchpoint->address + watchpoint->size) {
            UInt32 checkValue = 0;
            int breakpointHit = 0;
            if (watchpoint->size == 1) {
                checkValue = value;
            }
            else {
                int i;
                for (i = 0; i < watchpoint->size; i++) {
                    checkValue <<= 8;
                    if (callback) {
                        checkValue |= callback(ref, watchpoint->address + i);
                    }
                    else if (watchpoint->address + i == address) {
                        checkValue |= value;
                    }
                }
            }
            switch (watchpoint->condition) {
            case DBGWP_ANY:
                breakpointHit = 1;
                break;
            case DBGWP_EQUALS:
                breakpointHit = checkValue == watchpoint->refValue;
                break;
            case DBGWP_NOT_EQUALS:
                breakpointHit = checkValue != watchpoint->refValue;
                break;
            case DBGWP_GREATER_THAN:
                breakpointHit = checkValue > watchpoint->refValue;
                break;
            case DBGWP_LESS_THAN:
                breakpointHit = checkValue < watchpoint->refValue;
                break;
            }
            if (breakpointHit) {
                boardOnBreakpoint(0);
                return;
            }
        }
        watchpoint = watchpoint->next;
    }
}
Ejemplo n.º 2
0
static void breakpointCb(R800Debug* dbg, UInt16 pc)
{
    boardOnBreakpoint(pc);
}