From 2b16b2e33b3b4c5c0e1563de1ab761be73006be4 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Sun, 18 Sep 2011 14:18:07 +0000 Subject: [PATCH] gdb/ * arm-tdep.c (install_copro_load_store): PC is set 4-byte aligned. (install_b_bl_blx): Likewise. --- gdb/ChangeLog | 5 +++++ gdb/arm-tdep.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3970ce359a3..06d53013205 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2011-09-18 Yao Qi + + * arm-tdep.c (install_copro_load_store): PC is set 4-byte aligned. + (install_b_bl_blx): Likewise. + 2011-09-17 Yao Qi * arm-tdep.c (install_ldr_str_ldrb_strb): Renamed to ... diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index d5e5dacbebf..fc321cbb565 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -5475,6 +5475,8 @@ install_copro_load_store (struct gdbarch *gdbarch, struct regcache *regs, dsc->tmp[0] = displaced_read_reg (regs, dsc, 0); rn_val = displaced_read_reg (regs, dsc, rn); + /* PC should be 4-byte aligned. */ + rn_val = rn_val & 0xfffffffc; displaced_write_reg (regs, dsc, 0, rn_val, CANNOT_WRITE_PC); dsc->u.ldst.writeback = writeback; @@ -5555,10 +5557,15 @@ install_b_bl_blx (struct gdbarch *gdbarch, struct regcache *regs, dsc->u.branch.link = link; dsc->u.branch.exchange = exchange; + dsc->u.branch.dest = dsc->insn_addr; + if (link && exchange) + /* For BLX, offset is computed from the Align (PC, 4). */ + dsc->u.branch.dest = dsc->u.branch.dest & 0xfffffffc; + if (dsc->is_thumb) - dsc->u.branch.dest = dsc->insn_addr + 4 + offset; + dsc->u.branch.dest += 4 + offset; else - dsc->u.branch.dest = dsc->insn_addr + 8 + offset; + dsc->u.branch.dest += 8 + offset; dsc->cleanup = &cleanup_branch; } -- 2.30.2