[pushed] gdb: remove parameter of gdbarch_displaced_step_hw_singlestep

Simon Marchi simon.marchi@polymtl.ca
Thu Oct 29 22:05:24 GMT 2020


I noticed that the closure parameter of
gdbarch_displaced_step_hw_singlestep is never used by any
implementation of the method, so this patch removes it.

gdb/ChangeLog:

	* gdbarch.sh (displaced_step_hw_singlestep): Remove closure
	parameter.
	* aarch64-tdep.c (aarch64_displaced_step_hw_singlestep):
	Likewise.
	* aarch64-tdep.h (aarch64_displaced_step_hw_singlestep):
	Likewise.
	* arch-utils.c (default_displaced_step_hw_singlestep):
	Likewise.
	* arch-utils.h (default_displaced_step_hw_singlestep):
	Likewise.
	* rs6000-tdep.c (ppc_displaced_step_hw_singlestep):
	Likewise.
	* s390-tdep.c (s390_displaced_step_hw_singlestep):
	Likewise.
	* gdbarch.c: Re-generate.
	* gdbarch.h: Re-generate.
	* infrun.c (resume_1): Adjust.

Change-Id: I7354f0b22afc2692ebff0cd700a462db8f389fc1
---
 gdb/ChangeLog      | 20 ++++++++++++++++++++
 gdb/aarch64-tdep.c |  3 +--
 gdb/aarch64-tdep.h |  3 +--
 gdb/arch-utils.c   |  3 +--
 gdb/arch-utils.h   |  4 +---
 gdb/gdbarch.c      |  4 ++--
 gdb/gdbarch.h      |  4 ++--
 gdb/gdbarch.sh     |  2 +-
 gdb/infrun.c       |  6 +-----
 gdb/rs6000-tdep.c  |  3 +--
 gdb/s390-tdep.c    |  3 +--
 11 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fe585c4f531b..7dfea4e90585 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,23 @@
+2020-10-29  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* gdbarch.sh (displaced_step_hw_singlestep): Remove closure
+	parameter.
+	* aarch64-tdep.c (aarch64_displaced_step_hw_singlestep):
+	Likewise.
+	* aarch64-tdep.h (aarch64_displaced_step_hw_singlestep):
+	Likewise.
+	* arch-utils.c (default_displaced_step_hw_singlestep):
+	Likewise.
+	* arch-utils.h (default_displaced_step_hw_singlestep):
+	Likewise.
+	* rs6000-tdep.c (ppc_displaced_step_hw_singlestep):
+	Likewise.
+	* s390-tdep.c (s390_displaced_step_hw_singlestep):
+	Likewise.
+	* gdbarch.c: Re-generate.
+	* gdbarch.h: Re-generate.
+	* infrun.c (resume_1): Adjust.
+
 2020-10-29  Tom Tromey  <tom@tromey.com>
 
 	* progspace.c (program_space::~program_space): Don't call
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 73bfcf5448fe..639fe5903874 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -3270,8 +3270,7 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch,
 /* Implement the "displaced_step_hw_singlestep" gdbarch method.  */
 
 bool
-aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
-				      struct displaced_step_closure *closure)
+aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch)
 {
   return true;
 }
diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h
index 2f15758dbd54..bd7a6c602e0b 100644
--- a/gdb/aarch64-tdep.h
+++ b/gdb/aarch64-tdep.h
@@ -117,7 +117,6 @@ void aarch64_displaced_step_fixup (struct gdbarch *gdbarch,
 				   CORE_ADDR from, CORE_ADDR to,
 				   struct regcache *regs);
 
-bool aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
-					   displaced_step_closure *closure);
+bool aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch);
 
 #endif /* aarch64-tdep.h */
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 1f66e0384a0b..8d5fa3fc976d 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -39,8 +39,7 @@
 #include "dis-asm.h"
 
 bool
-default_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
-				      struct displaced_step_closure *closure)
+default_displaced_step_hw_singlestep (struct gdbarch *gdbarch)
 {
   return !gdbarch_software_single_step_p (gdbarch);
 }
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 418b5c169886..7eea838ac3de 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -75,9 +75,7 @@ struct bp_manipulation_endian
   BREAK_INSN_LITTLE, BREAK_INSN_BIG>
 
 /* Default implementation of gdbarch_displaced_hw_singlestep.  */
-extern bool
-  default_displaced_step_hw_singlestep (struct gdbarch *,
-					struct displaced_step_closure *);
+extern bool default_displaced_step_hw_singlestep (struct gdbarch *);
 
 /* Possible value for gdbarch_displaced_step_location:
    Place displaced instructions at the program's entry point,
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 285d9f9b46d4..45dae111f189 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -3987,13 +3987,13 @@ set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch,
 }
 
 bool
-gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, struct displaced_step_closure *closure)
+gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
   gdb_assert (gdbarch->displaced_step_hw_singlestep != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_hw_singlestep called\n");
-  return gdbarch->displaced_step_hw_singlestep (gdbarch, closure);
+  return gdbarch->displaced_step_hw_singlestep (gdbarch);
 }
 
 void
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index ae65f290fc84..8b1507b4ea8c 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1044,8 +1044,8 @@ extern void set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, gdbar
    The default implementation returns false on all targets that
    provide a gdbarch_software_single_step routine, and true otherwise. */
 
-typedef bool (gdbarch_displaced_step_hw_singlestep_ftype) (struct gdbarch *gdbarch, struct displaced_step_closure *closure);
-extern bool gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, struct displaced_step_closure *closure);
+typedef bool (gdbarch_displaced_step_hw_singlestep_ftype) (struct gdbarch *gdbarch);
+extern bool gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch);
 extern void set_gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep);
 
 /* Fix up the state resulting from successfully single-stepping a
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 5f1e2f9d9583..bff29c536c9d 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -794,7 +794,7 @@ M;displaced_step_closure_up;displaced_step_copy_insn;CORE_ADDR from, CORE_ADDR t
 #
 # The default implementation returns false on all targets that
 # provide a gdbarch_software_single_step routine, and true otherwise.
-m;bool;displaced_step_hw_singlestep;struct displaced_step_closure *closure;closure;;default_displaced_step_hw_singlestep;;0
+m;bool;displaced_step_hw_singlestep;void;;;default_displaced_step_hw_singlestep;;0
 
 # Fix up the state resulting from successfully single-stepping a
 # displaced instruction, to give the result we would have gotten from
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 5a6ff165802c..e8c8fc0a95b4 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2459,15 +2459,11 @@ resume_1 (enum gdb_signal sig)
 	}
       else if (prepared > 0)
 	{
-	  struct displaced_step_inferior_state *displaced;
-
 	  /* Update pc to reflect the new address from which we will
 	     execute instructions due to displaced stepping.  */
 	  pc = regcache_read_pc (get_thread_regcache (tp));
 
-	  displaced = get_displaced_stepping_state (tp->inf);
-	  step = gdbarch_displaced_step_hw_singlestep
-	    (gdbarch, displaced->step_closure.get ());
+	  step = gdbarch_displaced_step_hw_singlestep (gdbarch);
 	}
     }
 
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index d4d7781a790d..264d4e03e7fc 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -995,8 +995,7 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch,
 /* Always use hardware single-stepping to execute the
    displaced instruction.  */
 static bool
-ppc_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
-				  struct displaced_step_closure *closure)
+ppc_displaced_step_hw_singlestep (struct gdbarch *gdbarch)
 {
   return true;
 }
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 176f170cd811..d3b96ebb4945 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -587,8 +587,7 @@ s390_displaced_step_fixup (struct gdbarch *gdbarch,
 /* Implement displaced_step_hw_singlestep gdbarch method.  */
 
 static bool
-s390_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
-				   struct displaced_step_closure *closure)
+s390_displaced_step_hw_singlestep (struct gdbarch *gdbarch)
 {
   return true;
 }
-- 
2.29.1



More information about the Gdb-patches mailing list