aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2011-09-18 14:18:07 +0000
committerYao Qi <yao@codesourcery.com>2011-09-18 14:18:07 +0000
commit2b16b2e33b3b4c5c0e1563de1ab761be73006be4 (patch)
treea064295ff623af59d3d2afd72c5ea1fe4bdfd67b
parentab254057b844245b5db8d8faa397c1f69f48c889 (diff)
downloadgdb-2b16b2e33b3b4c5c0e1563de1ab761be73006be4.zip
gdb-2b16b2e33b3b4c5c0e1563de1ab761be73006be4.tar.gz
gdb-2b16b2e33b3b4c5c0e1563de1ab761be73006be4.tar.bz2
gdb/
* arm-tdep.c (install_copro_load_store): PC is set 4-byte aligned. (install_b_bl_blx): Likewise.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/arm-tdep.c11
2 files changed, 14 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3970ce3..06d5301 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2011-09-18 Yao Qi <yao@codesourcery.com>
+
+ * arm-tdep.c (install_copro_load_store): PC is set 4-byte aligned.
+ (install_b_bl_blx): Likewise.
+
2011-09-17 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (install_ldr_str_ldrb_strb): Renamed to ...
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index d5e5dac..fc321cb 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;
}