2011-02-18 Yao Qi <yao@codesourcery.com>
authorYao Qi <yao@codesourcery.com>
Fri, 18 Feb 2011 05:01:54 +0000 (05:01 +0000)
committerYao Qi <yao@codesourcery.com>
Fri, 18 Feb 2011 05:01:54 +0000 (05:01 +0000)
* gdb/arm-tdep.c (arm_displaced_step_copy_insn): Move code to ...
(arm_process_displaced_insn): .. here. Remove parameter INSN.
(thumb_process_displaced_insn): New.
* gdb/arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Update
call to arm_process_displaced_insn.
* gdb/arm-tdep.h : Update declaration of arm_process_displaced_insn.

gdb/ChangeLog
gdb/arm-linux-tdep.c
gdb/arm-tdep.c
gdb/arm-tdep.h

index 42f77a8085e65b66e420ab64944cce60ab5b275c..c349212a3c23763808bd0184e2ea6d85c8d458f1 100644 (file)
@@ -1,3 +1,12 @@
+2011-02-18  Yao Qi  <yao@codesourcery.com>
+
+       * gdb/arm-tdep.c (arm_displaced_step_copy_insn): Move code to ...
+       (arm_process_displaced_insn): .. here. Remove parameter INSN.
+       (thumb_process_displaced_insn): New.
+       * gdb/arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Update
+       call to arm_process_displaced_insn.
+       * gdb/arm-tdep.h : Update declaration of arm_process_displaced_insn.
+
 2011-02-17  Tom Tromey  <tromey@redhat.com>
 
        * dwarf2loc.h (dwarf2_compile_expr_to_ax): Declare.
index 75b1a8d529a65575a74523a1acf1238e76731c2a..ff649d60ddba4afd5de248d0028d78b666cdc197 100644 (file)
@@ -913,18 +913,10 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
     }
   else
     {
-      enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-      uint32_t insn = read_memory_unsigned_integer (from, 4, byte_order);
-
-      if (debug_displaced)
-       fprintf_unfiltered (gdb_stdlog, "displaced: stepping insn %.8lx "
-                           "at %.8lx\n", (unsigned long) insn,
-                           (unsigned long) from);
-
       /* Override the default handling of SVC instructions.  */
       dsc->u.svc.copy_svc_os = arm_linux_copy_svc;
 
-      arm_process_displaced_insn (gdbarch, insn, from, to, regs, dsc);
+      arm_process_displaced_insn (gdbarch, from, to, regs, dsc);
     }
 
   arm_displaced_init_closure (gdbarch, from, to, dsc);
index 96061e37d9fe4637addd6ec1041f205ea2ec3354..16334bf789c838750f311b376173681f1f4ff9b2 100644 (file)
@@ -6833,16 +6833,22 @@ decode_svc_copro (struct gdbarch *gdbarch, uint32_t insn, CORE_ADDR to,
     return copy_undef (gdbarch, insn, dsc);  /* Possibly unreachable.  */
 }
 
+static void
+thumb_process_displaced_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+                             CORE_ADDR to, struct regcache *regs,
+                             struct displaced_step_closure *dsc)
+{
+  error (_("Displaced stepping is only supported in ARM mode"));
+}
+
 void
-arm_process_displaced_insn (struct gdbarch *gdbarch, uint32_t insn,
-                           CORE_ADDR from, CORE_ADDR to,
-                           struct regcache *regs,
+arm_process_displaced_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+                           CORE_ADDR to, struct regcache *regs,
                            struct displaced_step_closure *dsc)
 {
   int err = 0;
-
-  if (!displaced_in_arm_mode (regs))
-    error (_("Displaced stepping is only supported in ARM mode"));
+  enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
+  uint32_t insn;
 
   /* Most displaced instructions use a 1-instruction scratch space, so set this
      here and override below if/when necessary.  */
@@ -6852,6 +6858,15 @@ arm_process_displaced_insn (struct gdbarch *gdbarch, uint32_t insn,
   dsc->cleanup = NULL;
   dsc->wrote_to_pc = 0;
 
+  if (!displaced_in_arm_mode (regs))
+    return thumb_process_displaced_insn (gdbarch, from, to, regs, dsc);
+
+  insn = read_memory_unsigned_integer (from, 4, byte_order_for_code);
+  if (debug_displaced)
+    fprintf_unfiltered (gdb_stdlog, "displaced: stepping insn %.8lx "
+                       "at %.8lx\n", (unsigned long) insn,
+                       (unsigned long) from);
+
   if ((insn & 0xf0000000) == 0xf0000000)
     err = decode_unconditional (gdbarch, insn, regs, dsc);
   else switch (((insn & 0x10) >> 4) | ((insn & 0xe000000) >> 24))
@@ -6922,15 +6937,7 @@ arm_displaced_step_copy_insn (struct gdbarch *gdbarch,
 {
   struct displaced_step_closure *dsc
     = xmalloc (sizeof (struct displaced_step_closure));
-  enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
-  uint32_t insn = read_memory_unsigned_integer (from, 4, byte_order_for_code);
-
-  if (debug_displaced)
-    fprintf_unfiltered (gdb_stdlog, "displaced: stepping insn %.8lx "
-                       "at %.8lx\n", (unsigned long) insn,
-                       (unsigned long) from);
-
-  arm_process_displaced_insn (gdbarch, insn, from, to, regs, dsc);
+  arm_process_displaced_insn (gdbarch, from, to, regs, dsc);
   arm_displaced_init_closure (gdbarch, from, to, dsc);
 
   return dsc;
index 7abfcd7615d2ba9ff8454c48be71ad4167a27e9c..6e7eab9b447477cec96576025345baef873b469f 100644 (file)
@@ -284,9 +284,8 @@ enum pc_write_style
 };
 
 extern void
-  arm_process_displaced_insn (struct gdbarch *gdbarch, uint32_t insn,
-                             CORE_ADDR from, CORE_ADDR to,
-                             struct regcache *regs,
+  arm_process_displaced_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+                             CORE_ADDR to, struct regcache *regs,
                              struct displaced_step_closure *dsc);
 extern void
   arm_displaced_init_closure (struct gdbarch *gdbarch, CORE_ADDR from,
This page took 0.032734 seconds and 4 git commands to generate.