From 9f334a02bd83fa614769bfafe0d6eb077e4f1f28 Mon Sep 17 00:00:00 2001 From: Lars Rademacher Date: Tue, 31 Dec 2013 16:12:37 +0100 Subject: [PATCH] openocd: arm read pc -> offset of 8 On ARM we need to add a offset to the pc, if we read it (ARM ARM (DDI 0100I) page A2-9). This fixes bugs in memory trace generation and watchpoint recognition. Change-Id: I1cfcb84af2abae7971869d2ce29d602648e2f020 --- debuggers/openocd/openocd_wrapper.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/debuggers/openocd/openocd_wrapper.cc b/debuggers/openocd/openocd_wrapper.cc index 9933aa4f..5c06658f 100644 --- a/debuggers/openocd/openocd_wrapper.cc +++ b/debuggers/openocd/openocd_wrapper.cc @@ -442,6 +442,7 @@ int main(int argc, char *argv[]) continue; } oocdw_read_reg(i, &(regs.r[i])); + regs.r[15] += 8; } // ABT SPSR is usr cpsr @@ -1280,6 +1281,9 @@ static bool getMemAccess(uint32_t opcode, struct halt_condition *access) { for (int i = 0; i < 16; i++) { if ((1 << i) & op.regs_r) { oocdw_read_reg(i, &(regs.r[i])); + if (i == 15) { + regs.r[15] += 8; + } } if ((i >= 10) && ((1 << i) & op.regs_r_fiq)) { oocdw_read_reg(i - 10 + fail::RI_R10_FIQ, &(regs.r[i]));