aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2004-03-07 20:03:12 +0000
committerDaniel Jacobowitz <drow@false.org>2004-03-07 20:03:12 +0000
commit9498281f9ac77f52e3c11bd5baa40ff2119f9e14 (patch)
tree13c2341d8d6bf0c8f018929e2beeda60faa3fd37 /gdb
parenteded0a31481c23b39d1df660e600ff68aa5a53e8 (diff)
downloadgdb-9498281f9ac77f52e3c11bd5baa40ff2119f9e14.zip
gdb-9498281f9ac77f52e3c11bd5baa40ff2119f9e14.tar.gz
gdb-9498281f9ac77f52e3c11bd5baa40ff2119f9e14.tar.bz2
* arm-tdep.c (thumb_get_next_pc): Handle BX.
(arm_get_next_pc): Handle BX and BLX.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/arm-tdep.c29
2 files changed, 34 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ded5f74..a6a7160 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2004-03-07 Daniel Jacobowitz <drow@mvista.com>
+
+ * arm-tdep.c (thumb_get_next_pc): Handle BX.
+ (arm_get_next_pc): Handle BX and BLX.
+
2004-03-07 Andrew Cagney <cagney@redhat.com>
* hppa-tdep.c: Replace DEPRECATED_FP_REGNUM with HPPA_FP_REGNUM,
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 9d53fac..06bfcb6 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -1657,6 +1657,17 @@ thumb_get_next_pc (CORE_ADDR pc)
offset = (sbits (inst1, 0, 10) << 12) + (bits (inst2, 0, 10) << 1);
nextpc = pc_val + offset;
}
+ else if ((inst1 & 0xff80) == 0x4700) /* branch and exchange (bx) */
+ {
+ if (bits (inst1, 3, 6) == 0x0f)
+ nextpc = pc_val;
+ else
+ nextpc = read_register (bits (inst1, 3, 6));
+
+ nextpc = ADDR_BITS_REMOVE (nextpc);
+ if (nextpc == pc)
+ error ("Infinite loop detected");
+ }
return nextpc;
}
@@ -1697,6 +1708,20 @@ arm_get_next_pc (CORE_ADDR pc)
&& bits (this_instr, 4, 7) == 9) /* multiply */
error ("Illegal update to pc in instruction");
+ /* BX <reg>, BLX <reg> */
+ if (bits (this_instr, 4, 28) == 0x12fff1
+ || bits (this_instr, 4, 28) == 0x12fff3)
+ {
+ rn = bits (this_instr, 0, 3);
+ result = (rn == 15) ? pc_val + 8 : read_register (rn);
+ nextpc = (CORE_ADDR) ADDR_BITS_REMOVE (result);
+
+ if (nextpc == pc)
+ error ("Infinite loop detected");
+
+ return nextpc;
+ }
+
/* Multiply into PC */
c = (status & FLAG_C) ? 1 : 0;
rn = bits (this_instr, 16, 19);
@@ -1862,6 +1887,10 @@ arm_get_next_pc (CORE_ADDR pc)
{
nextpc = BranchDest (pc, this_instr);
+ /* BLX */
+ if (bits (this_instr, 28, 31) == INST_NV)
+ nextpc |= bit (this_instr, 24) << 1;
+
nextpc = ADDR_BITS_REMOVE (nextpc);
if (nextpc == pc)
error ("Infinite loop detected");