MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / check_breakpoint

Function check_breakpoint

src/debug.cpp:8130–8226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8128}
8129
8130static bool check_breakpoint(struct breakpoint_node *bpn, uaecptr pc)
8131{
8132 int bpnum = -1;
8133
8134 if (!bpn->enabled) {
8135 return false;
8136 }
8137 if (bpn->type == BREAKPOINT_REG_PC) {
8138 if (bpn->value1 == pc) {
8139 return true;
8140 }
8141 } else if (bpn->type >= 0 && bpn->type < BREAKPOINT_REG_END) {
8142 uae_u32 value1 = bpn->value1 & bpn->mask;
8143 uae_u32 value2 = bpn->value2 & bpn->mask;
8144 uae_u32 cval = returnregx(bpn->type) & bpn->mask;
8145 int opersize = bpn->mask == 0xff ? 1 : (bpn->mask == 0xffff) ? 2 : 4;
8146 bool opersigned = bpn->opersigned;
8147 uae_s32 value1s = (uae_s32)value1;
8148 uae_s32 value2s = (uae_s32)value2;
8149 uae_s32 cvals = (uae_s32)cval;
8150 if (opersize == 2) {
8151 cvals = (uae_s32)(uae_s16)cvals;
8152 value1s = (uae_s32)(uae_s16)value1s;
8153 value2s = (uae_s32)(uae_s16)value2s;
8154 } else if (opersize == 1) {
8155 cvals = (uae_s32)(uae_s8)cvals;
8156 value1s = (uae_s32)(uae_s8)value1s;
8157 value2s = (uae_s32)(uae_s8)value2s;
8158 }
8159 switch (bpn->oper)
8160 {
8161 case BREAKPOINT_CMP_EQUAL:
8162 if (cval == value1)
8163 return true;
8164 break;
8165 case BREAKPOINT_CMP_NEQUAL:
8166 if (cval != value1)
8167 return true;
8168 break;
8169 case BREAKPOINT_CMP_SMALLER:
8170 if (opersigned) {
8171 if (cvals < value1s)
8172 return true;
8173 } else {
8174 if (cval < value1)
8175 return true;
8176 }
8177 break;
8178 case BREAKPOINT_CMP_LARGER:
8179 if (opersigned) {
8180 if (cvals > value1s)
8181 return true;
8182 } else {
8183 if (cval > value1)
8184 return true;
8185 }
8186 break;
8187 case BREAKPOINT_CMP_SMALLER_EQUAL:

Callers 1

debugFunction · 0.85

Calls 1

returnregxFunction · 0.85

Tested by

no test coverage detected