* arm-tdep.c (thumb_get_next_pc_raw): Correctly detect TBH
authorRichard Earnshaw <richard.earnshaw@arm.com>
Wed, 31 Mar 2010 22:10:07 +0000 (22:10 +0000)
committerRichard Earnshaw <richard.earnshaw@arm.com>
Wed, 31 Mar 2010 22:10:07 +0000 (22:10 +0000)
instructions.  Use the PC+4 if the base of the TBB or TBH is the
PC register.

gdb/ChangeLog
gdb/arm-tdep.c

index a83755e46a64052e913178ad7095c348e70e2271..58b54dd516d8b5cabab27ed20583c6211645d404 100644 (file)
@@ -1,3 +1,9 @@
+2010-03-31  Richard Earnshaw  <rearnsha@arm.com>
+
+       * arm-tdep.c (thumb_get_next_pc_raw): Correctly detect TBH
+       instructions.  Use the PC+4 if the base of the TBB or TBH is the 
+       PC register.
+
 2010-03-31  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Fix crash on reading wrong function declaration DWARF.
@@ -14,7 +20,8 @@
 
 2010-03-31  Pierre Muller  <muller@ics.u-strasbg.fr>
 
-       * src/gdb/remote.c (end_thread): ARI fix: Use xstrdup instead of strdup.
+       * src/gdb/remote.c (end_thread): ARI fix: Use xstrdup instead of
+       strdup.
 
 2010-03-30  Keith Seitz  <keiths@redhat.com>
 
index f6a84367a1b0c65faa5ed91a47edc37a35bcb690..d4248f903165ce00a459c26ac3ca379e204aa763 100644 (file)
@@ -2959,19 +2959,29 @@ thumb_get_next_pc_raw (struct frame_info *frame, CORE_ADDR pc, int insert_bkpt)
       else if ((inst1 & 0xfff0) == 0xe8d0 && (inst2 & 0xfff0) == 0xf000)
        {
          /* TBB.  */
-         CORE_ADDR table, offset, length;
+         CORE_ADDR tbl_reg, table, offset, length;
+
+         tbl_reg = bits (inst1, 0, 3);
+         if (tbl_reg == 0x0f)
+           table = pc + 4;  /* Regcache copy of PC isn't right yet.  */
+         else
+           table = get_frame_register_unsigned (frame, tbl_reg);
 
-         table = get_frame_register_unsigned (frame, bits (inst1, 0, 3));
          offset = get_frame_register_unsigned (frame, bits (inst2, 0, 3));
          length = 2 * get_frame_memory_unsigned (frame, table + offset, 1);
          nextpc = pc_val + length;
        }
-      else if ((inst1 & 0xfff0) == 0xe8d0 && (inst2 & 0xfff0) == 0xf000)
+      else if ((inst1 & 0xfff0) == 0xe8d0 && (inst2 & 0xfff0) == 0xf010)
        {
          /* TBH.  */
-         CORE_ADDR table, offset, length;
+         CORE_ADDR tbl_reg, table, offset, length;
+
+         tbl_reg = bits (inst1, 0, 3);
+         if (tbl_reg == 0x0f)
+           table = pc + 4;  /* Regcache copy of PC isn't right yet.  */
+         else
+           table = get_frame_register_unsigned (frame, tbl_reg);
 
-         table = get_frame_register_unsigned (frame, bits (inst1, 0, 3));
          offset = 2 * get_frame_register_unsigned (frame, bits (inst2, 0, 3));
          length = 2 * get_frame_memory_unsigned (frame, table + offset, 2);
          nextpc = pc_val + length;
This page took 0.029662 seconds and 4 git commands to generate.