This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[pushed] Remove simple_displaced_step_copy_insn


Nothing uses this function.  Remove it, and adjust comments referring to
it.

gdb/ChangeLog:

	* arch-utils.h (simple_displaced_step_copy_insn): Remove.
	* arch-utils.c (simple_displaced_step_copy_insn): Remove.
	* gdbarch.sh (displaced_step_copy_insn): Adjust comment.
	* gdbarch.h: Regenerate.
	* i386-linux-tdep.c (i386_linux_displaced_step_copy_insn):
	Adjust comment.
	* i386-tdep.c (i386_displaced_step_copy_insn): Adjust comment.
	(i386_displaced_step_fixup): Adjust comment.
	* rs6000-tdep.c (ppc_displaced_step_copy_insn): Adjust comment.
---
 gdb/ChangeLog         | 12 ++++++++++++
 gdb/arch-utils.c      | 21 ---------------------
 gdb/arch-utils.h      | 12 ------------
 gdb/gdbarch.h         |  4 ----
 gdb/gdbarch.sh        |  4 ----
 gdb/i386-linux-tdep.c |  6 +++---
 gdb/i386-tdep.c       |  6 ++----
 gdb/rs6000-tdep.c     |  3 +--
 8 files changed, 18 insertions(+), 50 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 65a3265..032d8d3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2017-10-12  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* arch-utils.h (simple_displaced_step_copy_insn): Remove.
+	* arch-utils.c (simple_displaced_step_copy_insn): Remove.
+	* gdbarch.sh (displaced_step_copy_insn): Adjust comment.
+	* gdbarch.h: Regenerate.
+	* i386-linux-tdep.c (i386_linux_displaced_step_copy_insn):
+	Adjust comment.
+	* i386-tdep.c (i386_displaced_step_copy_insn): Adjust comment.
+	(i386_displaced_step_fixup): Adjust comment.
+	* rs6000-tdep.c (ppc_displaced_step_copy_insn): Adjust comment.
+
 2017-10-12  Tom Tromey  <tom@tromey.com>
 
 	* prologue-value.h (pv_area::store_would_trash): Return bool.
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 02ffd6b..6bdcc01 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -39,27 +39,6 @@
 
 #include "dis-asm.h"
 
-struct displaced_step_closure *
-simple_displaced_step_copy_insn (struct gdbarch *gdbarch,
-                                 CORE_ADDR from, CORE_ADDR to,
-                                 struct regcache *regs)
-{
-  size_t len = gdbarch_max_insn_length (gdbarch);
-  gdb_byte *buf = (gdb_byte *) xmalloc (len);
-
-  read_memory (from, buf, len);
-  write_memory (to, buf, len);
-
-  if (debug_displaced)
-    {
-      fprintf_unfiltered (gdb_stdlog, "displaced: copy %s->%s: ",
-                          paddress (gdbarch, from), paddress (gdbarch, to));
-      displaced_step_dump_bytes (gdb_stdlog, buf, len);
-    }
-
-  return (struct displaced_step_closure *) buf;
-}
-
 int
 default_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
 				      struct displaced_step_closure *closure)
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index fa29086..6d3c362 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -73,18 +73,6 @@ struct bp_manipulation_endian
   bp_manipulation_endian<sizeof (BREAK_INSN_LITTLE),		  \
   BREAK_INSN_LITTLE, BREAK_INSN_BIG>
 
-/* An implementation of gdbarch_displaced_step_copy_insn for
-   processors that don't need to modify the instruction before
-   single-stepping the displaced copy.
-
-   Simply copy gdbarch_max_insn_length (ARCH) bytes from FROM to TO.
-   The closure is an array of that many bytes containing the
-   instruction's bytes, allocated with xmalloc.  */
-extern struct displaced_step_closure *
-  simple_displaced_step_copy_insn (struct gdbarch *gdbarch,
-                                   CORE_ADDR from, CORE_ADDR to,
-                                   struct regcache *regs);
-
 /* Default implementation of gdbarch_displaced_hw_singlestep.  */
 extern int
   default_displaced_step_hw_singlestep (struct gdbarch *,
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index f276d09..d2e6b6f 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -984,10 +984,6 @@ extern void set_gdbarch_max_insn_length (struct gdbarch *gdbarch, ULONGEST max_i
    If you do not provide this function, GDB assumes that the
    architecture does not support displaced stepping.
   
-   If your architecture doesn't need to adjust instructions before
-   single-stepping them, consider using simple_displaced_step_copy_insn
-   here.
-  
    If the instruction cannot execute out of line, return NULL.  The
    core falls back to stepping past the instruction in-line instead in
    that case. */
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index ea15c8c..6459b12 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -793,10 +793,6 @@ V;ULONGEST;max_insn_length;;;0;0
 # If you do not provide this function, GDB assumes that the
 # architecture does not support displaced stepping.
 #
-# If your architecture doesn't need to adjust instructions before
-# single-stepping them, consider using simple_displaced_step_copy_insn
-# here.
-#
 # If the instruction cannot execute out of line, return NULL.  The
 # core falls back to stepping past the instruction in-line instead in
 # that case.
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 87a9598..8cec675 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -803,13 +803,13 @@ i386_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
 				     struct regcache *regs)
 {
   struct displaced_step_closure *closure;
-  
+
   closure = i386_displaced_step_copy_insn (gdbarch, from, to, regs);
 
   if (i386_linux_get_syscall_number_from_regcache (regs) != -1)
     {
-      /* Since we use simple_displaced_step_copy_insn, our closure is a
-	 copy of the instruction.  */
+      /* The closure returned by i386_displaced_step_copy_insn is simply a
+         buffer with a copy of the instruction. */
       gdb_byte *insn = (gdb_byte *) closure;
 
       /* Fake nop.  */
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 9eb1192..46e5e32 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -794,8 +794,7 @@ i386_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
   return i386_jmp_p (insn);
 }
 
-/* Some kernels may run one past a syscall insn, so we have to cope.
-   Otherwise this is just simple_displaced_step_copy_insn.  */
+/* Some kernels may run one past a syscall insn, so we have to cope.  */
 
 struct displaced_step_closure *
 i386_displaced_step_copy_insn (struct gdbarch *gdbarch,
@@ -848,8 +847,7 @@ i386_displaced_step_fixup (struct gdbarch *gdbarch,
      applying it.  */
   ULONGEST insn_offset = to - from;
 
-  /* Since we use simple_displaced_step_copy_insn, our closure is a
-     copy of the instruction.  */
+  /* Our closure is a copy of the instruction.  */
   gdb_byte *insn = (gdb_byte *) closure;
   /* The start of the insn, needed in case we see some prefixes.  */
   gdb_byte *insn_start = insn;
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 92395ad..df1a84d 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -1014,8 +1014,7 @@ typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint)
 					 || (insn & STORE_CONDITIONAL_MASK) == STHCX_INSTRUCTION \
 					 || (insn & STORE_CONDITIONAL_MASK) == STQCX_INSTRUCTION)
 
-/* We can't displaced step atomic sequences.  Otherwise this is just
-   like simple_displaced_step_copy_insn.  */
+/* We can't displaced step atomic sequences.  */
 
 static struct displaced_step_closure *
 ppc_displaced_step_copy_insn (struct gdbarch *gdbarch,
-- 
2.7.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]