openocd: watchpoint check fix

If we halt in a watchpoint, we need to figure out, which one it was.
This will from now on be done by decoding the current instruction.

Change-Id: Ib62df0016c60044f2618af00e853b4373eb00bd7
This commit is contained in:
Lars Rademacher
2013-11-25 23:23:19 +01:00
parent e4ba517251
commit 5142ff650e

View File

@ -510,23 +510,23 @@ int main(int argc, char *argv[])
case DBG_REASON_WATCHPOINT: case DBG_REASON_WATCHPOINT:
{ {
// ToDo: Replace with calls of every current memory access // ToDo: Replace with calls of every current memory access
struct watchpoint *wp = getHaltingWatchpoint(); struct halt_condition halt;
if (!wp) { if (!getCurrentMemAccess(&halt)) {
// ToDo: Determine address by interpreting instruction and register contents
LOG << "FATAL ERROR: Can't determine memory-access address of halt cause" << endl; LOG << "FATAL ERROR: Can't determine memory-access address of halt cause" << endl;
exit(-1); exit(-1);
} }
int iswrite; int iswrite;
switch (wp->rw) { switch (halt.type) {
case WPT_READ: case HALT_TYPE_WP_READ:
iswrite = 0; iswrite = 0;
break; break;
case WPT_WRITE: case HALT_TYPE_WP_WRITE:
iswrite = 1; iswrite = 1;
break; break;
case WPT_ACCESS: case HALT_TYPE_WP_READWRITE:
// ToDo: Can't tell if read or write // ToDo: Can't tell if read or write
LOG << "We should not get a READWRITE halt!!!" << endl;
iswrite = 1; iswrite = 1;
break; break;
default: default:
@ -535,7 +535,7 @@ int main(int argc, char *argv[])
break; break;
} }
freeze_timers(); freeze_timers();
fail::simulator.onMemoryAccess(NULL, wp->address, wp->length, iswrite, pc); fail::simulator.onMemoryAccess(NULL, halt.address, 1, iswrite, pc);
unfreeze_timers(); unfreeze_timers();
} }
break; break;