From 5142ff650eb3fad85b9079962d9843535bece11c Mon Sep 17 00:00:00 2001 From: Lars Rademacher Date: Mon, 25 Nov 2013 23:23:19 +0100 Subject: [PATCH] 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 --- debuggers/openocd/openocd_wrapper.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/debuggers/openocd/openocd_wrapper.cc b/debuggers/openocd/openocd_wrapper.cc index 13e84f74..9933aa4f 100644 --- a/debuggers/openocd/openocd_wrapper.cc +++ b/debuggers/openocd/openocd_wrapper.cc @@ -510,23 +510,23 @@ int main(int argc, char *argv[]) case DBG_REASON_WATCHPOINT: { // ToDo: Replace with calls of every current memory access - struct watchpoint *wp = getHaltingWatchpoint(); - if (!wp) { - // ToDo: Determine address by interpreting instruction and register contents + struct halt_condition halt; + if (!getCurrentMemAccess(&halt)) { LOG << "FATAL ERROR: Can't determine memory-access address of halt cause" << endl; exit(-1); } int iswrite; - switch (wp->rw) { - case WPT_READ: + switch (halt.type) { + case HALT_TYPE_WP_READ: iswrite = 0; break; - case WPT_WRITE: + case HALT_TYPE_WP_WRITE: iswrite = 1; break; - case WPT_ACCESS: + case HALT_TYPE_WP_READWRITE: // ToDo: Can't tell if read or write + LOG << "We should not get a READWRITE halt!!!" << endl; iswrite = 1; break; default: @@ -535,7 +535,7 @@ int main(int argc, char *argv[]) break; } freeze_timers(); - fail::simulator.onMemoryAccess(NULL, wp->address, wp->length, iswrite, pc); + fail::simulator.onMemoryAccess(NULL, halt.address, 1, iswrite, pc); unfreeze_timers(); } break;