public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb: Add a default_unwind_pc method for gdbarch
@ 2018-03-07 22:04 ` Andrew Burgess
  2018-03-08 22:32   ` Simon Marchi
                     ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-03-07 22:04 UTC (permalink / raw)
  To: gdb-patches; +Cc: Yao Qi, Andrew Burgess

As requested / suggested by Yao in this mail:

   https://sourceware.org/ml/gdb-patches/2018-03/msg00133.html

this patch provides a default implementation of unwind_pc and switches
over targets that I believe are "obviously" using the default strategy.

I've been pretty conservative about switching targets over, so targets
like arc that have some logging in place, but otherwise do the
standard thing, are left with their own unwind_pc method.

In frame.c I've removed the gdbarch_unwind_pc_p check (the predicate
is gone now) as it's assumed that all targets will have an
implementation either the default, or their own.  This function is
reindented, so it looks like a bigger change than it really is.

The problem with this patch is testing, there's been very little.  I
tested that every target I could build GDB for before still builds
after this patch, which covers all of the targets I touched, however,
I've done no functionality testing on the built GDBs.

Is there any interest in merging this patch?  I'm happy to run any
additional testing if I can be pointed to some instructions / hints
for what to do.

Thanks,
Andrew

--

Many architectures gdbarch unwind_pc method follow the same pattern.
Provide a default method and convert targets to use it where possible.

gdb/ChangeLog:

	* gdb/alpha-tdep.c (alpha_unwind_pc): Deleted.
	(alpha_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/bfin-tdep.c (bfin_unwind_pc): Deleted.
	(bfin_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/cris-tdep.c (cris_unwind_pc): Deleted.
	(cris_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* frame-unwind.c (default_unwind_pc): New function.
	* frame-unwind.h (default_unwind_pc): Declare new function.
	* frame.c: Remove use of gdbarch_unwind_pc_p and reindent.
	* gdb/frv-tdep.c (frv_unwind_pc): Deleted.
	(frv_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/ft32-tdep.c (ft32_unwind_pc): Deleted.
	(ft32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.
	* gdbarch.sh: Update unwind_pc spec, and add new header file to be
	included.
	* gdb/h8300-tdep.c (h8300_unwind_pc): Deleted.
	(h8300_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/iq2000-tdep.c (iq2000_unwind_pc): Deleted.
	(iq2000_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/lm32-tdep.c (lm32_unwind_pc): Deleted.
	(lm32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/m32r-tdep.c (m32r_unwind_pc): Deleted.
	(m32r_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/m68hc11-tdep.c (m68hc11_unwind_pc): Deleted.
	(m68hc11_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/mep-tdep.c (mep_unwind_pc): Deleted.
	(mep_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/mn10300-tdep.c (mn10300_unwind_pc): Deleted.
	(mn10300_frame_unwind_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/moxie-tdep.c (moxie_unwind_pc): Deleted.
	(moxie_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/msp430-tdep.c (msp430_unwind_pc): Deleted.
	(msp430_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/nds32-tdep.c (nds32_unwind_pc): Deleted.
	(nds32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/riscv-tdep.c (riscv_unwind_pc): Deleted.
	(riscv_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/rs6000-tdep.c (rs6000_unwind_pc): Deleted.
	(rs6000_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/rx-tdep.c (rx_unwind_pc): Deleted.
	(rx_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/score-tdep.c (score_unwind_pc): Deleted.
	(score_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/sh-tdep.c (sh_unwind_pc): Deleted.
	(sh_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/sh64-tdep.c (sh64_unwind_pc): Deleted.
	(sh64_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/tilegx-tdep.c (tilegx_unwind_pc): Deleted.
	(tilegx_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/v850-tdep.c (v850_unwind_pc): Deleted.
	(v850_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/vax-tdep.c (vax_unwind_pc): Deleted.
	(vax_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdb/xstormy16-tdep.c (xstormy16_unwind_pc): Deleted.
	(xstormy16_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
---
 gdb/ChangeLog        |  60 ++++++++++++++++++++++++++
 gdb/alpha-tdep.c     |  11 -----
 gdb/bfin-tdep.c      |   7 ---
 gdb/cris-tdep.c      |  13 ------
 gdb/frame-unwind.c   |   9 ++++
 gdb/frame-unwind.h   |   6 +++
 gdb/frame.c          | 117 ++++++++++++++++++++++++---------------------------
 gdb/frv-tdep.c       |   7 ---
 gdb/ft32-tdep.c      |  10 -----
 gdb/gdbarch.c        |  14 ++----
 gdb/gdbarch.h        |   2 -
 gdb/gdbarch.sh       |   3 +-
 gdb/h8300-tdep.c     |   7 ---
 gdb/iq2000-tdep.c    |   7 ---
 gdb/lm32-tdep.c      |   7 ---
 gdb/m32r-tdep.c      |  11 -----
 gdb/m68hc11-tdep.c   |  14 ------
 gdb/mep-tdep.c       |   9 ----
 gdb/mn10300-tdep.c   |  10 -----
 gdb/moxie-tdep.c     |  10 -----
 gdb/msp430-tdep.c    |   9 ----
 gdb/nds32-tdep.c     |   9 ----
 gdb/riscv-tdep.c     |   9 ----
 gdb/rs6000-tdep.c    |   9 ----
 gdb/rx-tdep.c        |  11 -----
 gdb/score-tdep.c     |   7 ---
 gdb/sh-tdep.c        |   8 ----
 gdb/sh64-tdep.c      |   8 ----
 gdb/tilegx-tdep.c    |   7 ---
 gdb/v850-tdep.c      |   8 ----
 gdb/vax-tdep.c       |   8 ----
 gdb/xstormy16-tdep.c |   7 ---
 32 files changed, 136 insertions(+), 298 deletions(-)

diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 52a46d96eaf..81ee43c9fa4 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -1479,14 +1479,6 @@ alpha_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
   return frame_id_build (base, get_frame_pc (this_frame));
 }
 
-static CORE_ADDR
-alpha_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST pc;
-  pc = frame_unwind_register_unsigned (next_frame, ALPHA_PC_REGNUM);
-  return pc;
-}
-
 \f
 /* Helper routines for alpha*-nat.c files to move register sets to and
    from core files.  The UNIQUE pointer is allowed to be NULL, as most
@@ -1813,9 +1805,6 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Methods for saving / extracting a dummy frame's ID.  */
   set_gdbarch_dummy_id (gdbarch, alpha_dummy_id);
 
-  /* Return the unwound PC value.  */
-  set_gdbarch_unwind_pc (gdbarch, alpha_unwind_pc);
-
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index 63fbf6209e2..696786dc1b0 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -766,12 +766,6 @@ bfin_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
   return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
-static CORE_ADDR
-bfin_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, BFIN_PC_REGNUM);
-}
-
 static CORE_ADDR
 bfin_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
 {
@@ -836,7 +830,6 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, bfin_sw_breakpoint_from_kind);
   set_gdbarch_decr_pc_after_break (gdbarch, 2);
   set_gdbarch_frame_args_skip (gdbarch, 8);
-  set_gdbarch_unwind_pc (gdbarch, bfin_unwind_pc);
   set_gdbarch_frame_align (gdbarch, bfin_frame_align);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 5fa79ef2cfa..74368b7b0a4 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -651,9 +651,6 @@ static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc,
 					struct frame_info *this_frame,
 					struct cris_unwind_cache *info);
 
-static CORE_ADDR cris_unwind_pc (struct gdbarch *gdbarch, 
-				 struct frame_info *next_frame);
-
 static CORE_ADDR cris_unwind_sp (struct gdbarch *gdbarch, 
 				 struct frame_info *next_frame);
 
@@ -1373,15 +1370,6 @@ cris_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return pc_after_prologue;
 }
 
-static CORE_ADDR
-cris_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST pc;
-  pc = frame_unwind_register_unsigned (next_frame,
-				       gdbarch_pc_regnum (gdbarch));
-  return pc;
-}
-
 static CORE_ADDR
 cris_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -4096,7 +4084,6 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_breakpoint_kind_from_pc (gdbarch, cris_breakpoint_kind_from_pc);
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, cris_sw_breakpoint_from_kind);
   
-  set_gdbarch_unwind_pc (gdbarch, cris_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
   set_gdbarch_dummy_id (gdbarch, cris_dummy_id);
 
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index e6e63539ad7..0eed572ebbb 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -193,6 +193,15 @@ default_frame_unwind_stop_reason (struct frame_info *this_frame,
     return UNWIND_NO_REASON;
 }
 
+/* Default unwind of the PC.  */
+
+CORE_ADDR
+default_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
+{
+  int pc_regnum = gdbarch_pc_regnum (gdbarch);
+  return frame_unwind_register_unsigned (next_frame, pc_regnum);
+}
+
 /* Helper functions for value-based register unwinding.  These return
    a (possibly lazy) value of the appropriate type.  */
 
diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h
index af220f72a01..4dfc7bedcc6 100644
--- a/gdb/frame-unwind.h
+++ b/gdb/frame-unwind.h
@@ -70,6 +70,12 @@ enum unwind_stop_reason
   default_frame_unwind_stop_reason (struct frame_info *this_frame,
 				    void **this_cache);
 
+/* A default unwind_pc callback that simply unwinds the register identified
+   by GDBARCH_PC_REGNUM.  */
+
+extern CORE_ADDR default_unwind_pc (struct gdbarch *gdbarch,
+				    struct frame_info *next_frame);
+
 /* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
    use THIS frame, and through it the NEXT frame's register unwind
    method, to determine the frame ID of THIS frame.
diff --git a/gdb/frame.c b/gdb/frame.c
index 0b04a4ebacb..340dc99d5af 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -856,76 +856,71 @@ frame_unwind_pc (struct frame_info *this_frame)
 {
   if (this_frame->prev_pc.status == CC_UNKNOWN)
     {
-      if (gdbarch_unwind_pc_p (frame_unwind_arch (this_frame)))
+      struct gdbarch *prev_gdbarch;
+      CORE_ADDR pc = 0;
+      int pc_p = 0;
+
+      /* The right way.  The `pure' way.  The one true way.  This
+	 method depends solely on the register-unwind code to
+	 determine the value of registers in THIS frame, and hence
+	 the value of this frame's PC (resume address).  A typical
+	 implementation is no more than:
+
+	 frame_unwind_register (this_frame, ISA_PC_REGNUM, buf);
+	 return extract_unsigned_integer (buf, size of ISA_PC_REGNUM);
+
+	 Note: this method is very heavily dependent on a correct
+	 register-unwind implementation, it pays to fix that
+	 method first; this method is frame type agnostic, since
+	 it only deals with register values, it works with any
+	 frame.  This is all in stark contrast to the old
+	 FRAME_SAVED_PC which would try to directly handle all the
+	 different ways that a PC could be unwound.  */
+      prev_gdbarch = frame_unwind_arch (this_frame);
+
+      TRY
 	{
-	  struct gdbarch *prev_gdbarch;
-	  CORE_ADDR pc = 0;
-	  int pc_p = 0;
-
-	  /* The right way.  The `pure' way.  The one true way.  This
-	     method depends solely on the register-unwind code to
-	     determine the value of registers in THIS frame, and hence
-	     the value of this frame's PC (resume address).  A typical
-	     implementation is no more than:
-	   
-	     frame_unwind_register (this_frame, ISA_PC_REGNUM, buf);
-	     return extract_unsigned_integer (buf, size of ISA_PC_REGNUM);
-
-	     Note: this method is very heavily dependent on a correct
-	     register-unwind implementation, it pays to fix that
-	     method first; this method is frame type agnostic, since
-	     it only deals with register values, it works with any
-	     frame.  This is all in stark contrast to the old
-	     FRAME_SAVED_PC which would try to directly handle all the
-	     different ways that a PC could be unwound.  */
-	  prev_gdbarch = frame_unwind_arch (this_frame);
-
-	  TRY
+	  pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
+	  pc_p = 1;
+	}
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  if (ex.error == NOT_AVAILABLE_ERROR)
 	    {
-	      pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
-	      pc_p = 1;
+	      this_frame->prev_pc.status = CC_UNAVAILABLE;
+
+	      if (frame_debug)
+		fprintf_unfiltered (gdb_stdlog,
+				    "{ frame_unwind_pc (this_frame=%d)"
+				    " -> <unavailable> }\n",
+				    this_frame->level);
 	    }
-	  CATCH (ex, RETURN_MASK_ERROR)
+	  else if (ex.error == OPTIMIZED_OUT_ERROR)
 	    {
-	      if (ex.error == NOT_AVAILABLE_ERROR)
-		{
-		  this_frame->prev_pc.status = CC_UNAVAILABLE;
-
-		  if (frame_debug)
-		    fprintf_unfiltered (gdb_stdlog,
-					"{ frame_unwind_pc (this_frame=%d)"
-					" -> <unavailable> }\n",
-					this_frame->level);
-		}
-	      else if (ex.error == OPTIMIZED_OUT_ERROR)
-		{
-		  this_frame->prev_pc.status = CC_NOT_SAVED;
-
-		  if (frame_debug)
-		    fprintf_unfiltered (gdb_stdlog,
-					"{ frame_unwind_pc (this_frame=%d)"
-					" -> <not saved> }\n",
-					this_frame->level);
-		}
-	      else
-		throw_exception (ex);
-	    }
-	  END_CATCH
+	      this_frame->prev_pc.status = CC_NOT_SAVED;
 
-	  if (pc_p)
-	    {
-	      this_frame->prev_pc.value = pc;
-	      this_frame->prev_pc.status = CC_VALUE;
 	      if (frame_debug)
 		fprintf_unfiltered (gdb_stdlog,
-				    "{ frame_unwind_pc (this_frame=%d) "
-				    "-> %s }\n",
-				    this_frame->level,
-				    hex_string (this_frame->prev_pc.value));
+				    "{ frame_unwind_pc (this_frame=%d)"
+				    " -> <not saved> }\n",
+				    this_frame->level);
 	    }
+	  else
+	    throw_exception (ex);
+	}
+      END_CATCH
+
+      if (pc_p)
+	{
+	  this_frame->prev_pc.value = pc;
+	  this_frame->prev_pc.status = CC_VALUE;
+	  if (frame_debug)
+	    fprintf_unfiltered (gdb_stdlog,
+				"{ frame_unwind_pc (this_frame=%d) "
+				"-> %s }\n",
+				this_frame->level,
+				hex_string (this_frame->prev_pc.value));
 	}
-      else
-	internal_error (__FILE__, __LINE__, _("No unwind_pc method"));
     }
 
   if (this_frame->prev_pc.status == CC_VALUE)
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 2f9a8d27c46..38f996d2e5c 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1366,12 +1366,6 @@ frv_return_value (struct gdbarch *gdbarch, struct value *function,
     return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-static CORE_ADDR
-frv_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, pc_regnum);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -1539,7 +1533,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_return_value (gdbarch, frv_return_value);
 
   /* Frame stuff.  */
-  set_gdbarch_unwind_pc (gdbarch, frv_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, frv_unwind_sp);
   set_gdbarch_frame_align (gdbarch, frv_frame_align);
   frame_base_set_default (gdbarch, &frv_frame_base);
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 7198b84aca0..5c0a3384dbd 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -492,14 +492,6 @@ ft32_frame_cache (struct frame_info *this_frame, void **this_cache)
   return cache;
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-ft32_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, FT32_PC_REGNUM);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -627,8 +619,6 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, ft32_dummy_id);
 
-  set_gdbarch_unwind_pc (gdbarch, ft32_unwind_pc);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index b8703e5a556..884b7b24f86 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -48,6 +48,7 @@
 #include "regcache.h"
 #include "objfiles.h"
 #include "auxv.h"
+#include "frame-unwind.h"
 
 /* Static function declarations */
 
@@ -426,6 +427,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
   gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
   gdbarch->remote_register_number = default_remote_register_number;
+  gdbarch->unwind_pc = default_unwind_pc;
   gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr;
   gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
   gdbarch->addr_bits_remove = core_addr_identity;
@@ -612,7 +614,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of remote_register_number, invalid_p == 0 */
   /* Skip verify of fetch_tls_load_module_address, has predicate.  */
   /* Skip verify of frame_args_skip, invalid_p == 0 */
-  /* Skip verify of unwind_pc, has predicate.  */
+  /* Skip verify of unwind_pc, invalid_p == 0 */
   /* Skip verify of unwind_sp, has predicate.  */
   /* Skip verify of frame_num_args, has predicate.  */
   /* Skip verify of frame_align, has predicate.  */
@@ -1435,9 +1437,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "gdbarch_dump: target_desc = %s\n",
                       host_address_to_string (gdbarch->target_desc));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n",
-                      gdbarch_unwind_pc_p (gdbarch));
   fprintf_unfiltered (file,
                       "gdbarch_dump: unwind_pc = <%s>\n",
                       host_address_to_string (gdbarch->unwind_pc));
@@ -3058,13 +3057,6 @@ set_gdbarch_frame_args_skip (struct gdbarch *gdbarch,
   gdbarch->frame_args_skip = frame_args_skip;
 }
 
-int
-gdbarch_unwind_pc_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->unwind_pc != NULL;
-}
-
 CORE_ADDR
 gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 5cb131de1d2..2ac229cda3a 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -625,8 +625,6 @@ extern void set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
 extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch);
 extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip);
 
-extern int gdbarch_unwind_pc_p (struct gdbarch *gdbarch);
-
 typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 33dfa6b349d..9eab0b30321 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -599,7 +599,7 @@ m;int;remote_register_number;int regno;regno;;default_remote_register_number;;0
 F;CORE_ADDR;fetch_tls_load_module_address;struct objfile *objfile;objfile
 #
 v;CORE_ADDR;frame_args_skip;;;0;;;0
-M;CORE_ADDR;unwind_pc;struct frame_info *next_frame;next_frame
+m;CORE_ADDR;unwind_pc;struct frame_info *next_frame;next_frame;;default_unwind_pc;;0
 M;CORE_ADDR;unwind_sp;struct frame_info *next_frame;next_frame
 # DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
 # frame-base.  Enable frame-base before frame-unwind.
@@ -1648,6 +1648,7 @@ cat <<EOF
 #include "regcache.h"
 #include "objfiles.h"
 #include "auxv.h"
+#include "frame-unwind.h"
 
 /* Static function declarations */
 
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 55e77b6bb6e..b7670ea2cec 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -92,12 +92,6 @@ static int is_h8300_normal_mode (struct gdbarch *gdbarch);
 		  && !is_h8300_normal_mode (gdbarch)) \
 		 ? h8300h_reg_size : h8300_reg_size)
 
-static CORE_ADDR
-h8300_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
-}
-
 static CORE_ADDR
 h8300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -1353,7 +1347,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue);
 
   /* Frame unwinder.  */
-  set_gdbarch_unwind_pc (gdbarch, h8300_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp);
   set_gdbarch_dummy_id (gdbarch, h8300_dummy_id);
   frame_base_set_default (gdbarch, &h8300_frame_base);
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index f8e2f234e02..9316bbb852f 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -440,12 +440,6 @@ iq2000_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }   
 
-static CORE_ADDR
-iq2000_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
-}
-
 static struct frame_id
 iq2000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -841,7 +835,6 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_type (gdbarch, iq2000_register_type);
   set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
   set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, iq2000_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, iq2000_dummy_id);
   frame_base_set_default (gdbarch, &iq2000_frame_base);
   set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call);
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 942852140d7..26f2faee365 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -382,12 +382,6 @@ lm32_return_value (struct gdbarch *gdbarch, struct value *function,
   return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-static CORE_ADDR
-lm32_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, SIM_LM32_PC_REGNUM);
-}
-
 static CORE_ADDR
 lm32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -551,7 +545,6 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frame unwinding.  */
   set_gdbarch_frame_align (gdbarch, lm32_frame_align);
   frame_base_set_default (gdbarch, &lm32_frame_base);
-  set_gdbarch_unwind_pc (gdbarch, lm32_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, lm32_unwind_sp);
   set_gdbarch_dummy_id (gdbarch, lm32_dummy_id);
   frame_unwind_append_unwinder (gdbarch, &lm32_frame_unwind);
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index fd79f3f4cde..9bfff6b0675 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -798,14 +798,6 @@ m32r_return_value (struct gdbarch *gdbarch, struct value *function,
     }
 }
 
-
-
-static CORE_ADDR
-m32r_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, M32R_PC_REGNUM);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -933,9 +925,6 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, m32r_dummy_id);
 
-  /* Return the unwound PC value.  */
-  set_gdbarch_unwind_pc (gdbarch, m32r_unwind_pc);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 58ef4a32927..9855c023d4d 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -757,16 +757,6 @@ m68hc11_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return pc;
 }
 
-static CORE_ADDR
-m68hc11_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST pc;
-
-  pc = frame_unwind_register_unsigned (next_frame,
-				       gdbarch_pc_regnum (gdbarch));
-  return pc;
-}
-
 /* Put here the code to store, into fi->saved_regs, the addresses of
    the saved registers of frame described by FRAME_INFO.  This
    includes special registers such as pc and fp saved in special ways
@@ -1494,7 +1484,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
   /* Characters are unsigned.  */
   set_gdbarch_char_signed (gdbarch, 0);
 
-  set_gdbarch_unwind_pc (gdbarch, m68hc11_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, m68hc11_unwind_sp);
 
   /* Set register info.  */
@@ -1531,9 +1520,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, m68hc11_dummy_id);
 
-  /* Return the unwound PC value.  */
-  set_gdbarch_unwind_pc (gdbarch, m68hc11_unwind_pc);
-
   /* Minsymbol frobbing.  */
   set_gdbarch_elf_make_msymbol_special (gdbarch,
                                         m68hc11_elf_make_msymbol_special);
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index 1cda2b35af9..af921a86c0c 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -2066,14 +2066,6 @@ static const struct frame_unwind mep_frame_unwind = {
 };
 
 
-/* Our general unwinding function can handle unwinding the PC.  */
-static CORE_ADDR
-mep_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MEP_PC_REGNUM);
-}
-
-
 /* Our general unwinding function can handle unwinding the SP.  */
 static CORE_ADDR
 mep_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
@@ -2468,7 +2460,6 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frames and frame unwinding.  */
   frame_unwind_append_unwinder (gdbarch, &mep_frame_unwind);
-  set_gdbarch_unwind_pc (gdbarch, mep_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, mep_unwind_sp);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_frame_args_skip (gdbarch, 0);
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index e12e01df030..0222b3192d1 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1150,15 +1150,6 @@ static const struct frame_unwind mn10300_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-mn10300_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST pc;
-
-  pc = frame_unwind_register_unsigned (this_frame, E_PC_REGNUM);
-  return pc;
-}
-
 static CORE_ADDR
 mn10300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -1174,7 +1165,6 @@ mn10300_frame_unwind_init (struct gdbarch *gdbarch)
   dwarf2_append_unwinders (gdbarch);
   frame_unwind_append_unwinder (gdbarch, &mn10300_frame_unwind);
   set_gdbarch_dummy_id (gdbarch, mn10300_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, mn10300_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp);
 }
 
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 50cacfef972..2ef1b753109 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -557,14 +557,6 @@ moxie_frame_cache (struct frame_info *this_frame, void **this_cache)
   return cache;
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-moxie_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MOXIE_PC_REGNUM);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -1115,8 +1107,6 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, moxie_dummy_id);
 
-  set_gdbarch_unwind_pc (gdbarch, moxie_unwind_pc);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 169b7e95058..008a178e993 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -447,14 +447,6 @@ msp430_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return p.prologue_end;
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-msp430_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MSP430_PC_REGNUM);
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -995,7 +987,6 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frames, prologues, etc.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_prologue (gdbarch, msp430_skip_prologue);
-  set_gdbarch_unwind_pc (gdbarch, msp430_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, msp430_unwind_sp);
   set_gdbarch_frame_align (gdbarch, msp430_frame_align);
   dwarf2_append_unwinders (gdbarch);
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index 8cc9d5bc84c..9fe4f6916e3 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -1398,14 +1398,6 @@ nds32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
   return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-nds32_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, NDS32_PC_REGNUM);
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -2141,7 +2133,6 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sp_regnum (gdbarch, NDS32_SP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, NDS32_PC_REGNUM);
   set_gdbarch_unwind_sp (gdbarch, nds32_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, nds32_unwind_pc);
   set_gdbarch_stack_frame_destroyed_p (gdbarch, nds32_stack_frame_destroyed_p);
   set_gdbarch_dwarf2_reg_to_regnum (gdbarch, nds32_dwarf2_reg_to_regnum);
 
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 11b12279321..923ed74cdf7 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -2326,14 +2326,6 @@ riscv_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
   return align_down (addr, 16);
 }
 
-/* Implement the unwind_pc gdbarch method.  */
-
-static CORE_ADDR
-riscv_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, RISCV_PC_REGNUM);
-}
-
 /* Implement the unwind_sp gdbarch method.  */
 
 static CORE_ADDR
@@ -2548,7 +2540,6 @@ riscv_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_frame_align (gdbarch, riscv_frame_align);
 
   /* Functions to access frame data.  */
-  set_gdbarch_unwind_pc (gdbarch, riscv_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, riscv_unwind_sp);
 
   /* Functions handling dummy frames.  */
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index a5b70917b7e..66c88d452f5 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3255,13 +3255,6 @@ find_variant_by_arch (enum bfd_architecture arch, unsigned long mach)
 }
 
 \f
-static CORE_ADDR
-rs6000_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_pc_regnum (gdbarch));
-}
-
 static struct frame_id
 rs6000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -6578,7 +6571,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     case GDB_OSABI_LINUX:
     case GDB_OSABI_NETBSD:
     case GDB_OSABI_UNKNOWN:
-      set_gdbarch_unwind_pc (gdbarch, rs6000_unwind_pc);
       frame_unwind_append_unwinder (gdbarch, &rs6000_epilogue_frame_unwind);
       frame_unwind_append_unwinder (gdbarch, &rs6000_frame_unwind);
       set_gdbarch_dummy_id (gdbarch, rs6000_dummy_id);
@@ -6587,7 +6579,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     default:
       set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
-      set_gdbarch_unwind_pc (gdbarch, rs6000_unwind_pc);
       frame_unwind_append_unwinder (gdbarch, &rs6000_epilogue_frame_unwind);
       frame_unwind_append_unwinder (gdbarch, &rs6000_frame_unwind);
       set_gdbarch_dummy_id (gdbarch, rs6000_dummy_id);
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 94d57913a31..3d982795db4 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -751,16 +751,6 @@ static const struct frame_unwind rx_exception_unwind = {
   rx_exception_sniffer
 };
 
-/* Implement the "unwind_pc" gdbarch method.  */
-static CORE_ADDR
-rx_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST pc;
-
-  pc = frame_unwind_register_unsigned (this_frame, RX_PC_REGNUM);
-  return pc;
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 static CORE_ADDR
 rx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
@@ -1110,7 +1100,6 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, rx_breakpoint::bp_from_kind);
   set_gdbarch_skip_prologue (gdbarch, rx_skip_prologue);
 
-  set_gdbarch_unwind_pc (gdbarch, rx_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, rx_unwind_sp);
 
   /* Target builtin data types.  */
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index a1679323273..c0f1291ed52 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -70,12 +70,6 @@ score_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM);
 }
 
-static CORE_ADDR
-score_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, SCORE_PC_REGNUM);
-}
-
 static const char *
 score7_register_name (struct gdbarch *gdbarch, int regnum)
 {
@@ -1481,7 +1475,6 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_align (gdbarch, score_frame_align);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_unwind_sp (gdbarch, score_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, score_unwind_pc);
 
   switch (target_mach)
     {
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 75ea673b82a..2f022909d6d 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1983,13 +1983,6 @@ sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 }
 
-static CORE_ADDR
-sh_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_pc_regnum (gdbarch));
-}
-
 static struct frame_id
 sh_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -2311,7 +2304,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, sh_frame_align);
   set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, sh_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, sh_dummy_id);
   frame_base_set_default (gdbarch, &sh_frame_base);
 
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 8eb88eb3adf..9066c7cd9fe 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -2319,13 +2319,6 @@ sh64_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 }
 
-static CORE_ADDR
-sh64_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_pc_regnum (gdbarch));
-}
-
 static struct frame_id
 sh64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -2421,7 +2414,6 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, sh64_frame_align);
   set_gdbarch_unwind_sp (gdbarch, sh64_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, sh64_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, sh64_dummy_id);
   frame_base_set_default (gdbarch, &sh64_frame_base);
 
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 8f688b16cf0..2ed32e3dfa8 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -936,12 +936,6 @@ tilegx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, TILEGX_SP_REGNUM);
 }
 
-static CORE_ADDR
-tilegx_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, TILEGX_PC_REGNUM);
-}
-
 static struct frame_id
 tilegx_unwind_dummy_id (struct gdbarch *gdbarch,
 			struct frame_info *this_frame)
@@ -1028,7 +1022,6 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame Info.  */
   set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, tilegx_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, tilegx_unwind_dummy_id);
   set_gdbarch_frame_align (gdbarch, tilegx_frame_align);
   frame_base_set_default (gdbarch, &tilegx_frame_base);
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index ac7d6aa4240..ce8b400fcdb 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1333,13 +1333,6 @@ v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 } 
 
-static CORE_ADDR
-v850_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_pc_regnum (gdbarch));
-}
-
 static struct frame_id
 v850_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -1465,7 +1458,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, v850_frame_align);
   set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, v850_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, v850_dummy_id);
   frame_base_set_default (gdbarch, &v850_frame_base);
 
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 4c1ab2e73e6..a8c2b31dbdc 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -435,12 +435,6 @@ vax_frame_num_args (struct frame_info *frame)
   args = get_frame_register_unsigned (frame, VAX_AP_REGNUM);
   return get_frame_memory_unsigned (frame, args, 1);
 }
-
-static CORE_ADDR
-vax_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, VAX_PC_REGNUM);
-}
 \f
 
 /* Initialize the current architecture based on INFO.  If possible, re-use an
@@ -501,8 +495,6 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_deprecated_function_start_offset (gdbarch, 2);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
-  set_gdbarch_unwind_pc (gdbarch, vax_unwind_pc);
-
   frame_base_set_default (gdbarch, &vax_frame_base);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 31650ac3a95..4d5c50e0755 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -757,12 +757,6 @@ xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }
 
-static CORE_ADDR
-xstormy16_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
-}
-
 static struct frame_id
 xstormy16_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -825,7 +819,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
    * Frame Info
    */
   set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, xstormy16_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, xstormy16_dummy_id);
   set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
   frame_base_set_default (gdbarch, &xstormy16_frame_base);
-- 
2.14.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb: Add a default_unwind_pc method for gdbarch
  2018-03-07 22:04 ` [PATCH] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess
@ 2018-03-08 22:32   ` Simon Marchi
  2018-03-09 15:54     ` Yao Qi
  2018-03-15 21:51   ` [PATCHv2 1/4] " Andrew Burgess
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Simon Marchi @ 2018-03-08 22:32 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches; +Cc: Yao Qi

On 2018-03-07 05:04 PM, Andrew Burgess wrote:
> As requested / suggested by Yao in this mail:
> 
>    https://sourceware.org/ml/gdb-patches/2018-03/msg00133.html
> 
> this patch provides a default implementation of unwind_pc and switches
> over targets that I believe are "obviously" using the default strategy.
> 
> I've been pretty conservative about switching targets over, so targets
> like arc that have some logging in place, but otherwise do the
> standard thing, are left with their own unwind_pc method.
> 
> In frame.c I've removed the gdbarch_unwind_pc_p check (the predicate
> is gone now) as it's assumed that all targets will have an
> implementation either the default, or their own.  This function is
> reindented, so it looks like a bigger change than it really is.
> 
> The problem with this patch is testing, there's been very little.  I
> tested that every target I could build GDB for before still builds
> after this patch, which covers all of the targets I touched, however,
> I've done no functionality testing on the built GDBs.
> 
> Is there any interest in merging this patch?  I'm happy to run any
> additional testing if I can be pointed to some instructions / hints
> for what to do.
> 
> Thanks,
> Andrew
> 
> --
> 
> Many architectures gdbarch unwind_pc method follow the same pattern.
> Provide a default method and convert targets to use it where possible.

Hi Andrew,

Patches that reduce duplication are always welcome :)

Do you have access to the buildbot to at least test your patch there?  It
only covers a fraction of the arches supported by GDB, but it's better than
nothing.  We can't expect a contributor to test on all supported arches.

Things that I think could be added to this patch:

- aarch64 seems like it could be converted too
- sparc too.  It passes tdep->pc_regnum, but from what I can tell
  gdbarch_pc_regnum is set to the same value, so it should be equivalent.

And maybe for a future patch, I wonder if we could generalize even more the
default method by applying in order:

  1. frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
  2. extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
  3. gdbarch_addr_bits_remove (gdbarch, addr)

That would allow removing a bunch of other implementations.  If an architecture
doesn't specify a custom pointer_to_address gdbarch method, extract_typed_address
will end up calling extract_unsigned_integer, which is similar to the current
behavior (just a different path to get there).  Arches that don't specify a custom
addr_bits_remove method use core_addr_identity, which is a no-op.

And for another future patch, could we apply the same treatment to *_unwind_sp?
Even *_dummy_id seem like it's always the same pattern.

Simon

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] gdb: Add a default_unwind_pc method for gdbarch
  2018-03-08 22:32   ` Simon Marchi
@ 2018-03-09 15:54     ` Yao Qi
  0 siblings, 0 replies; 14+ messages in thread
From: Yao Qi @ 2018-03-09 15:54 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Andrew Burgess, gdb-patches

Simon Marchi <simon.marchi@ericsson.com> writes:

> Things that I think could be added to this patch:
>
> - aarch64 seems like it could be converted too
> - sparc too.  It passes tdep->pc_regnum, but from what I can tell
>   gdbarch_pc_regnum is set to the same value, so it should be equivalent.

Agreed.  FWIW, the patch is good to me.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCHv2 2/4] gdb: Remove more targets unwind_pc methods
  2018-03-07 22:04 ` [PATCH] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess
                     ` (3 preceding siblings ...)
  2018-03-15 21:51   ` [PATCHv2 3/4] gdb: Supply a default for gdbarch_dummy_id Andrew Burgess
@ 2018-03-15 21:51   ` Andrew Burgess
  4 siblings, 0 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-03-15 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Yao Qi, Simon Marchi, Andrew Burgess

This commit rewrites default_unwind_pc to avoid short cutting the
steps of uninding the pc.  The new version of default_unwind_pc
contains calls to extract_typed_address (which wraps
gdbarch_pointer_to_address) and gdbarch_addr_bits_remove.  Targets
that don't override these methods will get the same behaviour as they
did before, but targets that do use these methods (and so need to call
them while unwinding the pc) can now use the default_unwind_pc method.

gdb/ChangeLog:

	* arm-tdep.c (arm_unwind_pc): Delete.
	(arm_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* frame-unwind.c (default_unwind_pc): Rewrite to call
	extract_typed_address and gdbarch_addr_bits_remove.
	* i386-tdep.c (i386_unwind_pc): Delete.
	(i386_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* m68k-tdep.c (m68k_unwind_pc): Delete.
	(m68k_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* m88k-tdep.c (m88k_unwind_pc): Delete.
	(m88k_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* nios2-tdep.c (nios2_unwind_pc): Delete.
	(nios2_get_next_pc): Update to call gdbarch_unwind_pc.
	(nios2_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* rl78-tdep.c (rl78_unwind_pc): Delete.
	(rl78_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* s390-tdep.c (s390_unwind_pc): Delete.
	(s390_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* tic6x-tdep.c (tic6x_unwind_pc): Delete.
	(tic6x_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
---
 gdb/ChangeLog      | 22 ++++++++++++++++++++++
 gdb/arm-tdep.c     | 13 -------------
 gdb/frame-unwind.c | 16 ++++++++++++++--
 gdb/i386-tdep.c    | 13 -------------
 gdb/m68k-tdep.c    | 10 ----------
 gdb/m88k-tdep.c    | 11 -----------
 gdb/nios2-tdep.c   | 14 +-------------
 gdb/rl78-tdep.c    | 11 -----------
 gdb/s390-tdep.c    | 12 ------------
 gdb/tic6x-tdep.c   | 12 ------------
 10 files changed, 37 insertions(+), 97 deletions(-)

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 539ee756e1b..98efc454044 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -3069,18 +3069,6 @@ arm_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 			 get_frame_pc (this_frame));
 }
 
-/* Given THIS_FRAME, find the previous frame's resume PC (which will
-   be used to construct the previous frame's ID, after looking up the
-   containing function).  */
-
-static CORE_ADDR
-arm_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR pc;
-  pc = frame_unwind_register_unsigned (this_frame, ARM_PC_REGNUM);
-  return arm_addr_bits_remove (gdbarch, pc);
-}
-
 static CORE_ADDR
 arm_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -9364,7 +9352,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame handling.  */
   set_gdbarch_dummy_id (gdbarch, arm_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, arm_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, arm_unwind_sp);
 
   frame_base_set_default (gdbarch, &arm_normal_base);
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index 0eed572ebbb..052998a1c4d 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -198,8 +198,20 @@ default_frame_unwind_stop_reason (struct frame_info *this_frame,
 CORE_ADDR
 default_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
-  int pc_regnum = gdbarch_pc_regnum (gdbarch);
-  return frame_unwind_register_unsigned (next_frame, pc_regnum);
+  struct type *type;
+  int pc_regnum;
+  CORE_ADDR addr;
+  struct value *value;
+
+  pc_regnum = gdbarch_pc_regnum (gdbarch);
+  value = frame_unwind_register_value (next_frame, pc_regnum);
+  type = builtin_type (gdbarch)->builtin_func_ptr;
+  addr = extract_typed_address (value_contents_all (value), type);
+  addr = gdbarch_addr_bits_remove (gdbarch, addr);
+
+  release_value (value);
+  value_free (value);
+  return addr;
 }
 
 /* Helper functions for value-based register unwinding.  These return
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 60dc8013a23..5b1276d678f 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1954,17 +1954,6 @@ i386_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 
   return pc;
 }
-
-/* This function is 64-bit safe.  */
-
-static CORE_ADDR
-i386_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  gdb_byte buf[8];
-
-  frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
-  return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
-}
 \f
 
 /* Normal frames.  */
@@ -8486,8 +8475,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_dummy_id (gdbarch, i386_dummy_id);
 
-  set_gdbarch_unwind_pc (gdbarch, i386_unwind_pc);
-
   /* Add the i386 register groups.  */
   i386_add_reggroups (gdbarch);
   tdep->register_reggroup_p = i386_register_reggroup_p;
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index b9fa5e6d4cf..16bc16773ab 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -851,15 +851,6 @@ m68k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
     return start_pc;
   return pc;
 }
-
-static CORE_ADDR
-m68k_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  gdb_byte buf[8];
-
-  frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
-  return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
-}
 \f
 /* Normal frames.  */
 
@@ -1247,7 +1238,6 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame unwinder.  */
   set_gdbarch_dummy_id (gdbarch, m68k_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, m68k_unwind_pc);
 
   /* Hook in the DWARF CFI frame unwinder.  */
   dwarf2_append_unwinders (gdbarch);
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 6a50126548d..de5e1ffc325 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -103,15 +103,6 @@ constexpr gdb_byte m88k_break_insn[] = { 0xf0, 0x00, 0xd1, 0xff };
 
 typedef BP_MANIPULATION (m88k_break_insn) m88k_breakpoint;
 
-static CORE_ADDR
-m88k_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  CORE_ADDR pc;
-
-  pc = frame_unwind_register_unsigned (next_frame, M88K_SXIP_REGNUM);
-  return m88k_addr_bits_remove (gdbarch, pc);
-}
-
 static void
 m88k_write_pc (struct regcache *regcache, CORE_ADDR pc)
 {
@@ -832,7 +823,6 @@ m88k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Register numbers of various important registers.  */
   set_gdbarch_sp_regnum (gdbarch, M88K_R31_REGNUM);
-  set_gdbarch_pc_regnum (gdbarch, M88K_SXIP_REGNUM);
 
   /* Core file support.  */
   set_gdbarch_iterate_over_regset_sections
@@ -853,7 +843,6 @@ m88k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_addr_bits_remove (gdbarch, m88k_addr_bits_remove);
   set_gdbarch_breakpoint_kind_from_pc (gdbarch, m88k_breakpoint::kind_from_pc);
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, m88k_breakpoint::bp_from_kind);
-  set_gdbarch_unwind_pc (gdbarch, m88k_unwind_pc);
   set_gdbarch_write_pc (gdbarch, m88k_write_pc);
 
   frame_base_set_default (gdbarch, &m88k_frame_base);
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index f6088f38ef5..3972dd9437d 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1888,17 +1888,6 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   return sp;
 }
 
-/* Implement the unwind_pc gdbarch method.  */
-
-static CORE_ADDR
-nios2_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  gdb_byte buf[4];
-
-  frame_unwind_register (next_frame, NIOS2_PC_REGNUM, buf);
-  return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
-}
-
 /* Implement the unwind_sp gdbarch method.  */
 
 static CORE_ADDR
@@ -2186,7 +2175,7 @@ nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
       /* If ra is in the reglist, we have to use the value saved in the
 	 stack frame rather than the current value.  */
       if (uimm & (1 << NIOS2_RA_REGNUM))
-	pc = nios2_unwind_pc (gdbarch, get_current_frame ());
+	pc = gdbarch_unwind_pc (gdbarch, get_current_frame ());
       else
 	pc = regcache_raw_get_unsigned (regcache, NIOS2_RA_REGNUM);
     }
@@ -2322,7 +2311,6 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, nios2_sw_breakpoint_from_kind);
 
   set_gdbarch_dummy_id (gdbarch, nios2_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, nios2_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, nios2_unwind_sp);
 
   /* The dwarf2 unwinder will normally produce the best results if
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index af6a0896082..46dd4f75f7b 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -1074,16 +1074,6 @@ rl78_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return p.prologue_end;
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-rl78_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame)
-{
-  return rl78_addr_bits_remove
-           (arch, frame_unwind_register_unsigned (next_frame,
-	                                          RL78_PC_REGNUM));
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -1468,7 +1458,6 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frames, prologues, etc.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_prologue (gdbarch, rl78_skip_prologue);
-  set_gdbarch_unwind_pc (gdbarch, rl78_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, rl78_unwind_sp);
   set_gdbarch_frame_align (gdbarch, rl78_frame_align);
 
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 408bb875d20..c1e17694a89 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -2129,17 +2129,6 @@ s390_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
   return 0;
 }
 
-/* Implement unwind_pc gdbarch method.  */
-
-static CORE_ADDR
-s390_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-  ULONGEST pc;
-  pc = frame_unwind_register_unsigned (next_frame, tdep->pc_regnum);
-  return gdbarch_addr_bits_remove (gdbarch, pc);
-}
-
 /* Implement unwind_sp gdbarch method.  */
 
 static CORE_ADDR
@@ -7005,7 +6994,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   dwarf2_frame_set_init_reg (gdbarch, s390_dwarf2_frame_init_reg);
   dwarf2_frame_set_adjust_regnum (gdbarch, s390_adjust_frame_regnum);
   dwarf2_append_unwinders (gdbarch);
-  set_gdbarch_unwind_pc (gdbarch, s390_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, s390_unwind_sp);
 
   switch (info.bfd_arch_info->mach)
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index f11763d9925..f1aaaa3c36a 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -366,17 +366,6 @@ tic6x_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
     reg->how = DWARF2_FRAME_REG_UNDEFINED;
 }
 
-/* This is the implementation of gdbarch method unwind_pc.  */
-
-static CORE_ADDR
-tic6x_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  gdb_byte buf[8];
-
-  frame_unwind_register (next_frame,  TIC6X_PC_REGNUM, buf);
-  return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
-}
-
 /* This is the implementation of gdbarch method unwind_sp.  */
 
 static CORE_ADDR
@@ -1290,7 +1279,6 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch,
 				       tic6x_sw_breakpoint_from_kind);
 
-  set_gdbarch_unwind_pc (gdbarch, tic6x_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, tic6x_unwind_sp);
 
   /* Unwinding.  */
-- 
2.14.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCHv2 4/4] gdb: Supply default gdbarch_unwind_sp and use where possible
  2018-03-07 22:04 ` [PATCH] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess
  2018-03-08 22:32   ` Simon Marchi
  2018-03-15 21:51   ` [PATCHv2 1/4] " Andrew Burgess
@ 2018-03-15 21:51   ` Andrew Burgess
  2018-03-15 21:51   ` [PATCHv2 3/4] gdb: Supply a default for gdbarch_dummy_id Andrew Burgess
  2018-03-15 21:51   ` [PATCHv2 2/4] gdb: Remove more targets unwind_pc methods Andrew Burgess
  4 siblings, 0 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-03-15 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Yao Qi, Simon Marchi, Andrew Burgess

Most unwind_sp methods follow the same pattern.  This commit provides
a default implementation of gdbarch_unwind_sp and switches targets
over to this method where possible.

gdb/ChangeLog:

	* aarch64-tdep.c (aarch64_unwind_sp): Delete.
	(aarch64_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* arm-tdep.c (arm_unwind_sp): Delete.
	(arm_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* cris-tdep.c (cris_unwind_sp): Delete.
	(cris_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* frame-unwind.c (default_unwind_sp): Define new function.
	* frame-unwind.h (default_unwind_sp): Declare new function.
	* frame.c (get_frame_sp): Assume gdbarch_unwind_sp is always
	available.
	* frv-tdep.c (frv_unwind_sp): Delete.
	(frv_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* ft32-tdep.c (ft32_unwind_sp): Delete.
	(ft32_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.
	* gdbarch.sh: Update 'unwind_sp', remove predicate, and supply a
	default method name.
	* h8300-tdep.c (h8300_unwind_sp): Delete.
	(h8300_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* iq2000-tdep.c (iq2000_unwind_sp): Delete.
	(iq2000_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* lm32-tdep.c (lm32_unwind_sp): Delete.
	(lm32_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* m32r-tdep.c (m32r_unwind_sp): Delete.
	(m32r_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* m68hc11-tdep.c (m68hc11_unwind_sp): Delete.
	(m68hc11_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* mep-tdep.c (mep_unwind_sp): Delete.
	(mep_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* mn10300-tdep.c (mn10300_unwind_sp): Delete.
	(mn10300_frame_unwind_init): Don't call set_gdbarch_unwind_sp.
	(mn10300_push_dummy_call): Call gdbarch_unwind_sp instead.
	* moxie-tdep.c (moxie_unwind_sp): Delete.
	(moxie_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* msp430-tdep.c (msp430_unwind_sp): Delete.
	(msp430_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* nds32-tdep.c (nds32_unwind_sp): Delete.
	(nds32_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* nios2-tdep.c (nios2_unwind_sp): Delete.
	(nios2_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* riscv-tdep.c (riscv_unwind_sp): Delete.
	(riscv_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* rl78-tdep.c (rl78_unwind_sp): Delete.
	(rl78_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* rx-tdep.c (rx_unwind_sp): Delete.
	(rx_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* score-tdep.c (score_unwind_sp): Delete.
	(score_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* sh-tdep.c (sh_unwind_sp): Delete.
	(sh_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* sh64-tdep.c (sh64_unwind_sp): Delete.
	(sh64_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* tic6x-tdep.c (tic6x_unwind_sp): Delete.
	(tic6x_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* tilegx-tdep.c (tilegx_unwind_sp): Delete.
	(tilegx_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* v850-tdep.c (v850_unwind_sp): Delete.
	(v850_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* xstormy16-tdep.c (xstormy16_unwind_sp): Delete.
	(xstormy16_gdbarch_init): Don't call set_gdbarch_unwind_sp.
---
 gdb/ChangeLog        | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/aarch64-tdep.c   | 11 ---------
 gdb/arm-tdep.c       |  9 --------
 gdb/cris-tdep.c      | 14 ------------
 gdb/frame-unwind.c   | 11 +++++++++
 gdb/frame-unwind.h   |  6 +++++
 gdb/frame.c          | 15 +++---------
 gdb/frv-tdep.c       |  7 ------
 gdb/ft32-tdep.c      | 10 --------
 gdb/gdbarch.c        | 13 ++---------
 gdb/gdbarch.h        |  2 --
 gdb/gdbarch.sh       |  2 +-
 gdb/h8300-tdep.c     |  7 ------
 gdb/iq2000-tdep.c    |  7 ------
 gdb/lm32-tdep.c      |  7 ------
 gdb/m32r-tdep.c      |  9 --------
 gdb/m68hc11-tdep.c   | 10 --------
 gdb/mep-tdep.c       | 11 ---------
 gdb/mn10300-tdep.c   | 12 +---------
 gdb/moxie-tdep.c     | 10 --------
 gdb/msp430-tdep.c    |  9 --------
 gdb/nds32-tdep.c     |  9 --------
 gdb/nios2-tdep.c     | 10 --------
 gdb/riscv-tdep.c     | 11 ---------
 gdb/rl78-tdep.c      |  9 --------
 gdb/rx-tdep.c        | 12 ----------
 gdb/score-tdep.c     |  7 ------
 gdb/sh-tdep.c        |  8 -------
 gdb/sh64-tdep.c      |  8 -------
 gdb/tic6x-tdep.c     | 11 ---------
 gdb/tilegx-tdep.c    |  7 ------
 gdb/v850-tdep.c      |  8 -------
 gdb/xstormy16-tdep.c |  7 ------
 33 files changed, 88 insertions(+), 265 deletions(-)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 7b41ee0466c..f2fa7be2015 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -974,14 +974,6 @@ struct frame_base aarch64_normal_base =
   aarch64_normal_frame_base
 };
 
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-aarch64_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_unwind_register_unsigned (this_frame, AARCH64_SP_REGNUM);
-}
-
 /* Return the value of the REGNUM register in the previous frame of
    *THIS_FRAME.  */
 
@@ -2913,9 +2905,6 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_push_dummy_call (gdbarch, aarch64_push_dummy_call);
   set_gdbarch_frame_align (gdbarch, aarch64_frame_align);
 
-  /* Frame handling.  */
-  set_gdbarch_unwind_sp (gdbarch, aarch64_unwind_sp);
-
   /* Advance PC across function entry code.  */
   set_gdbarch_skip_prologue (gdbarch, aarch64_skip_prologue);
 
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index e8179e6699b..b1cb3fa6c14 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -3055,12 +3055,6 @@ struct frame_base arm_normal_base = {
   arm_normal_frame_base
 };
 
-static CORE_ADDR
-arm_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_unwind_register_unsigned (this_frame, ARM_SP_REGNUM);
-}
-
 static struct value *
 arm_dwarf2_prev_register (struct frame_info *this_frame, void **this_cache,
 			  int regnum)
@@ -9336,9 +9330,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_write_pc (gdbarch, arm_write_pc);
 
-  /* Frame handling.  */
-  set_gdbarch_unwind_sp (gdbarch, arm_unwind_sp);
-
   frame_base_set_default (gdbarch, &arm_normal_base);
 
   /* Address manipulation.  */
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index fdcb6490c98..0e3401948ed 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -651,9 +651,6 @@ static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc,
 					struct frame_info *this_frame,
 					struct cris_unwind_cache *info);
 
-static CORE_ADDR cris_unwind_sp (struct gdbarch *gdbarch, 
-				 struct frame_info *next_frame);
-
 /* When arguments must be pushed onto the stack, they go on in reverse
    order.  The below implements a FILO (stack) to do this.
    Copied from d10v-tdep.c.  */
@@ -1358,15 +1355,6 @@ cris_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return pc_after_prologue;
 }
 
-static CORE_ADDR
-cris_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST sp;
-  sp = frame_unwind_register_unsigned (next_frame,
-				       gdbarch_sp_regnum (gdbarch));
-  return sp;
-}
-
 /* Implement the breakpoint_kind_from_pc gdbarch method.  */
 
 static int
@@ -4072,8 +4060,6 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_breakpoint_kind_from_pc (gdbarch, cris_breakpoint_kind_from_pc);
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, cris_sw_breakpoint_from_kind);
   
-  set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
-
   if (tdep->cris_dwarf2_cfi == 1)
     {
       /* Hook in the Dwarf-2 frame sniffer.  */
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index 052998a1c4d..cc1b1b832ae 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -214,6 +214,17 @@ default_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return addr;
 }
 
+/* Default unwind of the SP.  */
+
+CORE_ADDR
+default_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
+{
+  int sp_regnum;
+
+  sp_regnum = gdbarch_sp_regnum (gdbarch);
+  return frame_unwind_register_unsigned (next_frame, sp_regnum);
+}
+
 /* Helper functions for value-based register unwinding.  These return
    a (possibly lazy) value of the appropriate type.  */
 
diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h
index 4dfc7bedcc6..3ca3fdfe727 100644
--- a/gdb/frame-unwind.h
+++ b/gdb/frame-unwind.h
@@ -76,6 +76,12 @@ enum unwind_stop_reason
 extern CORE_ADDR default_unwind_pc (struct gdbarch *gdbarch,
 				    struct frame_info *next_frame);
 
+/* A default unwind_sp callback that simply unwinds the register identified
+   by GDBARCH_SP_REGNUM.  */
+
+extern CORE_ADDR default_unwind_sp (struct gdbarch *gdbarch,
+				    struct frame_info *next_frame);
+
 /* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
    use THIS frame, and through it the NEXT frame's register unwind
    method, to determine the frame ID of THIS frame.
diff --git a/gdb/frame.c b/gdb/frame.c
index 340dc99d5af..f1876db7ff6 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2777,18 +2777,9 @@ get_frame_sp (struct frame_info *this_frame)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
 
-  /* Normality - an architecture that provides a way of obtaining any
-     frame inner-most address.  */
-  if (gdbarch_unwind_sp_p (gdbarch))
-    /* NOTE drow/2008-06-28: gdbarch_unwind_sp could be converted to
-       operate on THIS_FRAME now.  */
-    return gdbarch_unwind_sp (gdbarch, this_frame->next);
-  /* Now things are really are grim.  Hope that the value returned by
-     the gdbarch_sp_regnum register is meaningful.  */
-  if (gdbarch_sp_regnum (gdbarch) >= 0)
-    return get_frame_register_unsigned (this_frame,
-					gdbarch_sp_regnum (gdbarch));
-  internal_error (__FILE__, __LINE__, _("Missing unwind SP method"));
+  /* NOTE drow/2008-06-28: gdbarch_unwind_sp could be converted to
+     operate on THIS_FRAME now.  */
+  return gdbarch_unwind_sp (gdbarch, this_frame->next);
 }
 
 /* Return the reason why we can't unwind past FRAME.  */
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index ab49a2bff50..00ebc6c399a 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1432,12 +1432,6 @@ static const struct frame_base frv_frame_base = {
   frv_frame_base_address
 };
 
-static CORE_ADDR
-frv_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, sp_regnum);
-}
-
 static struct gdbarch *
 frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
@@ -1521,7 +1515,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_return_value (gdbarch, frv_return_value);
 
   /* Frame stuff.  */
-  set_gdbarch_unwind_sp (gdbarch, frv_unwind_sp);
   set_gdbarch_frame_align (gdbarch, frv_frame_align);
   frame_base_set_default (gdbarch, &frv_frame_base);
   /* We set the sniffer lower down after the OSABI hooks have been
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 79cf1a08c1d..17f1ceb7a9b 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -383,14 +383,6 @@ ft32_address_class_name_to_type_flags (struct gdbarch *gdbarch,
     return 0;
 }
 
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-ft32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, FT32_SP_REGNUM);
-}
-
 /* Given a return value in `regbuf' with a type `valtype',
    extract and copy its value into `valbuf'.  */
 
@@ -586,8 +578,6 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 				     func_void_type);
   TYPE_INSTANCE_FLAGS (tdep->pc_type) |= TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
 
-  set_gdbarch_unwind_sp (gdbarch, ft32_unwind_sp);
-
   set_gdbarch_num_regs (gdbarch, FT32_NUM_REGS);
   set_gdbarch_sp_regnum (gdbarch, FT32_SP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, FT32_PC_REGNUM);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 1789eabae01..228e9a9318f 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -430,6 +430,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
   gdbarch->remote_register_number = default_remote_register_number;
   gdbarch->unwind_pc = default_unwind_pc;
+  gdbarch->unwind_sp = default_unwind_sp;
   gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr;
   gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
   gdbarch->addr_bits_remove = core_addr_identity;
@@ -617,7 +618,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of fetch_tls_load_module_address, has predicate.  */
   /* Skip verify of frame_args_skip, invalid_p == 0 */
   /* Skip verify of unwind_pc, invalid_p == 0 */
-  /* Skip verify of unwind_sp, has predicate.  */
+  /* Skip verify of unwind_sp, invalid_p == 0 */
   /* Skip verify of frame_num_args, has predicate.  */
   /* Skip verify of frame_align, has predicate.  */
   /* Skip verify of stabs_argument_has_addr, invalid_p == 0 */
@@ -1439,9 +1440,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "gdbarch_dump: unwind_pc = <%s>\n",
                       host_address_to_string (gdbarch->unwind_pc));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_unwind_sp_p() = %d\n",
-                      gdbarch_unwind_sp_p (gdbarch));
   fprintf_unfiltered (file,
                       "gdbarch_dump: unwind_sp = <%s>\n",
                       host_address_to_string (gdbarch->unwind_sp));
@@ -3066,13 +3064,6 @@ set_gdbarch_unwind_pc (struct gdbarch *gdbarch,
   gdbarch->unwind_pc = unwind_pc;
 }
 
-int
-gdbarch_unwind_sp_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->unwind_sp != NULL;
-}
-
 CORE_ADDR
 gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index be6a945a7ca..b8dc6081eb1 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -627,8 +627,6 @@ typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct fra
 extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc);
 
-extern int gdbarch_unwind_sp_p (struct gdbarch *gdbarch);
-
 typedef CORE_ADDR (gdbarch_unwind_sp_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern CORE_ADDR gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern void set_gdbarch_unwind_sp (struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype *unwind_sp);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index d5409d1b2f0..e93d7d49169 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -600,7 +600,7 @@ F;CORE_ADDR;fetch_tls_load_module_address;struct objfile *objfile;objfile
 #
 v;CORE_ADDR;frame_args_skip;;;0;;;0
 m;CORE_ADDR;unwind_pc;struct frame_info *next_frame;next_frame;;default_unwind_pc;;0
-M;CORE_ADDR;unwind_sp;struct frame_info *next_frame;next_frame
+m;CORE_ADDR;unwind_sp;struct frame_info *next_frame;next_frame;;default_unwind_sp;;0
 # DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
 # frame-base.  Enable frame-base before frame-unwind.
 F;int;frame_num_args;struct frame_info *frame;frame
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 16ece47cc4c..068014c34b0 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -92,12 +92,6 @@ static int is_h8300_normal_mode (struct gdbarch *gdbarch);
 		  && !is_h8300_normal_mode (gdbarch)) \
 		 ? h8300h_reg_size : h8300_reg_size)
 
-static CORE_ADDR
-h8300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
-}
-
 /* Normal frames.  */
 
 /* Allocate and initialize a frame cache.  */
@@ -1340,7 +1334,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue);
 
   /* Frame unwinder.  */
-  set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp);
   frame_base_set_default (gdbarch, &h8300_frame_base);
 
   /* 
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index 7fc4c5d05a1..082c78f6fbd 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -434,12 +434,6 @@ static const struct frame_unwind iq2000_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-iq2000_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
-}   
-
 static CORE_ADDR
 iq2000_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -827,7 +821,6 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_inner_than           (gdbarch, core_addr_lessthan);
   set_gdbarch_register_type (gdbarch, iq2000_register_type);
   set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
-  set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
   frame_base_set_default (gdbarch, &iq2000_frame_base);
   set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call);
 
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 651b09c73ec..5cf15625304 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -382,12 +382,6 @@ lm32_return_value (struct gdbarch *gdbarch, struct value *function,
   return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-static CORE_ADDR
-lm32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, SIM_LM32_SP_REGNUM);
-}
-
 /* Put here the code to store, into fi->saved_regs, the addresses of
    the saved registers of frame described by FRAME_INFO.  This
    includes special registers such as pc and fp saved in special ways
@@ -537,7 +531,6 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frame unwinding.  */
   set_gdbarch_frame_align (gdbarch, lm32_frame_align);
   frame_base_set_default (gdbarch, &lm32_frame_base);
-  set_gdbarch_unwind_sp (gdbarch, lm32_unwind_sp);
   frame_unwind_append_unwinder (gdbarch, &lm32_frame_unwind);
 
   /* Breakpoints.  */
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 77019162d22..4b2ab6d01bf 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -649,13 +649,6 @@ m32r_frame_unwind_cache (struct frame_info *this_frame,
   return info;
 }
 
-static CORE_ADDR
-m32r_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
-}
-
-
 static CORE_ADDR
 m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		      struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
@@ -884,8 +877,6 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_wchar_bit (gdbarch, 16);
   set_gdbarch_wchar_signed (gdbarch, 0);
 
-  set_gdbarch_unwind_sp (gdbarch, m32r_unwind_sp);
-
   set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS);
   set_gdbarch_pc_regnum (gdbarch, M32R_PC_REGNUM);
   set_gdbarch_sp_regnum (gdbarch, M32R_SP_REGNUM);
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 9855c023d4d..93a95a1e8d8 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -969,14 +969,6 @@ static const struct frame_base m68hc11_frame_base = {
   m68hc11_frame_args_address
 };
 
-static CORE_ADDR
-m68hc11_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST sp;
-  sp = frame_unwind_register_unsigned (next_frame, HARD_SP_REGNUM);
-  return sp;
-}
-
 /* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
    frame.  The frame ID's base needs to match the TOS value saved by
    save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
@@ -1484,8 +1476,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
   /* Characters are unsigned.  */
   set_gdbarch_char_signed (gdbarch, 0);
 
-  set_gdbarch_unwind_sp (gdbarch, m68hc11_unwind_sp);
-
   /* Set register info.  */
   set_gdbarch_fp0_regnum (gdbarch, -1);
 
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index ebd4890f273..fe25ca4934d 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -2064,16 +2064,6 @@ static const struct frame_unwind mep_frame_unwind = {
   NULL,
   default_frame_sniffer
 };
-
-
-/* Our general unwinding function can handle unwinding the SP.  */
-static CORE_ADDR
-mep_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MEP_SP_REGNUM);
-}
-
-
 \f
 /* Return values.  */
 
@@ -2451,7 +2441,6 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frames and frame unwinding.  */
   frame_unwind_append_unwinder (gdbarch, &mep_frame_unwind);
-  set_gdbarch_unwind_sp (gdbarch, mep_unwind_sp);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_frame_args_skip (gdbarch, 0);
 
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index b05dec16365..a46fdc80a03 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1141,21 +1141,11 @@ static const struct frame_unwind mn10300_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-mn10300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST sp;
-
-  sp = frame_unwind_register_unsigned (this_frame, E_SP_REGNUM);
-  return sp;
-}
-
 static void
 mn10300_frame_unwind_init (struct gdbarch *gdbarch)
 {
   dwarf2_append_unwinders (gdbarch);
   frame_unwind_append_unwinder (gdbarch, &mn10300_frame_unwind);
-  set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp);
 }
 
 /* Function: push_dummy_call
@@ -1289,7 +1279,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
   {
     CORE_ADDR func_addr = find_function_addr (target_func, NULL);
     CORE_ADDR unwound_sp 
-      = mn10300_unwind_sp (gdbarch, create_new_frame (sp, func_addr));
+      = gdbarch_unwind_sp (gdbarch, create_new_frame (sp, func_addr));
     if (sp != unwound_sp)
       regcache_cooked_write_unsigned (regcache, E_SP_REGNUM,
                                       sp - (unwound_sp - sp));
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 9ace7a4588a..ecc3195bb51 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -448,14 +448,6 @@ moxie_software_single_step (struct regcache *regcache)
   return next_pcs;
 }
 
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-moxie_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MOXIE_SP_REGNUM);
-}
-
 /* Given a return value in `regbuf' with a type `valtype', 
    extract and copy its value into `valbuf'.  */
 
@@ -1074,8 +1066,6 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_wchar_bit (gdbarch, 32);
   set_gdbarch_wchar_signed (gdbarch, 0);
 
-  set_gdbarch_unwind_sp (gdbarch, moxie_unwind_sp);
-
   set_gdbarch_num_regs (gdbarch, MOXIE_NUM_REGS);
   set_gdbarch_sp_regnum (gdbarch, MOXIE_SP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, MOXIE_PC_REGNUM);
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index d89f4450166..710dc1f1ce4 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -447,14 +447,6 @@ msp430_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return p.prologue_end;
 }
 
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-msp430_unwind_sp (struct gdbarch *arch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MSP430_SP_REGNUM);
-}
-
 /* Given a frame described by THIS_FRAME, decode the prologue of its
    associated function if there is not cache entry as specified by
    THIS_PROLOGUE_CACHE.  Save the decoded prologue in the cache and
@@ -975,7 +967,6 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frames, prologues, etc.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_prologue (gdbarch, msp430_skip_prologue);
-  set_gdbarch_unwind_sp (gdbarch, msp430_unwind_sp);
   set_gdbarch_frame_align (gdbarch, msp430_frame_align);
   dwarf2_append_unwinders (gdbarch);
   frame_unwind_append_unwinder (gdbarch, &msp430_unwind);
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index 2a169d6eea4..c6a343dd4d2 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -1388,14 +1388,6 @@ static const struct frame_unwind nds32_epilogue_frame_unwind =
   nds32_epilogue_frame_sniffer
 };
 \f
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-nds32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, NDS32_SP_REGNUM);
-}
-\f
 /* Floating type and struct type that has only one floating type member
    can pass value using FPU registers (when FPU ABI is used).  */
 
@@ -2122,7 +2114,6 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_sp_regnum (gdbarch, NDS32_SP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, NDS32_PC_REGNUM);
-  set_gdbarch_unwind_sp (gdbarch, nds32_unwind_sp);
   set_gdbarch_stack_frame_destroyed_p (gdbarch, nds32_stack_frame_destroyed_p);
   set_gdbarch_dwarf2_reg_to_regnum (gdbarch, nds32_dwarf2_reg_to_regnum);
 
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index f4d22597b76..8b47add604a 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1878,14 +1878,6 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   return sp;
 }
 
-/* Implement the unwind_sp gdbarch method.  */
-
-static CORE_ADDR
-nios2_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_unwind_register_unsigned (this_frame, NIOS2_SP_REGNUM);
-}
-
 /* Use prologue analysis to fill in the register cache
    *THIS_PROLOGUE_CACHE for THIS_FRAME.  This function initializes
    *THIS_PROLOGUE_CACHE first.  */
@@ -2300,8 +2292,6 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_breakpoint_kind_from_pc (gdbarch, nios2_breakpoint_kind_from_pc);
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, nios2_sw_breakpoint_from_kind);
 
-  set_gdbarch_unwind_sp (gdbarch, nios2_unwind_sp);
-
   /* The dwarf2 unwinder will normally produce the best results if
      the debug information is available, so register it first.  */
   dwarf2_append_unwinders (gdbarch);
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 12cf09d62fb..8b7d5d6a20d 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -2325,14 +2325,6 @@ riscv_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
   return align_down (addr, 16);
 }
 
-/* Implement the unwind_sp gdbarch method.  */
-
-static CORE_ADDR
-riscv_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, RISCV_SP_REGNUM);
-}
-
 /* Generate, or return the cached frame cache for the RiscV frame
    unwinder.  */
 
@@ -2529,9 +2521,6 @@ riscv_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_frame_align (gdbarch, riscv_frame_align);
 
-  /* Functions to access frame data.  */
-  set_gdbarch_unwind_sp (gdbarch, riscv_unwind_sp);
-
   /* Functions handling dummy frames.  */
   set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
   set_gdbarch_push_dummy_code (gdbarch, riscv_push_dummy_code);
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index 46dd4f75f7b..8226d1a4bfd 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -1074,14 +1074,6 @@ rl78_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return p.prologue_end;
 }
 
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-rl78_unwind_sp (struct gdbarch *arch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, RL78_SP_REGNUM);
-}
-
 /* Given a frame described by THIS_FRAME, decode the prologue of its
    associated function if there is not cache entry as specified by
    THIS_PROLOGUE_CACHE.  Save the decoded prologue in the cache and
@@ -1458,7 +1450,6 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frames, prologues, etc.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_prologue (gdbarch, rl78_skip_prologue);
-  set_gdbarch_unwind_sp (gdbarch, rl78_unwind_sp);
   set_gdbarch_frame_align (gdbarch, rl78_frame_align);
 
   dwarf2_append_unwinders (gdbarch);
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 07e83d0e11e..9c85c3cc232 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -751,16 +751,6 @@ static const struct frame_unwind rx_exception_unwind = {
   rx_exception_sniffer
 };
 
-/* Implement the "unwind_sp" gdbarch method.  */
-static CORE_ADDR
-rx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST sp;
-
-  sp = frame_unwind_register_unsigned (this_frame, RX_SP_REGNUM);
-  return sp;
-}
-
 /* Implement the "push_dummy_call" gdbarch method.  */
 static CORE_ADDR
 rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
@@ -1091,8 +1081,6 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, rx_breakpoint::bp_from_kind);
   set_gdbarch_skip_prologue (gdbarch, rx_skip_prologue);
 
-  set_gdbarch_unwind_sp (gdbarch, rx_unwind_sp);
-
   /* Target builtin data types.  */
   set_gdbarch_char_signed (gdbarch, 0);
   set_gdbarch_short_bit (gdbarch, 16);
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 9f2cdc992d9..54e81dc71ab 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -64,12 +64,6 @@ score_register_type (struct gdbarch *gdbarch, int regnum)
   return builtin_type (gdbarch)->builtin_uint32;
 }
 
-static CORE_ADDR
-score_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM);
-}
-
 static const char *
 score7_register_name (struct gdbarch *gdbarch, int regnum)
 {
@@ -1466,7 +1460,6 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_type (gdbarch, score_register_type);
   set_gdbarch_frame_align (gdbarch, score_frame_align);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
-  set_gdbarch_unwind_sp (gdbarch, score_unwind_sp);
 
   switch (target_mach)
     {
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index c672ba5cfe5..54f52bc9d71 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1976,13 +1976,6 @@ static const struct frame_unwind sh_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_sp_regnum (gdbarch));
-}
-
 static CORE_ADDR
 sh_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -2295,7 +2288,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
   set_gdbarch_frame_align (gdbarch, sh_frame_align);
-  set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp);
   frame_base_set_default (gdbarch, &sh_frame_base);
 
   set_gdbarch_stack_frame_destroyed_p (gdbarch, sh_stack_frame_destroyed_p);
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 8d27bdb0da3..a7759650e88 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -2312,13 +2312,6 @@ static const struct frame_unwind sh64_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-sh64_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_sp_regnum (gdbarch));
-}
-
 static CORE_ADDR
 sh64_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -2405,7 +2398,6 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
   set_gdbarch_frame_align (gdbarch, sh64_frame_align);
-  set_gdbarch_unwind_sp (gdbarch, sh64_unwind_sp);
   frame_base_set_default (gdbarch, &sh64_frame_base);
 
   set_gdbarch_print_registers_info (gdbarch, sh64_print_registers_info);
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index d9637f0feff..97997fd7097 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -366,15 +366,6 @@ tic6x_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
     reg->how = DWARF2_FRAME_REG_UNDEFINED;
 }
 
-/* This is the implementation of gdbarch method unwind_sp.  */
-
-static CORE_ADDR
-tic6x_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_unwind_register_unsigned (this_frame, TIC6X_SP_REGNUM);
-}
-
-
 /* Frame base handling.  */
 
 static struct tic6x_unwind_cache*
@@ -1269,8 +1260,6 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch,
 				       tic6x_sw_breakpoint_from_kind);
 
-  set_gdbarch_unwind_sp (gdbarch, tic6x_unwind_sp);
-
   /* Unwinding.  */
   dwarf2_append_unwinders (gdbarch);
 
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index df6bdf05daa..af73a37fd16 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -930,12 +930,6 @@ static const struct frame_base tilegx_frame_base = {
   tilegx_frame_base_address
 };
 
-static CORE_ADDR
-tilegx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, TILEGX_SP_REGNUM);
-}
-
 /* We cannot read/write the "special" registers.  */
 
 static int
@@ -1010,7 +1004,6 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
 
   /* Frame Info.  */
-  set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp);
   set_gdbarch_frame_align (gdbarch, tilegx_frame_align);
   frame_base_set_default (gdbarch, &tilegx_frame_base);
 
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index f2322f10802..a7700fbc41a 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1326,13 +1326,6 @@ static const struct frame_unwind v850_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_sp_regnum (gdbarch));
-} 
-
 static CORE_ADDR
 v850_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -1449,7 +1442,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_skip_prologue (gdbarch, v850_skip_prologue);
 
   set_gdbarch_frame_align (gdbarch, v850_frame_align);
-  set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp);
   frame_base_set_default (gdbarch, &v850_frame_base);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index ca00c14dcb2..035a0b28381 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -751,12 +751,6 @@ static const struct frame_base xstormy16_frame_base = {
   xstormy16_frame_base_address
 };
 
-static CORE_ADDR
-xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
-}
-
 /* Function: xstormy16_gdbarch_init
    Initializer function for the xstormy16 gdbarch vector.
    Called by gdbarch.  Sets up the gdbarch vector(s) for this target.  */
@@ -810,7 +804,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /*
    * Frame Info
    */
-  set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
   set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
   frame_base_set_default (gdbarch, &xstormy16_frame_base);
 
-- 
2.14.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCHv2 1/4] gdb: Add a default_unwind_pc method for gdbarch
  2018-03-07 22:04 ` [PATCH] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess
  2018-03-08 22:32   ` Simon Marchi
@ 2018-03-15 21:51   ` Andrew Burgess
  2018-03-15 21:51   ` [PATCHv2 4/4] gdb: Supply default gdbarch_unwind_sp and use where possible Andrew Burgess
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-03-15 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Yao Qi, Simon Marchi, Andrew Burgess

Many architectures gdbarch unwind_pc method follow the same pattern.
Provide a default method and convert targets to use it where possible.

gdb/ChangeLog:

	* aarch64-tdep.c (aarch64_unwind_pc): Deleted.
	(aarch64_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* alpha-tdep.c (alpha_unwind_pc): Deleted.
	(alpha_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* bfin-tdep.c (bfin_unwind_pc): Deleted.
	(bfin_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* cris-tdep.c (cris_unwind_pc): Deleted.
	(cris_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* frame-unwind.c (default_unwind_pc): New function.
	* frame-unwind.h (default_unwind_pc): Declare new function.
	* frame.c: Remove use of gdbarch_unwind_pc_p and reindent.
	* frv-tdep.c (frv_unwind_pc): Deleted.
	(frv_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* ft32-tdep.c (ft32_unwind_pc): Deleted.
	(ft32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.
	* gdbarch.sh: Update unwind_pc spec, and add new header file to be
	included.
	* h8300-tdep.c (h8300_unwind_pc): Deleted.
	(h8300_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* iq2000-tdep.c (iq2000_unwind_pc): Deleted.
	(iq2000_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* lm32-tdep.c (lm32_unwind_pc): Deleted.
	(lm32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* m32r-tdep.c (m32r_unwind_pc): Deleted.
	(m32r_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* m68hc11-tdep.c (m68hc11_unwind_pc): Deleted.
	(m68hc11_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* mep-tdep.c (mep_unwind_pc): Deleted.
	(mep_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* mn10300-tdep.c (mn10300_unwind_pc): Deleted.
	(mn10300_frame_unwind_init): Delete use of set_gdbarch_unwind_pc.
	* moxie-tdep.c (moxie_unwind_pc): Deleted.
	(moxie_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* msp430-tdep.c (msp430_unwind_pc): Deleted.
	(msp430_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* nds32-tdep.c (nds32_unwind_pc): Deleted.
	(nds32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* riscv-tdep.c (riscv_unwind_pc): Deleted.
	(riscv_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* rs6000-tdep.c (rs6000_unwind_pc): Deleted.
	(rs6000_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* rx-tdep.c (rx_unwind_pc): Deleted.
	(rx_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* score-tdep.c (score_unwind_pc): Deleted.
	(score_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* sh-tdep.c (sh_unwind_pc): Deleted.
	(sh_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* sh64-tdep.c (sh64_unwind_pc): Deleted.
	(sh64_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* sparc-tdep.c (sparc_unwind_pc): Deleted.
	(sparc32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* tilegx-tdep.c (tilegx_unwind_pc): Deleted.
	(tilegx_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* v850-tdep.c (v850_unwind_pc): Deleted.
	(v850_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* vax-tdep.c (vax_unwind_pc): Deleted.
	(vax_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* xstormy16-tdep.c (xstormy16_unwind_pc): Deleted.
	(xstormy16_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
---
 gdb/ChangeLog        |  64 ++++++++++++++++++++++++++++
 gdb/aarch64-tdep.c   |  12 ------
 gdb/alpha-tdep.c     |  11 -----
 gdb/bfin-tdep.c      |   7 ---
 gdb/cris-tdep.c      |  13 ------
 gdb/frame-unwind.c   |   9 ++++
 gdb/frame-unwind.h   |   6 +++
 gdb/frame.c          | 117 ++++++++++++++++++++++++---------------------------
 gdb/frv-tdep.c       |   7 ---
 gdb/ft32-tdep.c      |  10 -----
 gdb/gdbarch.c        |  14 ++----
 gdb/gdbarch.h        |   2 -
 gdb/gdbarch.sh       |   3 +-
 gdb/h8300-tdep.c     |   7 ---
 gdb/iq2000-tdep.c    |   7 ---
 gdb/lm32-tdep.c      |   7 ---
 gdb/m32r-tdep.c      |  11 -----
 gdb/m68hc11-tdep.c   |  14 ------
 gdb/mep-tdep.c       |   9 ----
 gdb/mn10300-tdep.c   |  10 -----
 gdb/moxie-tdep.c     |  10 -----
 gdb/msp430-tdep.c    |   9 ----
 gdb/nds32-tdep.c     |   9 ----
 gdb/riscv-tdep.c     |   9 ----
 gdb/rs6000-tdep.c    |   9 ----
 gdb/rx-tdep.c        |  11 -----
 gdb/score-tdep.c     |   7 ---
 gdb/sh-tdep.c        |   8 ----
 gdb/sh64-tdep.c      |   8 ----
 gdb/sparc-tdep.c     |   9 ----
 gdb/tilegx-tdep.c    |   7 ---
 gdb/v850-tdep.c      |   8 ----
 gdb/vax-tdep.c       |   8 ----
 gdb/xstormy16-tdep.c |   7 ---
 34 files changed, 140 insertions(+), 319 deletions(-)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index f08945ea071..0f123de6b35 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -988,17 +988,6 @@ aarch64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 			 get_frame_pc (this_frame));
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-aarch64_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR pc
-    = frame_unwind_register_unsigned (this_frame, AARCH64_PC_REGNUM);
-
-  return pc;
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -2940,7 +2929,6 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame handling.  */
   set_gdbarch_dummy_id (gdbarch, aarch64_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, aarch64_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, aarch64_unwind_sp);
 
   /* Advance PC across function entry code.  */
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 52a46d96eaf..81ee43c9fa4 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -1479,14 +1479,6 @@ alpha_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
   return frame_id_build (base, get_frame_pc (this_frame));
 }
 
-static CORE_ADDR
-alpha_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST pc;
-  pc = frame_unwind_register_unsigned (next_frame, ALPHA_PC_REGNUM);
-  return pc;
-}
-
 \f
 /* Helper routines for alpha*-nat.c files to move register sets to and
    from core files.  The UNIQUE pointer is allowed to be NULL, as most
@@ -1813,9 +1805,6 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Methods for saving / extracting a dummy frame's ID.  */
   set_gdbarch_dummy_id (gdbarch, alpha_dummy_id);
 
-  /* Return the unwound PC value.  */
-  set_gdbarch_unwind_pc (gdbarch, alpha_unwind_pc);
-
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index 63fbf6209e2..696786dc1b0 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -766,12 +766,6 @@ bfin_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
   return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
-static CORE_ADDR
-bfin_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, BFIN_PC_REGNUM);
-}
-
 static CORE_ADDR
 bfin_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
 {
@@ -836,7 +830,6 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, bfin_sw_breakpoint_from_kind);
   set_gdbarch_decr_pc_after_break (gdbarch, 2);
   set_gdbarch_frame_args_skip (gdbarch, 8);
-  set_gdbarch_unwind_pc (gdbarch, bfin_unwind_pc);
   set_gdbarch_frame_align (gdbarch, bfin_frame_align);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 5fa79ef2cfa..74368b7b0a4 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -651,9 +651,6 @@ static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc,
 					struct frame_info *this_frame,
 					struct cris_unwind_cache *info);
 
-static CORE_ADDR cris_unwind_pc (struct gdbarch *gdbarch, 
-				 struct frame_info *next_frame);
-
 static CORE_ADDR cris_unwind_sp (struct gdbarch *gdbarch, 
 				 struct frame_info *next_frame);
 
@@ -1373,15 +1370,6 @@ cris_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return pc_after_prologue;
 }
 
-static CORE_ADDR
-cris_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST pc;
-  pc = frame_unwind_register_unsigned (next_frame,
-				       gdbarch_pc_regnum (gdbarch));
-  return pc;
-}
-
 static CORE_ADDR
 cris_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -4096,7 +4084,6 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_breakpoint_kind_from_pc (gdbarch, cris_breakpoint_kind_from_pc);
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, cris_sw_breakpoint_from_kind);
   
-  set_gdbarch_unwind_pc (gdbarch, cris_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
   set_gdbarch_dummy_id (gdbarch, cris_dummy_id);
 
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index e6e63539ad7..0eed572ebbb 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -193,6 +193,15 @@ default_frame_unwind_stop_reason (struct frame_info *this_frame,
     return UNWIND_NO_REASON;
 }
 
+/* Default unwind of the PC.  */
+
+CORE_ADDR
+default_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
+{
+  int pc_regnum = gdbarch_pc_regnum (gdbarch);
+  return frame_unwind_register_unsigned (next_frame, pc_regnum);
+}
+
 /* Helper functions for value-based register unwinding.  These return
    a (possibly lazy) value of the appropriate type.  */
 
diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h
index af220f72a01..4dfc7bedcc6 100644
--- a/gdb/frame-unwind.h
+++ b/gdb/frame-unwind.h
@@ -70,6 +70,12 @@ enum unwind_stop_reason
   default_frame_unwind_stop_reason (struct frame_info *this_frame,
 				    void **this_cache);
 
+/* A default unwind_pc callback that simply unwinds the register identified
+   by GDBARCH_PC_REGNUM.  */
+
+extern CORE_ADDR default_unwind_pc (struct gdbarch *gdbarch,
+				    struct frame_info *next_frame);
+
 /* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
    use THIS frame, and through it the NEXT frame's register unwind
    method, to determine the frame ID of THIS frame.
diff --git a/gdb/frame.c b/gdb/frame.c
index 0b04a4ebacb..340dc99d5af 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -856,76 +856,71 @@ frame_unwind_pc (struct frame_info *this_frame)
 {
   if (this_frame->prev_pc.status == CC_UNKNOWN)
     {
-      if (gdbarch_unwind_pc_p (frame_unwind_arch (this_frame)))
+      struct gdbarch *prev_gdbarch;
+      CORE_ADDR pc = 0;
+      int pc_p = 0;
+
+      /* The right way.  The `pure' way.  The one true way.  This
+	 method depends solely on the register-unwind code to
+	 determine the value of registers in THIS frame, and hence
+	 the value of this frame's PC (resume address).  A typical
+	 implementation is no more than:
+
+	 frame_unwind_register (this_frame, ISA_PC_REGNUM, buf);
+	 return extract_unsigned_integer (buf, size of ISA_PC_REGNUM);
+
+	 Note: this method is very heavily dependent on a correct
+	 register-unwind implementation, it pays to fix that
+	 method first; this method is frame type agnostic, since
+	 it only deals with register values, it works with any
+	 frame.  This is all in stark contrast to the old
+	 FRAME_SAVED_PC which would try to directly handle all the
+	 different ways that a PC could be unwound.  */
+      prev_gdbarch = frame_unwind_arch (this_frame);
+
+      TRY
 	{
-	  struct gdbarch *prev_gdbarch;
-	  CORE_ADDR pc = 0;
-	  int pc_p = 0;
-
-	  /* The right way.  The `pure' way.  The one true way.  This
-	     method depends solely on the register-unwind code to
-	     determine the value of registers in THIS frame, and hence
-	     the value of this frame's PC (resume address).  A typical
-	     implementation is no more than:
-	   
-	     frame_unwind_register (this_frame, ISA_PC_REGNUM, buf);
-	     return extract_unsigned_integer (buf, size of ISA_PC_REGNUM);
-
-	     Note: this method is very heavily dependent on a correct
-	     register-unwind implementation, it pays to fix that
-	     method first; this method is frame type agnostic, since
-	     it only deals with register values, it works with any
-	     frame.  This is all in stark contrast to the old
-	     FRAME_SAVED_PC which would try to directly handle all the
-	     different ways that a PC could be unwound.  */
-	  prev_gdbarch = frame_unwind_arch (this_frame);
-
-	  TRY
+	  pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
+	  pc_p = 1;
+	}
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  if (ex.error == NOT_AVAILABLE_ERROR)
 	    {
-	      pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
-	      pc_p = 1;
+	      this_frame->prev_pc.status = CC_UNAVAILABLE;
+
+	      if (frame_debug)
+		fprintf_unfiltered (gdb_stdlog,
+				    "{ frame_unwind_pc (this_frame=%d)"
+				    " -> <unavailable> }\n",
+				    this_frame->level);
 	    }
-	  CATCH (ex, RETURN_MASK_ERROR)
+	  else if (ex.error == OPTIMIZED_OUT_ERROR)
 	    {
-	      if (ex.error == NOT_AVAILABLE_ERROR)
-		{
-		  this_frame->prev_pc.status = CC_UNAVAILABLE;
-
-		  if (frame_debug)
-		    fprintf_unfiltered (gdb_stdlog,
-					"{ frame_unwind_pc (this_frame=%d)"
-					" -> <unavailable> }\n",
-					this_frame->level);
-		}
-	      else if (ex.error == OPTIMIZED_OUT_ERROR)
-		{
-		  this_frame->prev_pc.status = CC_NOT_SAVED;
-
-		  if (frame_debug)
-		    fprintf_unfiltered (gdb_stdlog,
-					"{ frame_unwind_pc (this_frame=%d)"
-					" -> <not saved> }\n",
-					this_frame->level);
-		}
-	      else
-		throw_exception (ex);
-	    }
-	  END_CATCH
+	      this_frame->prev_pc.status = CC_NOT_SAVED;
 
-	  if (pc_p)
-	    {
-	      this_frame->prev_pc.value = pc;
-	      this_frame->prev_pc.status = CC_VALUE;
 	      if (frame_debug)
 		fprintf_unfiltered (gdb_stdlog,
-				    "{ frame_unwind_pc (this_frame=%d) "
-				    "-> %s }\n",
-				    this_frame->level,
-				    hex_string (this_frame->prev_pc.value));
+				    "{ frame_unwind_pc (this_frame=%d)"
+				    " -> <not saved> }\n",
+				    this_frame->level);
 	    }
+	  else
+	    throw_exception (ex);
+	}
+      END_CATCH
+
+      if (pc_p)
+	{
+	  this_frame->prev_pc.value = pc;
+	  this_frame->prev_pc.status = CC_VALUE;
+	  if (frame_debug)
+	    fprintf_unfiltered (gdb_stdlog,
+				"{ frame_unwind_pc (this_frame=%d) "
+				"-> %s }\n",
+				this_frame->level,
+				hex_string (this_frame->prev_pc.value));
 	}
-      else
-	internal_error (__FILE__, __LINE__, _("No unwind_pc method"));
     }
 
   if (this_frame->prev_pc.status == CC_VALUE)
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 2f9a8d27c46..38f996d2e5c 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1366,12 +1366,6 @@ frv_return_value (struct gdbarch *gdbarch, struct value *function,
     return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-static CORE_ADDR
-frv_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, pc_regnum);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -1539,7 +1533,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_return_value (gdbarch, frv_return_value);
 
   /* Frame stuff.  */
-  set_gdbarch_unwind_pc (gdbarch, frv_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, frv_unwind_sp);
   set_gdbarch_frame_align (gdbarch, frv_frame_align);
   frame_base_set_default (gdbarch, &frv_frame_base);
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 7198b84aca0..5c0a3384dbd 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -492,14 +492,6 @@ ft32_frame_cache (struct frame_info *this_frame, void **this_cache)
   return cache;
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-ft32_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, FT32_PC_REGNUM);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -627,8 +619,6 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, ft32_dummy_id);
 
-  set_gdbarch_unwind_pc (gdbarch, ft32_unwind_pc);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index b8703e5a556..884b7b24f86 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -48,6 +48,7 @@
 #include "regcache.h"
 #include "objfiles.h"
 #include "auxv.h"
+#include "frame-unwind.h"
 
 /* Static function declarations */
 
@@ -426,6 +427,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
   gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
   gdbarch->remote_register_number = default_remote_register_number;
+  gdbarch->unwind_pc = default_unwind_pc;
   gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr;
   gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
   gdbarch->addr_bits_remove = core_addr_identity;
@@ -612,7 +614,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of remote_register_number, invalid_p == 0 */
   /* Skip verify of fetch_tls_load_module_address, has predicate.  */
   /* Skip verify of frame_args_skip, invalid_p == 0 */
-  /* Skip verify of unwind_pc, has predicate.  */
+  /* Skip verify of unwind_pc, invalid_p == 0 */
   /* Skip verify of unwind_sp, has predicate.  */
   /* Skip verify of frame_num_args, has predicate.  */
   /* Skip verify of frame_align, has predicate.  */
@@ -1435,9 +1437,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "gdbarch_dump: target_desc = %s\n",
                       host_address_to_string (gdbarch->target_desc));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n",
-                      gdbarch_unwind_pc_p (gdbarch));
   fprintf_unfiltered (file,
                       "gdbarch_dump: unwind_pc = <%s>\n",
                       host_address_to_string (gdbarch->unwind_pc));
@@ -3058,13 +3057,6 @@ set_gdbarch_frame_args_skip (struct gdbarch *gdbarch,
   gdbarch->frame_args_skip = frame_args_skip;
 }
 
-int
-gdbarch_unwind_pc_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->unwind_pc != NULL;
-}
-
 CORE_ADDR
 gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 5cb131de1d2..2ac229cda3a 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -625,8 +625,6 @@ extern void set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
 extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch);
 extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip);
 
-extern int gdbarch_unwind_pc_p (struct gdbarch *gdbarch);
-
 typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 33dfa6b349d..9eab0b30321 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -599,7 +599,7 @@ m;int;remote_register_number;int regno;regno;;default_remote_register_number;;0
 F;CORE_ADDR;fetch_tls_load_module_address;struct objfile *objfile;objfile
 #
 v;CORE_ADDR;frame_args_skip;;;0;;;0
-M;CORE_ADDR;unwind_pc;struct frame_info *next_frame;next_frame
+m;CORE_ADDR;unwind_pc;struct frame_info *next_frame;next_frame;;default_unwind_pc;;0
 M;CORE_ADDR;unwind_sp;struct frame_info *next_frame;next_frame
 # DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
 # frame-base.  Enable frame-base before frame-unwind.
@@ -1648,6 +1648,7 @@ cat <<EOF
 #include "regcache.h"
 #include "objfiles.h"
 #include "auxv.h"
+#include "frame-unwind.h"
 
 /* Static function declarations */
 
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 55e77b6bb6e..b7670ea2cec 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -92,12 +92,6 @@ static int is_h8300_normal_mode (struct gdbarch *gdbarch);
 		  && !is_h8300_normal_mode (gdbarch)) \
 		 ? h8300h_reg_size : h8300_reg_size)
 
-static CORE_ADDR
-h8300_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
-}
-
 static CORE_ADDR
 h8300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -1353,7 +1347,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue);
 
   /* Frame unwinder.  */
-  set_gdbarch_unwind_pc (gdbarch, h8300_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp);
   set_gdbarch_dummy_id (gdbarch, h8300_dummy_id);
   frame_base_set_default (gdbarch, &h8300_frame_base);
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index f8e2f234e02..9316bbb852f 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -440,12 +440,6 @@ iq2000_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }   
 
-static CORE_ADDR
-iq2000_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
-}
-
 static struct frame_id
 iq2000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -841,7 +835,6 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_type (gdbarch, iq2000_register_type);
   set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
   set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, iq2000_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, iq2000_dummy_id);
   frame_base_set_default (gdbarch, &iq2000_frame_base);
   set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call);
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 942852140d7..26f2faee365 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -382,12 +382,6 @@ lm32_return_value (struct gdbarch *gdbarch, struct value *function,
   return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-static CORE_ADDR
-lm32_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, SIM_LM32_PC_REGNUM);
-}
-
 static CORE_ADDR
 lm32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -551,7 +545,6 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frame unwinding.  */
   set_gdbarch_frame_align (gdbarch, lm32_frame_align);
   frame_base_set_default (gdbarch, &lm32_frame_base);
-  set_gdbarch_unwind_pc (gdbarch, lm32_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, lm32_unwind_sp);
   set_gdbarch_dummy_id (gdbarch, lm32_dummy_id);
   frame_unwind_append_unwinder (gdbarch, &lm32_frame_unwind);
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index fd79f3f4cde..9bfff6b0675 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -798,14 +798,6 @@ m32r_return_value (struct gdbarch *gdbarch, struct value *function,
     }
 }
 
-
-
-static CORE_ADDR
-m32r_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, M32R_PC_REGNUM);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -933,9 +925,6 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, m32r_dummy_id);
 
-  /* Return the unwound PC value.  */
-  set_gdbarch_unwind_pc (gdbarch, m32r_unwind_pc);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 58ef4a32927..9855c023d4d 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -757,16 +757,6 @@ m68hc11_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return pc;
 }
 
-static CORE_ADDR
-m68hc11_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST pc;
-
-  pc = frame_unwind_register_unsigned (next_frame,
-				       gdbarch_pc_regnum (gdbarch));
-  return pc;
-}
-
 /* Put here the code to store, into fi->saved_regs, the addresses of
    the saved registers of frame described by FRAME_INFO.  This
    includes special registers such as pc and fp saved in special ways
@@ -1494,7 +1484,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
   /* Characters are unsigned.  */
   set_gdbarch_char_signed (gdbarch, 0);
 
-  set_gdbarch_unwind_pc (gdbarch, m68hc11_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, m68hc11_unwind_sp);
 
   /* Set register info.  */
@@ -1531,9 +1520,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, m68hc11_dummy_id);
 
-  /* Return the unwound PC value.  */
-  set_gdbarch_unwind_pc (gdbarch, m68hc11_unwind_pc);
-
   /* Minsymbol frobbing.  */
   set_gdbarch_elf_make_msymbol_special (gdbarch,
                                         m68hc11_elf_make_msymbol_special);
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index 1cda2b35af9..af921a86c0c 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -2066,14 +2066,6 @@ static const struct frame_unwind mep_frame_unwind = {
 };
 
 
-/* Our general unwinding function can handle unwinding the PC.  */
-static CORE_ADDR
-mep_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MEP_PC_REGNUM);
-}
-
-
 /* Our general unwinding function can handle unwinding the SP.  */
 static CORE_ADDR
 mep_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
@@ -2468,7 +2460,6 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frames and frame unwinding.  */
   frame_unwind_append_unwinder (gdbarch, &mep_frame_unwind);
-  set_gdbarch_unwind_pc (gdbarch, mep_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, mep_unwind_sp);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_frame_args_skip (gdbarch, 0);
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index e12e01df030..0222b3192d1 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1150,15 +1150,6 @@ static const struct frame_unwind mn10300_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-mn10300_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST pc;
-
-  pc = frame_unwind_register_unsigned (this_frame, E_PC_REGNUM);
-  return pc;
-}
-
 static CORE_ADDR
 mn10300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -1174,7 +1165,6 @@ mn10300_frame_unwind_init (struct gdbarch *gdbarch)
   dwarf2_append_unwinders (gdbarch);
   frame_unwind_append_unwinder (gdbarch, &mn10300_frame_unwind);
   set_gdbarch_dummy_id (gdbarch, mn10300_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, mn10300_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp);
 }
 
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 50cacfef972..2ef1b753109 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -557,14 +557,6 @@ moxie_frame_cache (struct frame_info *this_frame, void **this_cache)
   return cache;
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-moxie_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MOXIE_PC_REGNUM);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -1115,8 +1107,6 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, moxie_dummy_id);
 
-  set_gdbarch_unwind_pc (gdbarch, moxie_unwind_pc);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 169b7e95058..008a178e993 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -447,14 +447,6 @@ msp430_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return p.prologue_end;
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-msp430_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MSP430_PC_REGNUM);
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -995,7 +987,6 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frames, prologues, etc.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_prologue (gdbarch, msp430_skip_prologue);
-  set_gdbarch_unwind_pc (gdbarch, msp430_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, msp430_unwind_sp);
   set_gdbarch_frame_align (gdbarch, msp430_frame_align);
   dwarf2_append_unwinders (gdbarch);
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index 8cc9d5bc84c..9fe4f6916e3 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -1398,14 +1398,6 @@ nds32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
   return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-nds32_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, NDS32_PC_REGNUM);
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -2141,7 +2133,6 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sp_regnum (gdbarch, NDS32_SP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, NDS32_PC_REGNUM);
   set_gdbarch_unwind_sp (gdbarch, nds32_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, nds32_unwind_pc);
   set_gdbarch_stack_frame_destroyed_p (gdbarch, nds32_stack_frame_destroyed_p);
   set_gdbarch_dwarf2_reg_to_regnum (gdbarch, nds32_dwarf2_reg_to_regnum);
 
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 655db7cce69..58c3f30ffe3 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -2325,14 +2325,6 @@ riscv_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
   return align_down (addr, 16);
 }
 
-/* Implement the unwind_pc gdbarch method.  */
-
-static CORE_ADDR
-riscv_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, RISCV_PC_REGNUM);
-}
-
 /* Implement the unwind_sp gdbarch method.  */
 
 static CORE_ADDR
@@ -2547,7 +2539,6 @@ riscv_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_frame_align (gdbarch, riscv_frame_align);
 
   /* Functions to access frame data.  */
-  set_gdbarch_unwind_pc (gdbarch, riscv_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, riscv_unwind_sp);
 
   /* Functions handling dummy frames.  */
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index a5b70917b7e..66c88d452f5 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3255,13 +3255,6 @@ find_variant_by_arch (enum bfd_architecture arch, unsigned long mach)
 }
 
 \f
-static CORE_ADDR
-rs6000_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_pc_regnum (gdbarch));
-}
-
 static struct frame_id
 rs6000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -6578,7 +6571,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     case GDB_OSABI_LINUX:
     case GDB_OSABI_NETBSD:
     case GDB_OSABI_UNKNOWN:
-      set_gdbarch_unwind_pc (gdbarch, rs6000_unwind_pc);
       frame_unwind_append_unwinder (gdbarch, &rs6000_epilogue_frame_unwind);
       frame_unwind_append_unwinder (gdbarch, &rs6000_frame_unwind);
       set_gdbarch_dummy_id (gdbarch, rs6000_dummy_id);
@@ -6587,7 +6579,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     default:
       set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
-      set_gdbarch_unwind_pc (gdbarch, rs6000_unwind_pc);
       frame_unwind_append_unwinder (gdbarch, &rs6000_epilogue_frame_unwind);
       frame_unwind_append_unwinder (gdbarch, &rs6000_frame_unwind);
       set_gdbarch_dummy_id (gdbarch, rs6000_dummy_id);
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 94d57913a31..3d982795db4 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -751,16 +751,6 @@ static const struct frame_unwind rx_exception_unwind = {
   rx_exception_sniffer
 };
 
-/* Implement the "unwind_pc" gdbarch method.  */
-static CORE_ADDR
-rx_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST pc;
-
-  pc = frame_unwind_register_unsigned (this_frame, RX_PC_REGNUM);
-  return pc;
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 static CORE_ADDR
 rx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
@@ -1110,7 +1100,6 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, rx_breakpoint::bp_from_kind);
   set_gdbarch_skip_prologue (gdbarch, rx_skip_prologue);
 
-  set_gdbarch_unwind_pc (gdbarch, rx_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, rx_unwind_sp);
 
   /* Target builtin data types.  */
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index a1679323273..c0f1291ed52 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -70,12 +70,6 @@ score_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM);
 }
 
-static CORE_ADDR
-score_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, SCORE_PC_REGNUM);
-}
-
 static const char *
 score7_register_name (struct gdbarch *gdbarch, int regnum)
 {
@@ -1481,7 +1475,6 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_align (gdbarch, score_frame_align);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_unwind_sp (gdbarch, score_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, score_unwind_pc);
 
   switch (target_mach)
     {
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 75ea673b82a..2f022909d6d 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1983,13 +1983,6 @@ sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 }
 
-static CORE_ADDR
-sh_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_pc_regnum (gdbarch));
-}
-
 static struct frame_id
 sh_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -2311,7 +2304,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, sh_frame_align);
   set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, sh_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, sh_dummy_id);
   frame_base_set_default (gdbarch, &sh_frame_base);
 
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 8eb88eb3adf..9066c7cd9fe 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -2319,13 +2319,6 @@ sh64_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 }
 
-static CORE_ADDR
-sh64_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_pc_regnum (gdbarch));
-}
-
 static struct frame_id
 sh64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -2421,7 +2414,6 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, sh64_frame_align);
   set_gdbarch_unwind_sp (gdbarch, sh64_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, sh64_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, sh64_dummy_id);
   frame_base_set_default (gdbarch, &sh64_frame_base);
 
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 633bd685bce..17c33d136e7 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1093,13 +1093,6 @@ sparc_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
   return pc;
 }
 
-static CORE_ADDR
-sparc_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-  return frame_unwind_register_unsigned (this_frame, tdep->pc_regnum);
-}
-
 /* Return PC of first real instruction of the function starting at
    START_PC.  */
 
@@ -1859,8 +1852,6 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_dummy_id (gdbarch, sparc_dummy_id);
 
-  set_gdbarch_unwind_pc (gdbarch, sparc_unwind_pc);
-
   frame_base_set_default (gdbarch, &sparc32_frame_base);
 
   /* Hook in the DWARF CFI frame unwinder.  */
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 8f688b16cf0..2ed32e3dfa8 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -936,12 +936,6 @@ tilegx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, TILEGX_SP_REGNUM);
 }
 
-static CORE_ADDR
-tilegx_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, TILEGX_PC_REGNUM);
-}
-
 static struct frame_id
 tilegx_unwind_dummy_id (struct gdbarch *gdbarch,
 			struct frame_info *this_frame)
@@ -1028,7 +1022,6 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame Info.  */
   set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, tilegx_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, tilegx_unwind_dummy_id);
   set_gdbarch_frame_align (gdbarch, tilegx_frame_align);
   frame_base_set_default (gdbarch, &tilegx_frame_base);
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index ac7d6aa4240..ce8b400fcdb 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1333,13 +1333,6 @@ v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 } 
 
-static CORE_ADDR
-v850_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_pc_regnum (gdbarch));
-}
-
 static struct frame_id
 v850_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -1465,7 +1458,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, v850_frame_align);
   set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, v850_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, v850_dummy_id);
   frame_base_set_default (gdbarch, &v850_frame_base);
 
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 4c1ab2e73e6..a8c2b31dbdc 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -435,12 +435,6 @@ vax_frame_num_args (struct frame_info *frame)
   args = get_frame_register_unsigned (frame, VAX_AP_REGNUM);
   return get_frame_memory_unsigned (frame, args, 1);
 }
-
-static CORE_ADDR
-vax_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, VAX_PC_REGNUM);
-}
 \f
 
 /* Initialize the current architecture based on INFO.  If possible, re-use an
@@ -501,8 +495,6 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_deprecated_function_start_offset (gdbarch, 2);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
-  set_gdbarch_unwind_pc (gdbarch, vax_unwind_pc);
-
   frame_base_set_default (gdbarch, &vax_frame_base);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 31650ac3a95..4d5c50e0755 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -757,12 +757,6 @@ xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }
 
-static CORE_ADDR
-xstormy16_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
-}
-
 static struct frame_id
 xstormy16_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -825,7 +819,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
    * Frame Info
    */
   set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, xstormy16_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, xstormy16_dummy_id);
   set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
   frame_base_set_default (gdbarch, &xstormy16_frame_base);
-- 
2.14.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCHv2 0/4] Supply additional default gdbarch methods
  2018-03-07 22:04 ` [PATCH] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess
@ 2018-03-15 21:51 Andrew Burgess
  2018-03-07 22:04 ` [PATCH] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess
  2018-04-10 10:13 ` PING: Re: [PATCHv2 0/4] Supply additional default gdbarch methods Andrew Burgess
  4 siblings, 2 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-03-15 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Yao Qi, Simon Marchi, Andrew Burgess

This revision follows up on Simon's feedback.

Patch #1 has been extended to cover aarch64 and sparc.

Patch #2 rewrites default_unwind_pc as suggested, and allows even more
targets to use the default.

Patch #3 adds a default_dummy_id.

Patch #4 adds a default_unwind_sp.

For testing I've built a wide range of targets, I believe that most of
the targets I've touched have been built.

I've tested on x86-64 GNU/Linux (though that target hasn't changed),
and I've also run this patch through buildbot without issue.

Is there any additional testing I should run?

All feedback appreciated.

Thanks,
Andrew

---

Andrew Burgess (4):
  gdb: Add a default_unwind_pc method for gdbarch
  gdb: Remove more targets unwind_pc methods
  gdb: Supply a default for gdbarch_dummy_id
  gdb: Supply default gdbarch_unwind_sp and use where possible

 gdb/ChangeLog        | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/aarch64-tdep.c   |  38 ---------
 gdb/alpha-tdep.c     |  29 -------
 gdb/arc-tdep.c       |  14 ----
 gdb/arm-tdep.c       |  37 ---------
 gdb/bfin-tdep.c      |  18 -----
 gdb/cris-tdep.c      |  40 ----------
 gdb/dummy-frame.c    |  16 ++++
 gdb/dummy-frame.h    |   6 ++
 gdb/frame-unwind.c   |  32 ++++++++
 gdb/frame-unwind.h   |  12 +++
 gdb/frame.c          | 132 ++++++++++++++----------------
 gdb/frv-tdep.c       |  27 -------
 gdb/ft32-tdep.c      |  33 --------
 gdb/gdbarch.c        |  41 ++--------
 gdb/gdbarch.h        |   6 --
 gdb/gdbarch.sh       |   8 +-
 gdb/h8300-tdep.c     |  22 -----
 gdb/hppa-tdep.c      |   9 ---
 gdb/i386-tdep.c      |  13 ---
 gdb/iq2000-tdep.c    |  22 -----
 gdb/lm32-tdep.c      |  23 ------
 gdb/m32r-tdep.c      |  37 ---------
 gdb/m68hc11-tdep.c   |  24 ------
 gdb/m68k-tdep.c      |  10 ---
 gdb/m88k-tdep.c      |  21 -----
 gdb/mep-tdep.c       |  30 -------
 gdb/mn10300-tdep.c   |  32 +-------
 gdb/moxie-tdep.c     |  33 --------
 gdb/msp430-tdep.c    |  31 --------
 gdb/nds32-tdep.c     |  29 -------
 gdb/nios2-tdep.c     |  35 +-------
 gdb/or1k-tdep.c      |  10 ---
 gdb/riscv-tdep.c     |  30 -------
 gdb/rl78-tdep.c      |  20 -----
 gdb/rs6000-tdep.c    |  19 -----
 gdb/rx-tdep.c        |  33 --------
 gdb/s390-tdep.c      |  12 ---
 gdb/score-tdep.c     |  23 ------
 gdb/sh-tdep.c        |  25 ------
 gdb/sh64-tdep.c      |  25 ------
 gdb/sparc-tdep.c     |   9 ---
 gdb/tic6x-tdep.c     |  35 --------
 gdb/tilegx-tdep.c    |  26 ------
 gdb/v850-tdep.c      |  25 ------
 gdb/vax-tdep.c       |   8 --
 gdb/xstormy16-tdep.c |  23 ------
 47 files changed, 361 insertions(+), 1043 deletions(-)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCHv2 3/4] gdb: Supply a default for gdbarch_dummy_id
  2018-03-07 22:04 ` [PATCH] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess
                     ` (2 preceding siblings ...)
  2018-03-15 21:51   ` [PATCHv2 4/4] gdb: Supply default gdbarch_unwind_sp and use where possible Andrew Burgess
@ 2018-03-15 21:51   ` Andrew Burgess
  2018-03-15 21:51   ` [PATCHv2 2/4] gdb: Remove more targets unwind_pc methods Andrew Burgess
  4 siblings, 0 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-03-15 21:51 UTC (permalink / raw)
  To: gdb-patches; +Cc: Yao Qi, Simon Marchi, Andrew Burgess

A lot of targets use the same pattern for their implementation of
gdbarch_dummy_id.  Create a new function default_dummy_id and use this
as the default for gdbarch_dummy_id where possible.

gdb/ChangeLog:

	* aarch64-tdep.c (aarch64_dummy_id): Delete.
	(aarch64_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* alpha-tdep.c (alpha_dummy_id): Delete.
	(alpha_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* arc-tdep.c (arc_dummy_id): Delete.
	(arc_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* arm-tdep.c (arm_dummy_id): Delete.
	(arm_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* bfin-tdep.c (bfin_dummy_id): Delete.
	(bfin_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* cris-tdep.c (cris_dummy_id): Delete.
	(cris_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* dummy-frame.c (default_dummy_id): Defined new function.
	* dummy-frame.h (default_dummy_id): Declare new function.
	* frv-tdep.c (frv_dummy_id): Delete.
	(frv_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* ft32-tdep.c (ft32_dummy_id): Delete.
	(ft32_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.
	* gdbarch.sh: Remove predicate function, and supply default for
	dummy_id method.  Add 'dummy-frame.h' header.
	* h8300-tdep.c (h8300_dummy_id): Delete.
	(h8300_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* hppa-tdep.c (hppa_dummy_id): Delete.
	(hppa_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* iq2000-tdep.c (iq2000_dummy_id): Delete.
	(iq2000_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* lm32-tdep.c (lm32_dummy_id): Delete.
	(lm32_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* m32r-tdep.c (m32r_dummy_id): Delete.
	(m32r_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* m88k-tdep.c (m88k_dummy_id): Delete.
	(m88k_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* mep-tdep.c (mep_dummy_id): Delete.
	(mep_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* mn10300-tdep.c (mn10300_dummy_id): Delete.
	(mn10300_frame_unwind_init): Don't call set_gdbarch_dummy_id.
	* moxie-tdep.c (moxie_dummy_id): Delete.
	(moxie_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* msp430-tdep.c (msp430_dummy_id): Delete.
	(msp430_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* nds32-tdep.c (nds32_dummy_id): Delete.
	(nds32_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* nios2-tdep.c (nios2_dummy_id): Delete.
	(nios2_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* or1k-tdep.c (or1k_dummy_id): Delete.
	(or1k_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* riscv-tdep.c (riscv_dummy_id): Delete.
	(riscv_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* rs6000-tdep.c (rs6000_dummy_id): Delete.
	(rs6000_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* rx-tdep.c (rx_dummy_id): Delete.
	(rx_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* score-tdep.c (score_dummy_id): Delete.
	(score_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* sh-tdep.c (sh_dummy_id): Delete.
	(sh_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* sh64-tdep.c (sh64_dummy_id): Delete.
	(sh64_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* tic6x-tdep.c (tic6x_dummy_id): Delete.
	(tic6x_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* tilegx-tdep.c (tilegx_unwind_dummy_id): Delete.
	(tilegx_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* v850-tdep.c (v850_dummy_id): Delete.
	(v850_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* gdb/xstormy16-tdep.c (xstormy16_dummy_id): Delete.
	(xstormy16_gdbarch_init): Don't call set_gdbarch_dummy_id.
---
 gdb/ChangeLog        | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/aarch64-tdep.c   | 15 -----------
 gdb/alpha-tdep.c     | 18 -------------
 gdb/arc-tdep.c       | 14 -----------
 gdb/arm-tdep.c       | 15 -----------
 gdb/bfin-tdep.c      | 11 --------
 gdb/cris-tdep.c      | 13 ----------
 gdb/dummy-frame.c    | 16 ++++++++++++
 gdb/dummy-frame.h    |  6 +++++
 gdb/frv-tdep.c       | 13 ----------
 gdb/ft32-tdep.c      | 13 ----------
 gdb/gdbarch.c        | 14 +++--------
 gdb/gdbarch.h        |  2 --
 gdb/gdbarch.sh       |  3 ++-
 gdb/h8300-tdep.c     |  8 ------
 gdb/hppa-tdep.c      |  9 -------
 gdb/iq2000-tdep.c    |  8 ------
 gdb/lm32-tdep.c      |  9 -------
 gdb/m32r-tdep.c      | 17 -------------
 gdb/m88k-tdep.c      | 10 --------
 gdb/mep-tdep.c       | 10 --------
 gdb/mn10300-tdep.c   | 10 --------
 gdb/moxie-tdep.c     | 13 ----------
 gdb/msp430-tdep.c    | 13 ----------
 gdb/nds32-tdep.c     | 11 --------
 gdb/nios2-tdep.c     | 11 --------
 gdb/or1k-tdep.c      | 10 --------
 gdb/riscv-tdep.c     | 10 --------
 gdb/rs6000-tdep.c    | 10 --------
 gdb/rx-tdep.c        | 10 --------
 gdb/score-tdep.c     |  9 -------
 gdb/sh-tdep.c        |  9 -------
 gdb/sh64-tdep.c      |  9 -------
 gdb/tic6x-tdep.c     | 12 ---------
 gdb/tilegx-tdep.c    | 12 ---------
 gdb/v850-tdep.c      |  9 -------
 gdb/xstormy16-tdep.c |  9 -------
 37 files changed, 98 insertions(+), 364 deletions(-)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 0f123de6b35..7b41ee0466c 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -974,20 +974,6 @@ struct frame_base aarch64_normal_base =
   aarch64_normal_frame_base
 };
 
-/* Assuming THIS_FRAME is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos () and returned from
-   aarch64_push_dummy_call, and the PC needs to match the dummy
-   frame's breakpoint.  */
-
-static struct frame_id
-aarch64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned (this_frame,
-						      AARCH64_SP_REGNUM),
-			 get_frame_pc (this_frame));
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -2928,7 +2914,6 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_align (gdbarch, aarch64_frame_align);
 
   /* Frame handling.  */
-  set_gdbarch_dummy_id (gdbarch, aarch64_dummy_id);
   set_gdbarch_unwind_sp (gdbarch, aarch64_unwind_sp);
 
   /* Advance PC across function entry code.  */
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 81ee43c9fa4..d11e5bf1184 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -1464,21 +1464,6 @@ reinit_frame_cache_sfunc (const char *args,
 {
   reinit_frame_cache ();
 }
-
-\f
-/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos(), and the PC match the dummy frame's
-   breakpoint.  */
-
-static struct frame_id
-alpha_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST base;
-  base = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM);
-  return frame_id_build (base, get_frame_pc (this_frame));
-}
-
 \f
 /* Helper routines for alpha*-nat.c files to move register sets to and
    from core files.  The UNIQUE pointer is allowed to be NULL, as most
@@ -1802,9 +1787,6 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Settings for calling functions in the inferior.  */
   set_gdbarch_push_dummy_call (gdbarch, alpha_push_dummy_call);
 
-  /* Methods for saving / extracting a dummy frame's ID.  */
-  set_gdbarch_dummy_id (gdbarch, alpha_dummy_id);
-
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index b0d51addd39..fb3f865b25d 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -509,19 +509,6 @@ arc_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
   *offset_ptr = 0;
 }
 
-/* Implement the "dummy_id" gdbarch method.
-
-   Tear down a dummy frame created by arc_push_dummy_call ().  This data has
-   to be constructed manually from the data in our hand.  The stack pointer
-   and program counter can be obtained from the frame info.  */
-
-static struct frame_id
-arc_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_sp (this_frame),
-			 get_frame_pc (this_frame));
-}
-
 /* Implement the "push_dummy_call" gdbarch method.
 
    Stack Frame Layout
@@ -2005,7 +1992,6 @@ arc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_ps_regnum (gdbarch, ARC_STATUS32_REGNUM);
   set_gdbarch_fp0_regnum (gdbarch, -1);	/* No FPU registers.  */
 
-  set_gdbarch_dummy_id (gdbarch, arc_dummy_id);
   set_gdbarch_push_dummy_call (gdbarch, arc_push_dummy_call);
   set_gdbarch_push_dummy_code (gdbarch, arc_push_dummy_code);
 
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 98efc454044..e8179e6699b 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -3055,20 +3055,6 @@ struct frame_base arm_normal_base = {
   arm_normal_frame_base
 };
 
-/* Assuming THIS_FRAME is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos() and returned from
-   arm_push_dummy_call, and the PC needs to match the dummy frame's
-   breakpoint.  */
-
-static struct frame_id
-arm_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned (this_frame,
-						      ARM_SP_REGNUM),
-			 get_frame_pc (this_frame));
-}
-
 static CORE_ADDR
 arm_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -9351,7 +9337,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_write_pc (gdbarch, arm_write_pc);
 
   /* Frame handling.  */
-  set_gdbarch_dummy_id (gdbarch, arm_dummy_id);
   set_gdbarch_unwind_sp (gdbarch, arm_unwind_sp);
 
   frame_base_set_default (gdbarch, &arm_normal_base);
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index 696786dc1b0..9b05de3623e 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -756,16 +756,6 @@ static const struct frame_base bfin_frame_base =
   bfin_frame_args_address
 };
 
-static struct frame_id
-bfin_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp;
-
-  sp = get_frame_register_unsigned (this_frame, BFIN_SP_REGNUM);
-
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 static CORE_ADDR
 bfin_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
 {
@@ -820,7 +810,6 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_dwarf2_reg_to_regnum (gdbarch, bfin_reg_to_regnum);
   set_gdbarch_register_name (gdbarch, bfin_register_name);
   set_gdbarch_register_type (gdbarch, bfin_register_type);
-  set_gdbarch_dummy_id (gdbarch, bfin_dummy_id);
   set_gdbarch_push_dummy_call (gdbarch, bfin_push_dummy_call);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
   set_gdbarch_return_value (gdbarch, bfin_return_value);
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 74368b7b0a4..fdcb6490c98 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -764,18 +764,6 @@ cris_frame_prev_register (struct frame_info *this_frame,
   return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
 }
 
-/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
-   frame.  The frame ID's base needs to match the TOS value saved by
-   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
-
-static struct frame_id
-cris_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp;
-  sp = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 static CORE_ADDR
 cris_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
 {
@@ -4085,7 +4073,6 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, cris_sw_breakpoint_from_kind);
   
   set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, cris_dummy_id);
 
   if (tdep->cris_dwarf2_cfi == 1)
     {
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index a67033e6f2c..0ff22d52b12 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -385,6 +385,22 @@ const struct frame_unwind dummy_frame_unwind =
   dummy_frame_sniffer,
 };
 
+/* Default implementation of gdbarch_dummy_id.  Generate frame_id for
+   THIS_FRAME assuming that it is a dummy frame.  A dummy frame is created
+   before an inferior call, the frame_id returned here must match the base
+   address returned by gdbarch_push_dummy_call and the frame's pc must
+   match the dummy frames breakpoint address.  */
+
+struct frame_id
+default_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
+{
+  CORE_ADDR sp, pc;
+
+  sp = get_frame_sp (this_frame);
+  pc = get_frame_pc (this_frame);
+  return frame_id_build (sp, pc);
+}
+
 static void
 fprint_dummy_frames (struct ui_file *file)
 {
diff --git a/gdb/dummy-frame.h b/gdb/dummy-frame.h
index cad99609927..342e97a327b 100644
--- a/gdb/dummy-frame.h
+++ b/gdb/dummy-frame.h
@@ -71,4 +71,10 @@ extern void register_dummy_frame_dtor (struct frame_id dummy_id, ptid_t ptid,
 extern int find_dummy_frame_dtor (dummy_frame_dtor_ftype *dtor,
 				  void *dtor_data);
 
+/* Default implementation of gdbarch_dummy_id.  Generate a dummy frame_id
+   for THIS_FRAME assuming that the frame is a dummy frame.  */
+
+extern struct frame_id default_dummy_id (struct gdbarch *gdbarch,
+					 struct frame_info *this_frame);
+
 #endif /* !defined (DUMMY_FRAME_H)  */
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 38f996d2e5c..ab49a2bff50 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1438,18 +1438,6 @@ frv_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, sp_regnum);
 }
 
-
-/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
-   frame.  The frame ID's base needs to match the TOS value saved by
-   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
-
-static struct frame_id
-frv_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, sp_regnum);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 static struct gdbarch *
 frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
@@ -1541,7 +1529,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Settings for calling functions in the inferior.  */
   set_gdbarch_push_dummy_call (gdbarch, frv_push_dummy_call);
-  set_gdbarch_dummy_id (gdbarch, frv_dummy_id);
 
   /* Settings that should be unnecessary.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 5c0a3384dbd..79cf1a08c1d 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -559,14 +559,6 @@ static const struct frame_base ft32_frame_base =
   ft32_frame_base_address
 };
 
-static struct frame_id
-ft32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, FT32_SP_REGNUM);
-
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 /* Allocate and initialize the ft32 gdbarch object.  */
 
 static struct gdbarch *
@@ -614,11 +606,6 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   frame_base_set_default (gdbarch, &ft32_frame_base);
 
-  /* Methods for saving / extracting a dummy frame's ID.  The ID's
-     stack address must match the SP value returned by
-     PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
-  set_gdbarch_dummy_id (gdbarch, ft32_dummy_id);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 884b7b24f86..1789eabae01 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -49,6 +49,7 @@
 #include "objfiles.h"
 #include "auxv.h"
 #include "frame-unwind.h"
+#include "dummy-frame.h"
 
 /* Static function declarations */
 
@@ -408,6 +409,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->ecoff_reg_to_regnum = no_op_reg_to_regnum;
   gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum;
   gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum;
+  gdbarch->dummy_id = default_dummy_id;
   gdbarch->deprecated_fp_regnum = -1;
   gdbarch->call_dummy_location = AT_ENTRY_POINT;
   gdbarch->code_of_frame_writable = default_code_of_frame_writable;
@@ -575,7 +577,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   if (gdbarch->register_name == 0)
     log.puts ("\n\tregister_name");
   /* Skip verify of register_type, has predicate.  */
-  /* Skip verify of dummy_id, has predicate.  */
+  /* Skip verify of dummy_id, invalid_p == 0 */
   /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
   /* Skip verify of push_dummy_call, has predicate.  */
   /* Skip verify of call_dummy_location, invalid_p == 0 */
@@ -954,9 +956,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "gdbarch_dump: dtrace_probe_is_enabled = <%s>\n",
                       host_address_to_string (gdbarch->dtrace_probe_is_enabled));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_dummy_id_p() = %d\n",
-                      gdbarch_dummy_id_p (gdbarch));
   fprintf_unfiltered (file,
                       "gdbarch_dump: dummy_id = <%s>\n",
                       host_address_to_string (gdbarch->dummy_id));
@@ -2318,13 +2317,6 @@ set_gdbarch_register_type (struct gdbarch *gdbarch,
   gdbarch->register_type = register_type;
 }
 
-int
-gdbarch_dummy_id_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->dummy_id != NULL;
-}
-
 struct frame_id
 gdbarch_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 2ac229cda3a..be6a945a7ca 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -383,8 +383,6 @@ typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, in
 extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr);
 extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type);
 
-extern int gdbarch_dummy_id_p (struct gdbarch *gdbarch);
-
 typedef struct frame_id (gdbarch_dummy_id_ftype) (struct gdbarch *gdbarch, struct frame_info *this_frame);
 extern struct frame_id gdbarch_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame);
 extern void set_gdbarch_dummy_id (struct gdbarch *gdbarch, gdbarch_dummy_id_ftype *dummy_id);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 9eab0b30321..d5409d1b2f0 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -483,7 +483,7 @@ m;const char *;register_name;int regnr;regnr;;0
 # use "register_type".
 M;struct type *;register_type;int reg_nr;reg_nr
 
-M;struct frame_id;dummy_id;struct frame_info *this_frame;this_frame
+m;struct frame_id;dummy_id;struct frame_info *this_frame;this_frame;;default_dummy_id;;0
 # Implement DUMMY_ID and PUSH_DUMMY_CALL, then delete
 # deprecated_fp_regnum.
 v;int;deprecated_fp_regnum;;;-1;-1;;0
@@ -1649,6 +1649,7 @@ cat <<EOF
 #include "objfiles.h"
 #include "auxv.h"
 #include "frame-unwind.h"
+#include "dummy-frame.h"
 
 /* Static function declarations */
 
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index b7670ea2cec..16ece47cc4c 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -98,13 +98,6 @@ h8300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }
 
-static struct frame_id
-h8300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 /* Normal frames.  */
 
 /* Allocate and initialize a frame cache.  */
@@ -1348,7 +1341,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame unwinder.  */
   set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, h8300_dummy_id);
   frame_base_set_default (gdbarch, &h8300_frame_base);
 
   /* 
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 84dbd667485..dea3c5d5291 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2513,14 +2513,6 @@ static const struct frame_unwind hppa_stub_frame_unwind = {
   hppa_stub_unwind_sniffer
 };
 
-static struct frame_id
-hppa_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned (this_frame,
-                                                      HPPA_SP_REGNUM),
-			 get_frame_pc (this_frame));
-}
-
 CORE_ADDR
 hppa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -3163,7 +3155,6 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read);
 
   /* Frame unwind methods.  */
-  set_gdbarch_dummy_id (gdbarch, hppa_dummy_id);
   set_gdbarch_unwind_pc (gdbarch, hppa_unwind_pc);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index 9316bbb852f..7fc4c5d05a1 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -440,13 +440,6 @@ iq2000_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }   
 
-static struct frame_id
-iq2000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 static CORE_ADDR
 iq2000_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -835,7 +828,6 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_type (gdbarch, iq2000_register_type);
   set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
   set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, iq2000_dummy_id);
   frame_base_set_default (gdbarch, &iq2000_frame_base);
   set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call);
 
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 26f2faee365..651b09c73ec 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -388,14 +388,6 @@ lm32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, SIM_LM32_SP_REGNUM);
 }
 
-static struct frame_id
-lm32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, SIM_LM32_SP_REGNUM);
-
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 /* Put here the code to store, into fi->saved_regs, the addresses of
    the saved registers of frame described by FRAME_INFO.  This
    includes special registers such as pc and fp saved in special ways
@@ -546,7 +538,6 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_align (gdbarch, lm32_frame_align);
   frame_base_set_default (gdbarch, &lm32_frame_base);
   set_gdbarch_unwind_sp (gdbarch, lm32_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, lm32_dummy_id);
   frame_unwind_append_unwinder (gdbarch, &lm32_frame_unwind);
 
   /* Breakpoints.  */
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 9bfff6b0675..77019162d22 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -864,18 +864,6 @@ static const struct frame_base m32r_frame_base = {
   m32r_frame_base_address
 };
 
-/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
-   frame.  The frame ID's base needs to match the TOS value saved by
-   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
-
-static struct frame_id
-m32r_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
-
 static gdbarch_init_ftype m32r_gdbarch_init;
 
 static struct gdbarch *
@@ -920,11 +908,6 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   frame_base_set_default (gdbarch, &m32r_frame_base);
 
-  /* Methods for saving / extracting a dummy frame's ID.  The ID's
-     stack address must match the SP value returned by
-     PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
-  set_gdbarch_dummy_id (gdbarch, m32r_dummy_id);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index de5e1ffc325..e9d7f73b4d0 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -350,15 +350,6 @@ m88k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   /* Return the stack pointer.  */
   return sp;
 }
-
-static struct frame_id
-m88k_dummy_id (struct gdbarch *arch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp;
-
-  sp = get_frame_register_unsigned (this_frame, M88K_R31_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
 \f
 
 /* Determine, for architecture GDBARCH, how a return value of TYPE
@@ -835,7 +826,6 @@ m88k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Call dummy code.  */
   set_gdbarch_push_dummy_call (gdbarch, m88k_push_dummy_call);
-  set_gdbarch_dummy_id (gdbarch, m88k_dummy_id);
 
   /* Return value info.  */
   set_gdbarch_return_value (gdbarch, m88k_return_value);
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index af921a86c0c..ebd4890f273 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -2333,15 +2333,6 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   return sp;
 }
 
-
-static struct frame_id
-mep_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, MEP_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
-
 \f
 /* Initialization.  */
 
@@ -2470,7 +2461,6 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Inferior function calls.  */
   set_gdbarch_frame_align (gdbarch, mep_frame_align);
   set_gdbarch_push_dummy_call (gdbarch, mep_push_dummy_call);
-  set_gdbarch_dummy_id (gdbarch, mep_dummy_id);
 
   return gdbarch;
 }
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 0222b3192d1..b05dec16365 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1099,15 +1099,6 @@ mn10300_frame_base (struct frame_info *this_frame, void **this_prologue_cache)
     }
 }
 
-/* Here is a dummy implementation.  */
-static struct frame_id
-mn10300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
-  CORE_ADDR pc = get_frame_register_unsigned (this_frame, E_PC_REGNUM);
-  return frame_id_build (sp, pc);
-}
-
 static void
 mn10300_frame_this_id (struct frame_info *this_frame,
 		       void **this_prologue_cache,
@@ -1164,7 +1155,6 @@ mn10300_frame_unwind_init (struct gdbarch *gdbarch)
 {
   dwarf2_append_unwinders (gdbarch);
   frame_unwind_append_unwinder (gdbarch, &mn10300_frame_unwind);
-  set_gdbarch_dummy_id (gdbarch, mn10300_dummy_id);
   set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp);
 }
 
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 2ef1b753109..9ace7a4588a 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -622,14 +622,6 @@ static const struct frame_base moxie_frame_base = {
   moxie_frame_base_address
 };
 
-static struct frame_id
-moxie_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, MOXIE_SP_REGNUM);
-
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 /* Parse the current instruction and record the values of the registers and
    memory that will be changed in current instruction to "record_arch_list".
    Return -1 if something wrong.  */
@@ -1102,11 +1094,6 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   frame_base_set_default (gdbarch, &moxie_frame_base);
 
-  /* Methods for saving / extracting a dummy frame's ID.  The ID's
-     stack address must match the SP value returned by
-     PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
-  set_gdbarch_dummy_id (gdbarch, moxie_dummy_id);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 008a178e993..d89f4450166 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -643,18 +643,6 @@ msp430_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
 }
 
 
-/* Implement the "dummy_id" gdbarch method.  */
-
-static struct frame_id
-msp430_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return
-    frame_id_build (get_frame_register_unsigned
-		    (this_frame, MSP430_SP_REGNUM),
-		    get_frame_pc (this_frame));
-}
-
-
 /* Implement the "push_dummy_call" gdbarch method.  */
 
 static CORE_ADDR
@@ -993,7 +981,6 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   frame_unwind_append_unwinder (gdbarch, &msp430_unwind);
 
   /* Dummy frames, return values.  */
-  set_gdbarch_dummy_id (gdbarch, msp430_dummy_id);
   set_gdbarch_push_dummy_call (gdbarch, msp430_push_dummy_call);
   set_gdbarch_return_value (gdbarch, msp430_return_value);
 
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index 9fe4f6916e3..2a169d6eea4 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -1388,16 +1388,6 @@ static const struct frame_unwind nds32_epilogue_frame_unwind =
   nds32_epilogue_frame_sniffer
 };
 \f
-/* Implement the "dummy_id" gdbarch method.  */
-
-static struct frame_id
-nds32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, NDS32_SP_REGNUM);
-
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -2138,7 +2128,6 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_push_dummy_call (gdbarch, nds32_push_dummy_call);
   set_gdbarch_return_value (gdbarch, nds32_return_value);
-  set_gdbarch_dummy_id (gdbarch, nds32_dummy_id);
 
   set_gdbarch_skip_prologue (gdbarch, nds32_skip_prologue);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index 3972dd9437d..f4d22597b76 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1798,16 +1798,6 @@ nios2_return_value (struct gdbarch *gdbarch, struct value *function,
   return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-/* Implement the dummy_id gdbarch method.  */
-
-static struct frame_id
-nios2_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build
-    (get_frame_register_unsigned (this_frame, NIOS2_SP_REGNUM),
-     get_frame_pc (this_frame));
-}
-
 /* Implement the push_dummy_call gdbarch method.  */
 
 static CORE_ADDR
@@ -2310,7 +2300,6 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_breakpoint_kind_from_pc (gdbarch, nios2_breakpoint_kind_from_pc);
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, nios2_sw_breakpoint_from_kind);
 
-  set_gdbarch_dummy_id (gdbarch, nios2_dummy_id);
   set_gdbarch_unwind_sp (gdbarch, nios2_unwind_sp);
 
   /* The dwarf2 unwinder will normally produce the best results if
diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index 329615f2d39..89e83feac54 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -788,15 +788,6 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
   return sp;
 }
-
-/* Implement the dummy_id gdbarch method.  */
-
-static struct frame_id
-or1k_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_sp (this_frame),
-			 get_frame_pc (this_frame));
-}
 \f
 
 /* Support functions for frame handling.  */
@@ -1184,7 +1175,6 @@ or1k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
   set_gdbarch_push_dummy_code (gdbarch, or1k_push_dummy_code);
   set_gdbarch_push_dummy_call (gdbarch, or1k_push_dummy_call);
-  set_gdbarch_dummy_id (gdbarch, or1k_dummy_id);
 
   /* Frame unwinders.  Use DWARF debug info if available, otherwise use our
      own unwinder.  */
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 58c3f30ffe3..12cf09d62fb 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -2333,15 +2333,6 @@ riscv_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, RISCV_SP_REGNUM);
 }
 
-/* Implement the dummy_id gdbarch method.  */
-
-static struct frame_id
-riscv_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_signed (this_frame, RISCV_SP_REGNUM),
-			 get_frame_pc (this_frame));
-}
-
 /* Generate, or return the cached frame cache for the RiscV frame
    unwinder.  */
 
@@ -2545,7 +2536,6 @@ riscv_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
   set_gdbarch_push_dummy_code (gdbarch, riscv_push_dummy_code);
   set_gdbarch_push_dummy_call (gdbarch, riscv_push_dummy_call);
-  set_gdbarch_dummy_id (gdbarch, riscv_dummy_id);
 
   /* Frame unwinders.  Use DWARF debug info if available, otherwise use our own
      unwinder.  */
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 66c88d452f5..9b797a721bf 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3255,14 +3255,6 @@ find_variant_by_arch (enum bfd_architecture arch, unsigned long mach)
 }
 
 \f
-static struct frame_id
-rs6000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned
-			  (this_frame, gdbarch_sp_regnum (gdbarch)),
-			 get_frame_pc (this_frame));
-}
-
 struct rs6000_frame_cache
 {
   CORE_ADDR base;
@@ -6573,7 +6565,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     case GDB_OSABI_UNKNOWN:
       frame_unwind_append_unwinder (gdbarch, &rs6000_epilogue_frame_unwind);
       frame_unwind_append_unwinder (gdbarch, &rs6000_frame_unwind);
-      set_gdbarch_dummy_id (gdbarch, rs6000_dummy_id);
       frame_base_append_sniffer (gdbarch, rs6000_frame_base_sniffer);
       break;
     default:
@@ -6581,7 +6572,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
       frame_unwind_append_unwinder (gdbarch, &rs6000_epilogue_frame_unwind);
       frame_unwind_append_unwinder (gdbarch, &rs6000_frame_unwind);
-      set_gdbarch_dummy_id (gdbarch, rs6000_dummy_id);
       frame_base_append_sniffer (gdbarch, rs6000_frame_base_sniffer);
     }
 
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 3d982795db4..07e83d0e11e 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -761,15 +761,6 @@ rx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
   return sp;
 }
 
-/* Implement the "dummy_id" gdbarch method.  */
-static struct frame_id
-rx_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return
-    frame_id_build (get_frame_register_unsigned (this_frame, RX_SP_REGNUM),
-		    get_frame_pc (this_frame));
-}
-
 /* Implement the "push_dummy_call" gdbarch method.  */
 static CORE_ADDR
 rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
@@ -1137,7 +1128,6 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Methods for saving / extracting a dummy frame's ID.
      The ID's stack address must match the SP value returned by
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
-  set_gdbarch_dummy_id (gdbarch, rx_dummy_id);
   set_gdbarch_push_dummy_call (gdbarch, rx_push_dummy_call);
   set_gdbarch_return_value (gdbarch, rx_return_value);
 
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index c0f1291ed52..9f2cdc992d9 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -472,14 +472,6 @@ score_return_value (struct gdbarch *gdbarch, struct value *function,
     }
 }
 
-static struct frame_id
-score_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned (this_frame,
-						      SCORE_SP_REGNUM),
-			 get_frame_pc (this_frame));
-}
-
 static int
 score_type_needs_double_align (struct type *type)
 {
@@ -1512,7 +1504,6 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Dummy frame hooks.  */
   set_gdbarch_return_value (gdbarch, score_return_value);
   set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
-  set_gdbarch_dummy_id (gdbarch, score_dummy_id);
   set_gdbarch_push_dummy_call (gdbarch, score_push_dummy_call);
 
   /* Normal frame hooks.  */
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 2f022909d6d..c672ba5cfe5 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1983,14 +1983,6 @@ sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 }
 
-static struct frame_id
-sh_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame,
-					      gdbarch_sp_regnum (gdbarch));
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 static CORE_ADDR
 sh_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -2304,7 +2296,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, sh_frame_align);
   set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, sh_dummy_id);
   frame_base_set_default (gdbarch, &sh_frame_base);
 
   set_gdbarch_stack_frame_destroyed_p (gdbarch, sh_stack_frame_destroyed_p);
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 9066c7cd9fe..8d27bdb0da3 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -2319,14 +2319,6 @@ sh64_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 }
 
-static struct frame_id
-sh64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame,
-					      gdbarch_sp_regnum (gdbarch));
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 static CORE_ADDR
 sh64_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -2414,7 +2406,6 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, sh64_frame_align);
   set_gdbarch_unwind_sp (gdbarch, sh64_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, sh64_dummy_id);
   frame_base_set_default (gdbarch, &sh64_frame_base);
 
   set_gdbarch_print_registers_info (gdbarch, sh64_print_registers_info);
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index f1aaaa3c36a..d9637f0feff 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -803,16 +803,6 @@ tic6x_return_value (struct gdbarch *gdbarch, struct value *function,
   return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-/* This is the implementation of gdbarch method dummy_id.  */
-
-static struct frame_id
-tic6x_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build
-    (get_frame_register_unsigned (this_frame, TIC6X_SP_REGNUM),
-     get_frame_pc (this_frame));
-}
-
 /* Get the alignment requirement of TYPE.  */
 
 static int
@@ -1298,8 +1288,6 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_return_value (gdbarch, tic6x_return_value);
 
-  set_gdbarch_dummy_id (gdbarch, tic6x_dummy_id);
-
   /* Enable inferior call support.  */
   set_gdbarch_push_dummy_call (gdbarch, tic6x_push_dummy_call);
 
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 2ed32e3dfa8..df6bdf05daa 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -936,17 +936,6 @@ tilegx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, TILEGX_SP_REGNUM);
 }
 
-static struct frame_id
-tilegx_unwind_dummy_id (struct gdbarch *gdbarch,
-			struct frame_info *this_frame)
-{
-  CORE_ADDR sp;
-
-  sp = get_frame_register_unsigned (this_frame, TILEGX_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
-
 /* We cannot read/write the "special" registers.  */
 
 static int
@@ -1022,7 +1011,6 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame Info.  */
   set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, tilegx_unwind_dummy_id);
   set_gdbarch_frame_align (gdbarch, tilegx_frame_align);
   frame_base_set_default (gdbarch, &tilegx_frame_base);
 
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index ce8b400fcdb..f2322f10802 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1333,14 +1333,6 @@ v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 } 
 
-static struct frame_id
-v850_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame,
-					      gdbarch_sp_regnum (gdbarch));
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-  
 static CORE_ADDR
 v850_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -1458,7 +1450,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, v850_frame_align);
   set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, v850_dummy_id);
   frame_base_set_default (gdbarch, &v850_frame_base);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 4d5c50e0755..ca00c14dcb2 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -757,14 +757,6 @@ xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }
 
-static struct frame_id
-xstormy16_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
-
 /* Function: xstormy16_gdbarch_init
    Initializer function for the xstormy16 gdbarch vector.
    Called by gdbarch.  Sets up the gdbarch vector(s) for this target.  */
@@ -819,7 +811,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
    * Frame Info
    */
   set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, xstormy16_dummy_id);
   set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
   frame_base_set_default (gdbarch, &xstormy16_frame_base);
 
-- 
2.14.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* PING: Re: [PATCHv2 0/4] Supply additional default gdbarch methods
  2018-03-15 21:51 [PATCHv2 0/4] Supply additional default gdbarch methods Andrew Burgess
  2018-03-07 22:04 ` [PATCH] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess
@ 2018-04-10 10:13 ` Andrew Burgess
  2018-06-05 14:35   ` [PATCHv3 " Andrew Burgess
                     ` (4 more replies)
  1 sibling, 5 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-04-10 10:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Yao Qi, Simon Marchi

Ping.

Thanks,
Andrew

* Andrew Burgess <andrew.burgess@embecosm.com> [2018-03-15 21:51:20 +0000]:

> This revision follows up on Simon's feedback.
> 
> Patch #1 has been extended to cover aarch64 and sparc.
> 
> Patch #2 rewrites default_unwind_pc as suggested, and allows even more
> targets to use the default.
> 
> Patch #3 adds a default_dummy_id.
> 
> Patch #4 adds a default_unwind_sp.
> 
> For testing I've built a wide range of targets, I believe that most of
> the targets I've touched have been built.
> 
> I've tested on x86-64 GNU/Linux (though that target hasn't changed),
> and I've also run this patch through buildbot without issue.
> 
> Is there any additional testing I should run?
> 
> All feedback appreciated.
> 
> Thanks,
> Andrew
> 
> ---
> 
> Andrew Burgess (4):
>   gdb: Add a default_unwind_pc method for gdbarch
>   gdb: Remove more targets unwind_pc methods
>   gdb: Supply a default for gdbarch_dummy_id
>   gdb: Supply default gdbarch_unwind_sp and use where possible
> 
>  gdb/ChangeLog        | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  gdb/aarch64-tdep.c   |  38 ---------
>  gdb/alpha-tdep.c     |  29 -------
>  gdb/arc-tdep.c       |  14 ----
>  gdb/arm-tdep.c       |  37 ---------
>  gdb/bfin-tdep.c      |  18 -----
>  gdb/cris-tdep.c      |  40 ----------
>  gdb/dummy-frame.c    |  16 ++++
>  gdb/dummy-frame.h    |   6 ++
>  gdb/frame-unwind.c   |  32 ++++++++
>  gdb/frame-unwind.h   |  12 +++
>  gdb/frame.c          | 132 ++++++++++++++----------------
>  gdb/frv-tdep.c       |  27 -------
>  gdb/ft32-tdep.c      |  33 --------
>  gdb/gdbarch.c        |  41 ++--------
>  gdb/gdbarch.h        |   6 --
>  gdb/gdbarch.sh       |   8 +-
>  gdb/h8300-tdep.c     |  22 -----
>  gdb/hppa-tdep.c      |   9 ---
>  gdb/i386-tdep.c      |  13 ---
>  gdb/iq2000-tdep.c    |  22 -----
>  gdb/lm32-tdep.c      |  23 ------
>  gdb/m32r-tdep.c      |  37 ---------
>  gdb/m68hc11-tdep.c   |  24 ------
>  gdb/m68k-tdep.c      |  10 ---
>  gdb/m88k-tdep.c      |  21 -----
>  gdb/mep-tdep.c       |  30 -------
>  gdb/mn10300-tdep.c   |  32 +-------
>  gdb/moxie-tdep.c     |  33 --------
>  gdb/msp430-tdep.c    |  31 --------
>  gdb/nds32-tdep.c     |  29 -------
>  gdb/nios2-tdep.c     |  35 +-------
>  gdb/or1k-tdep.c      |  10 ---
>  gdb/riscv-tdep.c     |  30 -------
>  gdb/rl78-tdep.c      |  20 -----
>  gdb/rs6000-tdep.c    |  19 -----
>  gdb/rx-tdep.c        |  33 --------
>  gdb/s390-tdep.c      |  12 ---
>  gdb/score-tdep.c     |  23 ------
>  gdb/sh-tdep.c        |  25 ------
>  gdb/sh64-tdep.c      |  25 ------
>  gdb/sparc-tdep.c     |   9 ---
>  gdb/tic6x-tdep.c     |  35 --------
>  gdb/tilegx-tdep.c    |  26 ------
>  gdb/v850-tdep.c      |  25 ------
>  gdb/vax-tdep.c       |   8 --
>  gdb/xstormy16-tdep.c |  23 ------
>  47 files changed, 361 insertions(+), 1043 deletions(-)
> 
> -- 
> 2.14.3
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCHv3 2/4] gdb: Remove more targets unwind_pc methods
  2018-04-10 10:13 ` PING: Re: [PATCHv2 0/4] Supply additional default gdbarch methods Andrew Burgess
  2018-06-05 14:35   ` [PATCHv3 " Andrew Burgess
  2018-06-05 14:35   ` [PATCHv3 4/4] gdb: Supply default gdbarch_unwind_sp and use where possible Andrew Burgess
@ 2018-06-05 14:35   ` Andrew Burgess
  2018-06-05 14:35   ` [PATCHv3 3/4] gdb: Supply a default for gdbarch_dummy_id Andrew Burgess
  2018-06-05 14:35   ` [PATCHv3 1/4] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess
  4 siblings, 0 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-06-05 14:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

This commit rewrites default_unwind_pc to avoid short cutting the
steps of uninding the pc.  The new version of default_unwind_pc
contains calls to extract_typed_address (which wraps
gdbarch_pointer_to_address) and gdbarch_addr_bits_remove.  Targets
that don't override these methods will get the same behaviour as they
did before, but targets that do use these methods (and so need to call
them while unwinding the pc) can now use the default_unwind_pc method.

gdb/ChangeLog:

	* arm-tdep.c (arm_unwind_pc): Delete.
	(arm_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* frame-unwind.c (default_unwind_pc): Rewrite to call
	extract_typed_address and gdbarch_addr_bits_remove.
	* i386-tdep.c (i386_unwind_pc): Delete.
	(i386_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* m68k-tdep.c (m68k_unwind_pc): Delete.
	(m68k_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* m88k-tdep.c (m88k_unwind_pc): Delete.
	(nios2_get_next_pc): Update to call gdbarch_unwind_pc.
	(nios2_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* rl78-tdep.c (rl78_unwind_pc): Delete.
	(rl78_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* s390-tdep.c (s390_unwind_pc): Delete.
	(s390_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* tic6x-tdep.c (tic6x_unwind_pc): Delete.
	(tic6x_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
---
 gdb/ChangeLog      | 20 ++++++++++++++++++++
 gdb/arm-tdep.c     | 13 -------------
 gdb/frame-unwind.c | 15 +++++++++++++--
 gdb/i386-tdep.c    | 13 -------------
 gdb/m68k-tdep.c    | 10 ----------
 gdb/nios2-tdep.c   | 14 +-------------
 gdb/rl78-tdep.c    | 11 -----------
 gdb/s390-tdep.c    | 12 ------------
 gdb/tic6x-tdep.c   | 12 ------------
 9 files changed, 34 insertions(+), 86 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9d316fbce98..5bf169ca02d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,23 @@
+2018-06-05  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* arm-tdep.c (arm_unwind_pc): Delete.
+	(arm_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* frame-unwind.c (default_unwind_pc): Rewrite to call
+	extract_typed_address and gdbarch_addr_bits_remove.
+	* i386-tdep.c (i386_unwind_pc): Delete.
+	(i386_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* m68k-tdep.c (m68k_unwind_pc): Delete.
+	(m68k_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* nios2-tdep.c (nios2_unwind_pc): Delete.
+	(nios2_get_next_pc): Update to call gdbarch_unwind_pc.
+	(nios2_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* rl78-tdep.c (rl78_unwind_pc): Delete.
+	(rl78_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* s390-tdep.c (s390_unwind_pc): Delete.
+	(s390_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* tic6x-tdep.c (tic6x_unwind_pc): Delete.
+	(tic6x_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+
 2018-06-05  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* aarch64-tdep.c (aarch64_unwind_pc): Deleted.
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 3ea0e79b739..45c5b36383a 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -3069,18 +3069,6 @@ arm_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 			 get_frame_pc (this_frame));
 }
 
-/* Given THIS_FRAME, find the previous frame's resume PC (which will
-   be used to construct the previous frame's ID, after looking up the
-   containing function).  */
-
-static CORE_ADDR
-arm_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR pc;
-  pc = frame_unwind_register_unsigned (this_frame, ARM_PC_REGNUM);
-  return arm_addr_bits_remove (gdbarch, pc);
-}
-
 static CORE_ADDR
 arm_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -9360,7 +9348,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame handling.  */
   set_gdbarch_dummy_id (gdbarch, arm_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, arm_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, arm_unwind_sp);
 
   frame_base_set_default (gdbarch, &arm_normal_base);
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index 0eed572ebbb..d5b20e4af73 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -198,8 +198,19 @@ default_frame_unwind_stop_reason (struct frame_info *this_frame,
 CORE_ADDR
 default_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
-  int pc_regnum = gdbarch_pc_regnum (gdbarch);
-  return frame_unwind_register_unsigned (next_frame, pc_regnum);
+  struct type *type;
+  int pc_regnum;
+  CORE_ADDR addr;
+  struct value *value;
+
+  pc_regnum = gdbarch_pc_regnum (gdbarch);
+  value = frame_unwind_register_value (next_frame, pc_regnum);
+  type = builtin_type (gdbarch)->builtin_func_ptr;
+  addr = extract_typed_address (value_contents_all (value), type);
+  addr = gdbarch_addr_bits_remove (gdbarch, addr);
+
+  release_value (value);
+  return addr;
 }
 
 /* Helper functions for value-based register unwinding.  These return
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index b1d502f4827..8f443734a35 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1955,17 +1955,6 @@ i386_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 
   return pc;
 }
-
-/* This function is 64-bit safe.  */
-
-static CORE_ADDR
-i386_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  gdb_byte buf[8];
-
-  frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
-  return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
-}
 \f
 
 /* Normal frames.  */
@@ -8501,8 +8490,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_dummy_id (gdbarch, i386_dummy_id);
 
-  set_gdbarch_unwind_pc (gdbarch, i386_unwind_pc);
-
   /* Add the i386 register groups.  */
   i386_add_reggroups (gdbarch);
   tdep->register_reggroup_p = i386_register_reggroup_p;
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index a6e9b58a7d1..8d33bc2f661 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -850,15 +850,6 @@ m68k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
     return start_pc;
   return pc;
 }
-
-static CORE_ADDR
-m68k_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  gdb_byte buf[8];
-
-  frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
-  return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
-}
 \f
 /* Normal frames.  */
 
@@ -1246,7 +1237,6 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame unwinder.  */
   set_gdbarch_dummy_id (gdbarch, m68k_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, m68k_unwind_pc);
 
   /* Hook in the DWARF CFI frame unwinder.  */
   dwarf2_append_unwinders (gdbarch);
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index 91b4381f0b7..b6533d57719 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1888,17 +1888,6 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   return sp;
 }
 
-/* Implement the unwind_pc gdbarch method.  */
-
-static CORE_ADDR
-nios2_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  gdb_byte buf[4];
-
-  frame_unwind_register (next_frame, NIOS2_PC_REGNUM, buf);
-  return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
-}
-
 /* Implement the unwind_sp gdbarch method.  */
 
 static CORE_ADDR
@@ -2186,7 +2175,7 @@ nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
       /* If ra is in the reglist, we have to use the value saved in the
 	 stack frame rather than the current value.  */
       if (uimm & (1 << NIOS2_RA_REGNUM))
-	pc = nios2_unwind_pc (gdbarch, get_current_frame ());
+	pc = gdbarch_unwind_pc (gdbarch, get_current_frame ());
       else
 	pc = regcache_raw_get_unsigned (regcache, NIOS2_RA_REGNUM);
     }
@@ -2322,7 +2311,6 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, nios2_sw_breakpoint_from_kind);
 
   set_gdbarch_dummy_id (gdbarch, nios2_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, nios2_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, nios2_unwind_sp);
 
   /* The dwarf2 unwinder will normally produce the best results if
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index ace01b1171a..70955d966fa 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -1074,16 +1074,6 @@ rl78_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return p.prologue_end;
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-rl78_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame)
-{
-  return rl78_addr_bits_remove
-           (arch, frame_unwind_register_unsigned (next_frame,
-	                                          RL78_PC_REGNUM));
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -1468,7 +1458,6 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frames, prologues, etc.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_prologue (gdbarch, rl78_skip_prologue);
-  set_gdbarch_unwind_pc (gdbarch, rl78_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, rl78_unwind_sp);
   set_gdbarch_frame_align (gdbarch, rl78_frame_align);
 
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index e4e08c706a1..f6b29380d10 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -2118,17 +2118,6 @@ s390_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
   return 0;
 }
 
-/* Implement unwind_pc gdbarch method.  */
-
-static CORE_ADDR
-s390_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-  ULONGEST pc;
-  pc = frame_unwind_register_unsigned (next_frame, tdep->pc_regnum);
-  return gdbarch_addr_bits_remove (gdbarch, pc);
-}
-
 /* Implement unwind_sp gdbarch method.  */
 
 static CORE_ADDR
@@ -6996,7 +6985,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   dwarf2_frame_set_init_reg (gdbarch, s390_dwarf2_frame_init_reg);
   dwarf2_frame_set_adjust_regnum (gdbarch, s390_adjust_frame_regnum);
   dwarf2_append_unwinders (gdbarch);
-  set_gdbarch_unwind_pc (gdbarch, s390_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, s390_unwind_sp);
 
   switch (info.bfd_arch_info->mach)
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index efb8b0561b4..1d2671f155f 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -366,17 +366,6 @@ tic6x_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
     reg->how = DWARF2_FRAME_REG_UNDEFINED;
 }
 
-/* This is the implementation of gdbarch method unwind_pc.  */
-
-static CORE_ADDR
-tic6x_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  gdb_byte buf[8];
-
-  frame_unwind_register (next_frame,  TIC6X_PC_REGNUM, buf);
-  return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
-}
-
 /* This is the implementation of gdbarch method unwind_sp.  */
 
 static CORE_ADDR
@@ -1284,7 +1273,6 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch,
 				       tic6x_sw_breakpoint_from_kind);
 
-  set_gdbarch_unwind_pc (gdbarch, tic6x_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, tic6x_unwind_sp);
 
   /* Unwinding.  */
-- 
2.14.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCHv3 0/4] Supply additional default gdbarch methods
  2018-04-10 10:13 ` PING: Re: [PATCHv2 0/4] Supply additional default gdbarch methods Andrew Burgess
@ 2018-06-05 14:35   ` Andrew Burgess
  2018-06-05 14:35   ` [PATCHv3 4/4] gdb: Supply default gdbarch_unwind_sp and use where possible Andrew Burgess
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-06-05 14:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Ping!

Patch rebased and retested on current HEAD.

Thanks,
Andrew

---

Andrew Burgess (4):
  gdb: Add a default_unwind_pc method for gdbarch
  gdb: Remove more targets unwind_pc methods
  gdb: Supply a default for gdbarch_dummy_id
  gdb: Supply default gdbarch_unwind_sp and use where possible

 gdb/ChangeLog        | 211 +++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/aarch64-tdep.c   |  38 ----------
 gdb/alpha-tdep.c     |  29 -------
 gdb/arc-tdep.c       |  14 ----
 gdb/arm-tdep.c       |  37 ---------
 gdb/bfin-tdep.c      |  18 -----
 gdb/cris-tdep.c      |  40 ----------
 gdb/dummy-frame.c    |  16 ++++
 gdb/dummy-frame.h    |   6 ++
 gdb/frame-unwind.c   |  31 ++++++++
 gdb/frame-unwind.h   |  12 +++
 gdb/frame.c          | 132 ++++++++++++++------------------
 gdb/frv-tdep.c       |  27 -------
 gdb/ft32-tdep.c      |  33 --------
 gdb/gdbarch.c        |  41 ++--------
 gdb/gdbarch.h        |   6 --
 gdb/gdbarch.sh       |   8 +-
 gdb/h8300-tdep.c     |  22 ------
 gdb/hppa-tdep.c      |   9 ---
 gdb/i386-tdep.c      |  13 ----
 gdb/iq2000-tdep.c    |  22 ------
 gdb/lm32-tdep.c      |  23 ------
 gdb/m32r-tdep.c      |  37 ---------
 gdb/m68hc11-tdep.c   |  24 ------
 gdb/m68k-tdep.c      |  10 ---
 gdb/mep-tdep.c       |  30 --------
 gdb/mn10300-tdep.c   |  32 +-------
 gdb/moxie-tdep.c     |  33 --------
 gdb/msp430-tdep.c    |  31 --------
 gdb/nds32-tdep.c     |  29 -------
 gdb/nios2-tdep.c     |  35 +--------
 gdb/or1k-tdep.c      |  10 ---
 gdb/riscv-tdep.c     |  30 --------
 gdb/rl78-tdep.c      |  20 -----
 gdb/rs6000-tdep.c    |  19 -----
 gdb/rx-tdep.c        |  33 --------
 gdb/s390-tdep.c      |  12 ---
 gdb/score-tdep.c     |  23 ------
 gdb/sh-tdep.c        |  25 ------
 gdb/sparc-tdep.c     |   9 ---
 gdb/tic6x-tdep.c     |  35 ---------
 gdb/tilegx-tdep.c    |  26 -------
 gdb/v850-tdep.c      |  25 ------
 gdb/vax-tdep.c       |   8 --
 gdb/xstormy16-tdep.c |  23 ------
 45 files changed, 350 insertions(+), 997 deletions(-)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCHv3 3/4] gdb: Supply a default for gdbarch_dummy_id
  2018-04-10 10:13 ` PING: Re: [PATCHv2 0/4] Supply additional default gdbarch methods Andrew Burgess
                     ` (2 preceding siblings ...)
  2018-06-05 14:35   ` [PATCHv3 2/4] gdb: Remove more targets unwind_pc methods Andrew Burgess
@ 2018-06-05 14:35   ` Andrew Burgess
  2018-06-05 14:35   ` [PATCHv3 1/4] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess
  4 siblings, 0 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-06-05 14:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

A lot of targets use the same pattern for their implementation of
gdbarch_dummy_id.  Create a new function default_dummy_id and use this
as the default for gdbarch_dummy_id where possible.

gdb/ChangeLog:

	* aarch64-tdep.c (aarch64_dummy_id): Delete.
	(aarch64_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* alpha-tdep.c (alpha_dummy_id): Delete.
	(alpha_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* arc-tdep.c (arc_dummy_id): Delete.
	(arc_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* arm-tdep.c (arm_dummy_id): Delete.
	(arm_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* bfin-tdep.c (bfin_dummy_id): Delete.
	(bfin_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* cris-tdep.c (cris_dummy_id): Delete.
	(cris_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* dummy-frame.c (default_dummy_id): Defined new function.
	* dummy-frame.h (default_dummy_id): Declare new function.
	* frv-tdep.c (frv_dummy_id): Delete.
	(frv_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* ft32-tdep.c (ft32_dummy_id): Delete.
	(ft32_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.
	* gdbarch.sh: Remove predicate function, and supply default for
	dummy_id method.  Add 'dummy-frame.h' header.
	* h8300-tdep.c (h8300_dummy_id): Delete.
	(h8300_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* hppa-tdep.c (hppa_dummy_id): Delete.
	(hppa_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* iq2000-tdep.c (iq2000_dummy_id): Delete.
	(iq2000_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* lm32-tdep.c (lm32_dummy_id): Delete.
	(lm32_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* m32r-tdep.c (m32r_dummy_id): Delete.
	(m32r_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* mep-tdep.c (mep_dummy_id): Delete.
	(mep_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* mn10300-tdep.c (mn10300_dummy_id): Delete.
	(mn10300_frame_unwind_init): Don't call set_gdbarch_dummy_id.
	* moxie-tdep.c (moxie_dummy_id): Delete.
	(moxie_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* msp430-tdep.c (msp430_dummy_id): Delete.
	(msp430_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* nds32-tdep.c (nds32_dummy_id): Delete.
	(nds32_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* nios2-tdep.c (nios2_dummy_id): Delete.
	(nios2_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* or1k-tdep.c (or1k_dummy_id): Delete.
	(or1k_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* riscv-tdep.c (riscv_dummy_id): Delete.
	(riscv_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* rs6000-tdep.c (rs6000_dummy_id): Delete.
	(rs6000_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* rx-tdep.c (rx_dummy_id): Delete.
	(rx_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* score-tdep.c (score_dummy_id): Delete.
	(score_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* sh-tdep.c (sh_dummy_id): Delete.
	(sh_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* tic6x-tdep.c (tic6x_dummy_id): Delete.
	(tic6x_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* tilegx-tdep.c (tilegx_unwind_dummy_id): Delete.
	(tilegx_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* v850-tdep.c (v850_dummy_id): Delete.
	(v850_gdbarch_init): Don't call set_gdbarch_dummy_id.
	* gdb/xstormy16-tdep.c (xstormy16_dummy_id): Delete.
	(xstormy16_gdbarch_init): Don't call set_gdbarch_dummy_id.
---
 gdb/ChangeLog        | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/aarch64-tdep.c   | 15 ------------
 gdb/alpha-tdep.c     | 18 --------------
 gdb/arc-tdep.c       | 14 -----------
 gdb/arm-tdep.c       | 15 ------------
 gdb/bfin-tdep.c      | 11 ---------
 gdb/cris-tdep.c      | 13 ----------
 gdb/dummy-frame.c    | 16 +++++++++++++
 gdb/dummy-frame.h    |  6 +++++
 gdb/frv-tdep.c       | 13 ----------
 gdb/ft32-tdep.c      | 13 ----------
 gdb/gdbarch.c        | 14 +++--------
 gdb/gdbarch.h        |  2 --
 gdb/gdbarch.sh       |  3 ++-
 gdb/h8300-tdep.c     |  8 -------
 gdb/hppa-tdep.c      |  9 -------
 gdb/iq2000-tdep.c    |  8 -------
 gdb/lm32-tdep.c      |  9 -------
 gdb/m32r-tdep.c      | 17 -------------
 gdb/mep-tdep.c       | 10 --------
 gdb/mn10300-tdep.c   | 10 --------
 gdb/moxie-tdep.c     | 13 ----------
 gdb/msp430-tdep.c    | 13 ----------
 gdb/nds32-tdep.c     | 11 ---------
 gdb/nios2-tdep.c     | 11 ---------
 gdb/or1k-tdep.c      | 10 --------
 gdb/riscv-tdep.c     | 10 --------
 gdb/rs6000-tdep.c    | 10 --------
 gdb/rx-tdep.c        | 10 --------
 gdb/score-tdep.c     |  9 -------
 gdb/sh-tdep.c        |  9 -------
 gdb/tic6x-tdep.c     | 12 ----------
 gdb/tilegx-tdep.c    | 12 ----------
 gdb/v850-tdep.c      |  9 -------
 gdb/xstormy16-tdep.c |  9 -------
 35 files changed, 94 insertions(+), 345 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5bf169ca02d..c2f6957b461 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,70 @@
+2018-06-05  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* aarch64-tdep.c (aarch64_dummy_id): Delete.
+	(aarch64_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* alpha-tdep.c (alpha_dummy_id): Delete.
+	(alpha_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* arc-tdep.c (arc_dummy_id): Delete.
+	(arc_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* arm-tdep.c (arm_dummy_id): Delete.
+	(arm_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* bfin-tdep.c (bfin_dummy_id): Delete.
+	(bfin_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* cris-tdep.c (cris_dummy_id): Delete.
+	(cris_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* dummy-frame.c (default_dummy_id): Defined new function.
+	* dummy-frame.h (default_dummy_id): Declare new function.
+	* frv-tdep.c (frv_dummy_id): Delete.
+	(frv_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* ft32-tdep.c (ft32_dummy_id): Delete.
+	(ft32_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* gdbarch.c: Regenerate.
+	* gdbarch.h: Regenerate.
+	* gdbarch.sh: Remove predicate function, and supply default for
+	dummy_id method.  Add 'dummy-frame.h' header.
+	* h8300-tdep.c (h8300_dummy_id): Delete.
+	(h8300_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* hppa-tdep.c (hppa_dummy_id): Delete.
+	(hppa_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* iq2000-tdep.c (iq2000_dummy_id): Delete.
+	(iq2000_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* lm32-tdep.c (lm32_dummy_id): Delete.
+	(lm32_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* m32r-tdep.c (m32r_dummy_id): Delete.
+	(m32r_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* mep-tdep.c (mep_dummy_id): Delete.
+	(mep_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* mn10300-tdep.c (mn10300_dummy_id): Delete.
+	(mn10300_frame_unwind_init): Don't call set_gdbarch_dummy_id.
+	* moxie-tdep.c (moxie_dummy_id): Delete.
+	(moxie_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* msp430-tdep.c (msp430_dummy_id): Delete.
+	(msp430_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* nds32-tdep.c (nds32_dummy_id): Delete.
+	(nds32_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* nios2-tdep.c (nios2_dummy_id): Delete.
+	(nios2_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* or1k-tdep.c (or1k_dummy_id): Delete.
+	(or1k_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* riscv-tdep.c (riscv_dummy_id): Delete.
+	(riscv_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* rs6000-tdep.c (rs6000_dummy_id): Delete.
+	(rs6000_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* rx-tdep.c (rx_dummy_id): Delete.
+	(rx_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* score-tdep.c (score_dummy_id): Delete.
+	(score_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* sh-tdep.c (sh_dummy_id): Delete.
+	(sh_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* tic6x-tdep.c (tic6x_dummy_id): Delete.
+	(tic6x_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* tilegx-tdep.c (tilegx_unwind_dummy_id): Delete.
+	(tilegx_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* v850-tdep.c (v850_dummy_id): Delete.
+	(v850_gdbarch_init): Don't call set_gdbarch_dummy_id.
+	* gdb/xstormy16-tdep.c (xstormy16_dummy_id): Delete.
+	(xstormy16_gdbarch_init): Don't call set_gdbarch_dummy_id.
+
 2018-06-05  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* arm-tdep.c (arm_unwind_pc): Delete.
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 1d837ec4771..71f5066e996 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1000,20 +1000,6 @@ struct frame_base aarch64_normal_base =
   aarch64_normal_frame_base
 };
 
-/* Assuming THIS_FRAME is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos () and returned from
-   aarch64_push_dummy_call, and the PC needs to match the dummy
-   frame's breakpoint.  */
-
-static struct frame_id
-aarch64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned (this_frame,
-						      AARCH64_SP_REGNUM),
-			 get_frame_pc (this_frame));
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -2940,7 +2926,6 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_align (gdbarch, aarch64_frame_align);
 
   /* Frame handling.  */
-  set_gdbarch_dummy_id (gdbarch, aarch64_dummy_id);
   set_gdbarch_unwind_sp (gdbarch, aarch64_unwind_sp);
 
   /* Advance PC across function entry code.  */
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 26b7e34ad23..f82cd8bd0bc 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -1462,21 +1462,6 @@ reinit_frame_cache_sfunc (const char *args,
 {
   reinit_frame_cache ();
 }
-
-\f
-/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos(), and the PC match the dummy frame's
-   breakpoint.  */
-
-static struct frame_id
-alpha_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST base;
-  base = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM);
-  return frame_id_build (base, get_frame_pc (this_frame));
-}
-
 \f
 /* Helper routines for alpha*-nat.c files to move register sets to and
    from core files.  The UNIQUE pointer is allowed to be NULL, as most
@@ -1798,9 +1783,6 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Settings for calling functions in the inferior.  */
   set_gdbarch_push_dummy_call (gdbarch, alpha_push_dummy_call);
 
-  /* Methods for saving / extracting a dummy frame's ID.  */
-  set_gdbarch_dummy_id (gdbarch, alpha_dummy_id);
-
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index fad91709786..569409fdf43 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -509,19 +509,6 @@ arc_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
   *offset_ptr = 0;
 }
 
-/* Implement the "dummy_id" gdbarch method.
-
-   Tear down a dummy frame created by arc_push_dummy_call ().  This data has
-   to be constructed manually from the data in our hand.  The stack pointer
-   and program counter can be obtained from the frame info.  */
-
-static struct frame_id
-arc_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_sp (this_frame),
-			 get_frame_pc (this_frame));
-}
-
 /* Implement the "push_dummy_call" gdbarch method.
 
    Stack Frame Layout
@@ -2014,7 +2001,6 @@ arc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_ps_regnum (gdbarch, ARC_STATUS32_REGNUM);
   set_gdbarch_fp0_regnum (gdbarch, -1);	/* No FPU registers.  */
 
-  set_gdbarch_dummy_id (gdbarch, arc_dummy_id);
   set_gdbarch_push_dummy_call (gdbarch, arc_push_dummy_call);
   set_gdbarch_push_dummy_code (gdbarch, arc_push_dummy_code);
 
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 45c5b36383a..933cd136941 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -3055,20 +3055,6 @@ struct frame_base arm_normal_base = {
   arm_normal_frame_base
 };
 
-/* Assuming THIS_FRAME is a dummy, return the frame ID of that
-   dummy frame.  The frame ID's base needs to match the TOS value
-   saved by save_dummy_frame_tos() and returned from
-   arm_push_dummy_call, and the PC needs to match the dummy frame's
-   breakpoint.  */
-
-static struct frame_id
-arm_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned (this_frame,
-						      ARM_SP_REGNUM),
-			 get_frame_pc (this_frame));
-}
-
 static CORE_ADDR
 arm_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -9347,7 +9333,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_write_pc (gdbarch, arm_write_pc);
 
   /* Frame handling.  */
-  set_gdbarch_dummy_id (gdbarch, arm_dummy_id);
   set_gdbarch_unwind_sp (gdbarch, arm_unwind_sp);
 
   frame_base_set_default (gdbarch, &arm_normal_base);
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index b60dd00dbb5..690335b4a55 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -756,16 +756,6 @@ static const struct frame_base bfin_frame_base =
   bfin_frame_args_address
 };
 
-static struct frame_id
-bfin_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp;
-
-  sp = get_frame_register_unsigned (this_frame, BFIN_SP_REGNUM);
-
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 static CORE_ADDR
 bfin_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
 {
@@ -820,7 +810,6 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_dwarf2_reg_to_regnum (gdbarch, bfin_reg_to_regnum);
   set_gdbarch_register_name (gdbarch, bfin_register_name);
   set_gdbarch_register_type (gdbarch, bfin_register_type);
-  set_gdbarch_dummy_id (gdbarch, bfin_dummy_id);
   set_gdbarch_push_dummy_call (gdbarch, bfin_push_dummy_call);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
   set_gdbarch_return_value (gdbarch, bfin_return_value);
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index d86d9830b8d..a731a673c3f 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -764,18 +764,6 @@ cris_frame_prev_register (struct frame_info *this_frame,
   return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
 }
 
-/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
-   frame.  The frame ID's base needs to match the TOS value saved by
-   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
-
-static struct frame_id
-cris_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp;
-  sp = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 static CORE_ADDR
 cris_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
 {
@@ -4085,7 +4073,6 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, cris_sw_breakpoint_from_kind);
   
   set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, cris_dummy_id);
 
   if (tdep->cris_dwarf2_cfi == 1)
     {
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 82e7251ccec..4df4f4eec35 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -385,6 +385,22 @@ const struct frame_unwind dummy_frame_unwind =
   dummy_frame_sniffer,
 };
 
+/* Default implementation of gdbarch_dummy_id.  Generate frame_id for
+   THIS_FRAME assuming that it is a dummy frame.  A dummy frame is created
+   before an inferior call, the frame_id returned here must match the base
+   address returned by gdbarch_push_dummy_call and the frame's pc must
+   match the dummy frames breakpoint address.  */
+
+struct frame_id
+default_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
+{
+  CORE_ADDR sp, pc;
+
+  sp = get_frame_sp (this_frame);
+  pc = get_frame_pc (this_frame);
+  return frame_id_build (sp, pc);
+}
+
 static void
 fprint_dummy_frames (struct ui_file *file)
 {
diff --git a/gdb/dummy-frame.h b/gdb/dummy-frame.h
index cad99609927..342e97a327b 100644
--- a/gdb/dummy-frame.h
+++ b/gdb/dummy-frame.h
@@ -71,4 +71,10 @@ extern void register_dummy_frame_dtor (struct frame_id dummy_id, ptid_t ptid,
 extern int find_dummy_frame_dtor (dummy_frame_dtor_ftype *dtor,
 				  void *dtor_data);
 
+/* Default implementation of gdbarch_dummy_id.  Generate a dummy frame_id
+   for THIS_FRAME assuming that the frame is a dummy frame.  */
+
+extern struct frame_id default_dummy_id (struct gdbarch *gdbarch,
+					 struct frame_info *this_frame);
+
 #endif /* !defined (DUMMY_FRAME_H)  */
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 8170bf94fdb..c967d2a6d16 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1438,18 +1438,6 @@ frv_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, sp_regnum);
 }
 
-
-/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
-   frame.  The frame ID's base needs to match the TOS value saved by
-   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
-
-static struct frame_id
-frv_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, sp_regnum);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 static struct gdbarch *
 frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
@@ -1541,7 +1529,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Settings for calling functions in the inferior.  */
   set_gdbarch_push_dummy_call (gdbarch, frv_push_dummy_call);
-  set_gdbarch_dummy_id (gdbarch, frv_dummy_id);
 
   /* Settings that should be unnecessary.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 5c0a3384dbd..79cf1a08c1d 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -559,14 +559,6 @@ static const struct frame_base ft32_frame_base =
   ft32_frame_base_address
 };
 
-static struct frame_id
-ft32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, FT32_SP_REGNUM);
-
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 /* Allocate and initialize the ft32 gdbarch object.  */
 
 static struct gdbarch *
@@ -614,11 +606,6 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   frame_base_set_default (gdbarch, &ft32_frame_base);
 
-  /* Methods for saving / extracting a dummy frame's ID.  The ID's
-     stack address must match the SP value returned by
-     PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
-  set_gdbarch_dummy_id (gdbarch, ft32_dummy_id);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index dcd2d59f16c..1ba256f921a 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -49,6 +49,7 @@
 #include "objfiles.h"
 #include "auxv.h"
 #include "frame-unwind.h"
+#include "dummy-frame.h"
 
 /* Static function declarations */
 
@@ -408,6 +409,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->ecoff_reg_to_regnum = no_op_reg_to_regnum;
   gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum;
   gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum;
+  gdbarch->dummy_id = default_dummy_id;
   gdbarch->deprecated_fp_regnum = -1;
   gdbarch->call_dummy_location = AT_ENTRY_POINT;
   gdbarch->code_of_frame_writable = default_code_of_frame_writable;
@@ -571,7 +573,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   if (gdbarch->register_name == 0)
     log.puts ("\n\tregister_name");
   /* Skip verify of register_type, has predicate.  */
-  /* Skip verify of dummy_id, has predicate.  */
+  /* Skip verify of dummy_id, invalid_p == 0 */
   /* Skip verify of deprecated_fp_regnum, invalid_p == 0 */
   /* Skip verify of push_dummy_call, has predicate.  */
   /* Skip verify of call_dummy_location, invalid_p == 0 */
@@ -951,9 +953,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "gdbarch_dump: dtrace_probe_is_enabled = <%s>\n",
                       host_address_to_string (gdbarch->dtrace_probe_is_enabled));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_dummy_id_p() = %d\n",
-                      gdbarch_dummy_id_p (gdbarch));
   fprintf_unfiltered (file,
                       "gdbarch_dump: dummy_id = <%s>\n",
                       host_address_to_string (gdbarch->dummy_id));
@@ -2301,13 +2300,6 @@ set_gdbarch_register_type (struct gdbarch *gdbarch,
   gdbarch->register_type = register_type;
 }
 
-int
-gdbarch_dummy_id_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->dummy_id != NULL;
-}
-
 struct frame_id
 gdbarch_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index c71974f2b36..4d994a17b50 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -378,8 +378,6 @@ typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, in
 extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr);
 extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type);
 
-extern int gdbarch_dummy_id_p (struct gdbarch *gdbarch);
-
 typedef struct frame_id (gdbarch_dummy_id_ftype) (struct gdbarch *gdbarch, struct frame_info *this_frame);
 extern struct frame_id gdbarch_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame);
 extern void set_gdbarch_dummy_id (struct gdbarch *gdbarch, gdbarch_dummy_id_ftype *dummy_id);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 19aaa4200d2..6db8b0eb50a 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -480,7 +480,7 @@ m;const char *;register_name;int regnr;regnr;;0
 # use "register_type".
 M;struct type *;register_type;int reg_nr;reg_nr
 
-M;struct frame_id;dummy_id;struct frame_info *this_frame;this_frame
+m;struct frame_id;dummy_id;struct frame_info *this_frame;this_frame;;default_dummy_id;;0
 # Implement DUMMY_ID and PUSH_DUMMY_CALL, then delete
 # deprecated_fp_regnum.
 v;int;deprecated_fp_regnum;;;-1;-1;;0
@@ -1658,6 +1658,7 @@ cat <<EOF
 #include "objfiles.h"
 #include "auxv.h"
 #include "frame-unwind.h"
+#include "dummy-frame.h"
 
 /* Static function declarations */
 
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 48137ed02a0..fa2597f9d0d 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -98,13 +98,6 @@ h8300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }
 
-static struct frame_id
-h8300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 /* Normal frames.  */
 
 /* Allocate and initialize a frame cache.  */
@@ -1348,7 +1341,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame unwinder.  */
   set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, h8300_dummy_id);
   frame_base_set_default (gdbarch, &h8300_frame_base);
 
   /* 
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 1ea36704279..ddaa39a0149 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2506,14 +2506,6 @@ static const struct frame_unwind hppa_stub_frame_unwind = {
   hppa_stub_unwind_sniffer
 };
 
-static struct frame_id
-hppa_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned (this_frame,
-                                                      HPPA_SP_REGNUM),
-			 get_frame_pc (this_frame));
-}
-
 CORE_ADDR
 hppa_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -3156,7 +3148,6 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read);
 
   /* Frame unwind methods.  */
-  set_gdbarch_dummy_id (gdbarch, hppa_dummy_id);
   set_gdbarch_unwind_pc (gdbarch, hppa_unwind_pc);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index 74fefdab374..f98b9066858 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -440,13 +440,6 @@ iq2000_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }   
 
-static struct frame_id
-iq2000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 static CORE_ADDR
 iq2000_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -835,7 +828,6 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_type (gdbarch, iq2000_register_type);
   set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
   set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, iq2000_dummy_id);
   frame_base_set_default (gdbarch, &iq2000_frame_base);
   set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call);
 
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 26f2faee365..651b09c73ec 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -388,14 +388,6 @@ lm32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, SIM_LM32_SP_REGNUM);
 }
 
-static struct frame_id
-lm32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, SIM_LM32_SP_REGNUM);
-
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 /* Put here the code to store, into fi->saved_regs, the addresses of
    the saved registers of frame described by FRAME_INFO.  This
    includes special registers such as pc and fp saved in special ways
@@ -546,7 +538,6 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_align (gdbarch, lm32_frame_align);
   frame_base_set_default (gdbarch, &lm32_frame_base);
   set_gdbarch_unwind_sp (gdbarch, lm32_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, lm32_dummy_id);
   frame_unwind_append_unwinder (gdbarch, &lm32_frame_unwind);
 
   /* Breakpoints.  */
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 9bfff6b0675..77019162d22 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -864,18 +864,6 @@ static const struct frame_base m32r_frame_base = {
   m32r_frame_base_address
 };
 
-/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
-   frame.  The frame ID's base needs to match the TOS value saved by
-   save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
-
-static struct frame_id
-m32r_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
-
 static gdbarch_init_ftype m32r_gdbarch_init;
 
 static struct gdbarch *
@@ -920,11 +908,6 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   frame_base_set_default (gdbarch, &m32r_frame_base);
 
-  /* Methods for saving / extracting a dummy frame's ID.  The ID's
-     stack address must match the SP value returned by
-     PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
-  set_gdbarch_dummy_id (gdbarch, m32r_dummy_id);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index 0f205988680..2e434daa41e 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -2328,15 +2328,6 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   return sp;
 }
 
-
-static struct frame_id
-mep_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, MEP_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
-
 \f
 /* Initialization.  */
 
@@ -2465,7 +2456,6 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Inferior function calls.  */
   set_gdbarch_frame_align (gdbarch, mep_frame_align);
   set_gdbarch_push_dummy_call (gdbarch, mep_push_dummy_call);
-  set_gdbarch_dummy_id (gdbarch, mep_dummy_id);
 
   return gdbarch;
 }
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 8b72c287ab4..3b366e9322d 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1098,15 +1098,6 @@ mn10300_frame_base (struct frame_info *this_frame, void **this_prologue_cache)
     }
 }
 
-/* Here is a dummy implementation.  */
-static struct frame_id
-mn10300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
-  CORE_ADDR pc = get_frame_register_unsigned (this_frame, E_PC_REGNUM);
-  return frame_id_build (sp, pc);
-}
-
 static void
 mn10300_frame_this_id (struct frame_info *this_frame,
 		       void **this_prologue_cache,
@@ -1163,7 +1154,6 @@ mn10300_frame_unwind_init (struct gdbarch *gdbarch)
 {
   dwarf2_append_unwinders (gdbarch);
   frame_unwind_append_unwinder (gdbarch, &mn10300_frame_unwind);
-  set_gdbarch_dummy_id (gdbarch, mn10300_dummy_id);
   set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp);
 }
 
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 515357c8ea3..ca235050df5 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -621,14 +621,6 @@ static const struct frame_base moxie_frame_base = {
   moxie_frame_base_address
 };
 
-static struct frame_id
-moxie_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, MOXIE_SP_REGNUM);
-
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 /* Parse the current instruction and record the values of the registers and
    memory that will be changed in current instruction to "record_arch_list".
    Return -1 if something wrong.  */
@@ -1101,11 +1093,6 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   frame_base_set_default (gdbarch, &moxie_frame_base);
 
-  /* Methods for saving / extracting a dummy frame's ID.  The ID's
-     stack address must match the SP value returned by
-     PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
-  set_gdbarch_dummy_id (gdbarch, moxie_dummy_id);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 2e30a648de2..3f09b594f8b 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -643,18 +643,6 @@ msp430_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
 }
 
 
-/* Implement the "dummy_id" gdbarch method.  */
-
-static struct frame_id
-msp430_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return
-    frame_id_build (get_frame_register_unsigned
-		    (this_frame, MSP430_SP_REGNUM),
-		    get_frame_pc (this_frame));
-}
-
-
 /* Implement the "push_dummy_call" gdbarch method.  */
 
 static CORE_ADDR
@@ -993,7 +981,6 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   frame_unwind_append_unwinder (gdbarch, &msp430_unwind);
 
   /* Dummy frames, return values.  */
-  set_gdbarch_dummy_id (gdbarch, msp430_dummy_id);
   set_gdbarch_push_dummy_call (gdbarch, msp430_push_dummy_call);
   set_gdbarch_return_value (gdbarch, msp430_return_value);
 
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index 59cdacdad82..5df7054f621 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -1388,16 +1388,6 @@ static const struct frame_unwind nds32_epilogue_frame_unwind =
   nds32_epilogue_frame_sniffer
 };
 \f
-/* Implement the "dummy_id" gdbarch method.  */
-
-static struct frame_id
-nds32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, NDS32_SP_REGNUM);
-
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -2136,7 +2126,6 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_push_dummy_call (gdbarch, nds32_push_dummy_call);
   set_gdbarch_return_value (gdbarch, nds32_return_value);
-  set_gdbarch_dummy_id (gdbarch, nds32_dummy_id);
 
   set_gdbarch_skip_prologue (gdbarch, nds32_skip_prologue);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index b6533d57719..f41fde2da2f 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1798,16 +1798,6 @@ nios2_return_value (struct gdbarch *gdbarch, struct value *function,
   return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-/* Implement the dummy_id gdbarch method.  */
-
-static struct frame_id
-nios2_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build
-    (get_frame_register_unsigned (this_frame, NIOS2_SP_REGNUM),
-     get_frame_pc (this_frame));
-}
-
 /* Implement the push_dummy_call gdbarch method.  */
 
 static CORE_ADDR
@@ -2310,7 +2300,6 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_breakpoint_kind_from_pc (gdbarch, nios2_breakpoint_kind_from_pc);
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, nios2_sw_breakpoint_from_kind);
 
-  set_gdbarch_dummy_id (gdbarch, nios2_dummy_id);
   set_gdbarch_unwind_sp (gdbarch, nios2_unwind_sp);
 
   /* The dwarf2 unwinder will normally produce the best results if
diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index c5104e3959d..faefa0c151f 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -788,15 +788,6 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 
   return sp;
 }
-
-/* Implement the dummy_id gdbarch method.  */
-
-static struct frame_id
-or1k_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_sp (this_frame),
-			 get_frame_pc (this_frame));
-}
 \f
 
 /* Support functions for frame handling.  */
@@ -1184,7 +1175,6 @@ or1k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
   set_gdbarch_push_dummy_code (gdbarch, or1k_push_dummy_code);
   set_gdbarch_push_dummy_call (gdbarch, or1k_push_dummy_call);
-  set_gdbarch_dummy_id (gdbarch, or1k_dummy_id);
 
   /* Frame unwinders.  Use DWARF debug info if available, otherwise use our
      own unwinder.  */
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index c732f2cbe27..7ef04627bef 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -2330,15 +2330,6 @@ riscv_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, RISCV_SP_REGNUM);
 }
 
-/* Implement the dummy_id gdbarch method.  */
-
-static struct frame_id
-riscv_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_signed (this_frame, RISCV_SP_REGNUM),
-			 get_frame_pc (this_frame));
-}
-
 /* Generate, or return the cached frame cache for the RiscV frame
    unwinder.  */
 
@@ -2542,7 +2533,6 @@ riscv_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
   set_gdbarch_push_dummy_code (gdbarch, riscv_push_dummy_code);
   set_gdbarch_push_dummy_call (gdbarch, riscv_push_dummy_call);
-  set_gdbarch_dummy_id (gdbarch, riscv_dummy_id);
 
   /* Frame unwinders.  Use DWARF debug info if available, otherwise use our own
      unwinder.  */
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index cf884b7f34f..26ccedb082c 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3098,14 +3098,6 @@ find_variant_by_arch (enum bfd_architecture arch, unsigned long mach)
 }
 
 \f
-static struct frame_id
-rs6000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned
-			  (this_frame, gdbarch_sp_regnum (gdbarch)),
-			 get_frame_pc (this_frame));
-}
-
 struct rs6000_frame_cache
 {
   CORE_ADDR base;
@@ -6420,7 +6412,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     case GDB_OSABI_UNKNOWN:
       frame_unwind_append_unwinder (gdbarch, &rs6000_epilogue_frame_unwind);
       frame_unwind_append_unwinder (gdbarch, &rs6000_frame_unwind);
-      set_gdbarch_dummy_id (gdbarch, rs6000_dummy_id);
       frame_base_append_sniffer (gdbarch, rs6000_frame_base_sniffer);
       break;
     default:
@@ -6428,7 +6419,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
       frame_unwind_append_unwinder (gdbarch, &rs6000_epilogue_frame_unwind);
       frame_unwind_append_unwinder (gdbarch, &rs6000_frame_unwind);
-      set_gdbarch_dummy_id (gdbarch, rs6000_dummy_id);
       frame_base_append_sniffer (gdbarch, rs6000_frame_base_sniffer);
     }
 
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 3d982795db4..07e83d0e11e 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -761,15 +761,6 @@ rx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
   return sp;
 }
 
-/* Implement the "dummy_id" gdbarch method.  */
-static struct frame_id
-rx_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return
-    frame_id_build (get_frame_register_unsigned (this_frame, RX_SP_REGNUM),
-		    get_frame_pc (this_frame));
-}
-
 /* Implement the "push_dummy_call" gdbarch method.  */
 static CORE_ADDR
 rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
@@ -1137,7 +1128,6 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Methods for saving / extracting a dummy frame's ID.
      The ID's stack address must match the SP value returned by
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
-  set_gdbarch_dummy_id (gdbarch, rx_dummy_id);
   set_gdbarch_push_dummy_call (gdbarch, rx_push_dummy_call);
   set_gdbarch_return_value (gdbarch, rx_return_value);
 
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index e47d7ce18fa..f2d831899d1 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -472,14 +472,6 @@ score_return_value (struct gdbarch *gdbarch, struct value *function,
     }
 }
 
-static struct frame_id
-score_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build (get_frame_register_unsigned (this_frame,
-						      SCORE_SP_REGNUM),
-			 get_frame_pc (this_frame));
-}
-
 static int
 score_type_needs_double_align (struct type *type)
 {
@@ -1511,7 +1503,6 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Dummy frame hooks.  */
   set_gdbarch_return_value (gdbarch, score_return_value);
   set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
-  set_gdbarch_dummy_id (gdbarch, score_dummy_id);
   set_gdbarch_push_dummy_call (gdbarch, score_push_dummy_call);
 
   /* Normal frame hooks.  */
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 6dd7e575e64..a65fd170c02 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1982,14 +1982,6 @@ sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 }
 
-static struct frame_id
-sh_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame,
-					      gdbarch_sp_regnum (gdbarch));
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
 static CORE_ADDR
 sh_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -2299,7 +2291,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, sh_frame_align);
   set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, sh_dummy_id);
   frame_base_set_default (gdbarch, &sh_frame_base);
 
   set_gdbarch_stack_frame_destroyed_p (gdbarch, sh_stack_frame_destroyed_p);
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index 1d2671f155f..84fad648db1 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -801,16 +801,6 @@ tic6x_return_value (struct gdbarch *gdbarch, struct value *function,
   return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-/* This is the implementation of gdbarch method dummy_id.  */
-
-static struct frame_id
-tic6x_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_id_build
-    (get_frame_register_unsigned (this_frame, TIC6X_SP_REGNUM),
-     get_frame_pc (this_frame));
-}
-
 /* Get the alignment requirement of TYPE.  */
 
 static int
@@ -1292,8 +1282,6 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_return_value (gdbarch, tic6x_return_value);
 
-  set_gdbarch_dummy_id (gdbarch, tic6x_dummy_id);
-
   /* Enable inferior call support.  */
   set_gdbarch_push_dummy_call (gdbarch, tic6x_push_dummy_call);
 
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 5885f60dbca..f8a8153bb3e 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -936,17 +936,6 @@ tilegx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, TILEGX_SP_REGNUM);
 }
 
-static struct frame_id
-tilegx_unwind_dummy_id (struct gdbarch *gdbarch,
-			struct frame_info *this_frame)
-{
-  CORE_ADDR sp;
-
-  sp = get_frame_register_unsigned (this_frame, TILEGX_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
-
 /* We cannot read/write the "special" registers.  */
 
 static int
@@ -1022,7 +1011,6 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame Info.  */
   set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, tilegx_unwind_dummy_id);
   set_gdbarch_frame_align (gdbarch, tilegx_frame_align);
   frame_base_set_default (gdbarch, &tilegx_frame_base);
 
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 0f08c64f1d1..6434ceb1de4 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1333,14 +1333,6 @@ v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 } 
 
-static struct frame_id
-v850_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame,
-					      gdbarch_sp_regnum (gdbarch));
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-  
 static CORE_ADDR
 v850_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -1458,7 +1450,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, v850_frame_align);
   set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, v850_dummy_id);
   frame_base_set_default (gdbarch, &v850_frame_base);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 45369cdf56a..ee378600958 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -757,14 +757,6 @@ xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }
 
-static struct frame_id
-xstormy16_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
-  return frame_id_build (sp, get_frame_pc (this_frame));
-}
-
-
 /* Function: xstormy16_gdbarch_init
    Initializer function for the xstormy16 gdbarch vector.
    Called by gdbarch.  Sets up the gdbarch vector(s) for this target.  */
@@ -819,7 +811,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
    * Frame Info
    */
   set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
-  set_gdbarch_dummy_id (gdbarch, xstormy16_dummy_id);
   set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
   frame_base_set_default (gdbarch, &xstormy16_frame_base);
 
-- 
2.14.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCHv3 4/4] gdb: Supply default gdbarch_unwind_sp and use where possible
  2018-04-10 10:13 ` PING: Re: [PATCHv2 0/4] Supply additional default gdbarch methods Andrew Burgess
  2018-06-05 14:35   ` [PATCHv3 " Andrew Burgess
@ 2018-06-05 14:35   ` Andrew Burgess
  2018-06-05 14:35   ` [PATCHv3 2/4] gdb: Remove more targets unwind_pc methods Andrew Burgess
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-06-05 14:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Most unwind_sp methods follow the same pattern.  This commit provides
a default implementation of gdbarch_unwind_sp and switches targets
over to this method where possible.

gdb/ChangeLog:

	* aarch64-tdep.c (aarch64_unwind_sp): Delete.
	(aarch64_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* arm-tdep.c (arm_unwind_sp): Delete.
	(arm_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* cris-tdep.c (cris_unwind_sp): Delete.
	(cris_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* frame-unwind.c (default_unwind_sp): Define new function.
	* frame-unwind.h (default_unwind_sp): Declare new function.
	* frame.c (get_frame_sp): Assume gdbarch_unwind_sp is always
	available.
	* frv-tdep.c (frv_unwind_sp): Delete.
	(frv_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* ft32-tdep.c (ft32_unwind_sp): Delete.
	(ft32_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.
	* gdbarch.sh: Update 'unwind_sp', remove predicate, and supply a
	default method name.
	* h8300-tdep.c (h8300_unwind_sp): Delete.
	(h8300_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* iq2000-tdep.c (iq2000_unwind_sp): Delete.
	(iq2000_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* lm32-tdep.c (lm32_unwind_sp): Delete.
	(lm32_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* m32r-tdep.c (m32r_unwind_sp): Delete.
	(m32r_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* m68hc11-tdep.c (m68hc11_unwind_sp): Delete.
	(m68hc11_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* mep-tdep.c (mep_unwind_sp): Delete.
	(mep_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* mn10300-tdep.c (mn10300_unwind_sp): Delete.
	(mn10300_frame_unwind_init): Don't call set_gdbarch_unwind_sp.
	(mn10300_push_dummy_call): Call gdbarch_unwind_sp instead.
	* moxie-tdep.c (moxie_unwind_sp): Delete.
	(moxie_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* msp430-tdep.c (msp430_unwind_sp): Delete.
	(msp430_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* nds32-tdep.c (nds32_unwind_sp): Delete.
	(nds32_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* nios2-tdep.c (nios2_unwind_sp): Delete.
	(nios2_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* riscv-tdep.c (riscv_unwind_sp): Delete.
	(riscv_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* rl78-tdep.c (rl78_unwind_sp): Delete.
	(rl78_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* rx-tdep.c (rx_unwind_sp): Delete.
	(rx_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* score-tdep.c (score_unwind_sp): Delete.
	(score_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* sh-tdep.c (sh_unwind_sp): Delete.
	(sh_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* tic6x-tdep.c (tic6x_unwind_sp): Delete.
	(tic6x_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* tilegx-tdep.c (tilegx_unwind_sp): Delete.
	(tilegx_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* v850-tdep.c (v850_unwind_sp): Delete.
	(v850_gdbarch_init): Don't call set_gdbarch_unwind_sp.
	* xstormy16-tdep.c (xstormy16_unwind_sp): Delete.
	(xstormy16_gdbarch_init): Don't call set_gdbarch_unwind_sp.
---
 gdb/ChangeLog        | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/aarch64-tdep.c   | 11 ----------
 gdb/arm-tdep.c       |  9 --------
 gdb/cris-tdep.c      | 14 ------------
 gdb/frame-unwind.c   | 11 ++++++++++
 gdb/frame-unwind.h   |  6 +++++
 gdb/frame.c          | 15 +++----------
 gdb/frv-tdep.c       |  7 ------
 gdb/ft32-tdep.c      | 10 ---------
 gdb/gdbarch.c        | 13 ++---------
 gdb/gdbarch.h        |  2 --
 gdb/gdbarch.sh       |  2 +-
 gdb/h8300-tdep.c     |  7 ------
 gdb/iq2000-tdep.c    |  7 ------
 gdb/lm32-tdep.c      |  7 ------
 gdb/m32r-tdep.c      |  9 --------
 gdb/m68hc11-tdep.c   | 10 ---------
 gdb/mep-tdep.c       | 11 ----------
 gdb/mn10300-tdep.c   | 12 +---------
 gdb/moxie-tdep.c     | 10 ---------
 gdb/msp430-tdep.c    |  9 --------
 gdb/nds32-tdep.c     |  9 --------
 gdb/nios2-tdep.c     | 10 ---------
 gdb/riscv-tdep.c     | 11 ----------
 gdb/rl78-tdep.c      |  9 --------
 gdb/rx-tdep.c        | 12 ----------
 gdb/score-tdep.c     |  7 ------
 gdb/sh-tdep.c        |  8 -------
 gdb/tic6x-tdep.c     | 11 ----------
 gdb/tilegx-tdep.c    |  7 ------
 gdb/v850-tdep.c      |  8 -------
 gdb/xstormy16-tdep.c |  7 ------
 32 files changed, 86 insertions(+), 257 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c2f6957b461..57c2f0507cb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,65 @@
+2018-06-05  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* aarch64-tdep.c (aarch64_unwind_sp): Delete.
+	(aarch64_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* arm-tdep.c (arm_unwind_sp): Delete.
+	(arm_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* cris-tdep.c (cris_unwind_sp): Delete.
+	(cris_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* frame-unwind.c (default_unwind_sp): Define new function.
+	* frame-unwind.h (default_unwind_sp): Declare new function.
+	* frame.c (get_frame_sp): Assume gdbarch_unwind_sp is always
+	available.
+	* frv-tdep.c (frv_unwind_sp): Delete.
+	(frv_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* ft32-tdep.c (ft32_unwind_sp): Delete.
+	(ft32_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* gdbarch.c: Regenerate.
+	* gdbarch.h: Regenerate.
+	* gdbarch.sh: Update 'unwind_sp', remove predicate, and supply a
+	default method name.
+	* h8300-tdep.c (h8300_unwind_sp): Delete.
+	(h8300_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* iq2000-tdep.c (iq2000_unwind_sp): Delete.
+	(iq2000_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* lm32-tdep.c (lm32_unwind_sp): Delete.
+	(lm32_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* m32r-tdep.c (m32r_unwind_sp): Delete.
+	(m32r_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* m68hc11-tdep.c (m68hc11_unwind_sp): Delete.
+	(m68hc11_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* mep-tdep.c (mep_unwind_sp): Delete.
+	(mep_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* mn10300-tdep.c (mn10300_unwind_sp): Delete.
+	(mn10300_frame_unwind_init): Don't call set_gdbarch_unwind_sp.
+	(mn10300_push_dummy_call): Call gdbarch_unwind_sp instead.
+	* moxie-tdep.c (moxie_unwind_sp): Delete.
+	(moxie_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* msp430-tdep.c (msp430_unwind_sp): Delete.
+	(msp430_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* nds32-tdep.c (nds32_unwind_sp): Delete.
+	(nds32_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* nios2-tdep.c (nios2_unwind_sp): Delete.
+	(nios2_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* riscv-tdep.c (riscv_unwind_sp): Delete.
+	(riscv_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* rl78-tdep.c (rl78_unwind_sp): Delete.
+	(rl78_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* rx-tdep.c (rx_unwind_sp): Delete.
+	(rx_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* score-tdep.c (score_unwind_sp): Delete.
+	(score_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* sh-tdep.c (sh_unwind_sp): Delete.
+	(sh_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* tic6x-tdep.c (tic6x_unwind_sp): Delete.
+	(tic6x_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* tilegx-tdep.c (tilegx_unwind_sp): Delete.
+	(tilegx_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* v850-tdep.c (v850_unwind_sp): Delete.
+	(v850_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+	* xstormy16-tdep.c (xstormy16_unwind_sp): Delete.
+	(xstormy16_gdbarch_init): Don't call set_gdbarch_unwind_sp.
+
 2018-06-05  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* aarch64-tdep.c (aarch64_dummy_id): Delete.
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 71f5066e996..54234f24505 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1000,14 +1000,6 @@ struct frame_base aarch64_normal_base =
   aarch64_normal_frame_base
 };
 
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-aarch64_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_unwind_register_unsigned (this_frame, AARCH64_SP_REGNUM);
-}
-
 /* Return the value of the REGNUM register in the previous frame of
    *THIS_FRAME.  */
 
@@ -2925,9 +2917,6 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_push_dummy_call (gdbarch, aarch64_push_dummy_call);
   set_gdbarch_frame_align (gdbarch, aarch64_frame_align);
 
-  /* Frame handling.  */
-  set_gdbarch_unwind_sp (gdbarch, aarch64_unwind_sp);
-
   /* Advance PC across function entry code.  */
   set_gdbarch_skip_prologue (gdbarch, aarch64_skip_prologue);
 
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 933cd136941..e37ddb94e43 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -3055,12 +3055,6 @@ struct frame_base arm_normal_base = {
   arm_normal_frame_base
 };
 
-static CORE_ADDR
-arm_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_unwind_register_unsigned (this_frame, ARM_SP_REGNUM);
-}
-
 static struct value *
 arm_dwarf2_prev_register (struct frame_info *this_frame, void **this_cache,
 			  int regnum)
@@ -9332,9 +9326,6 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_write_pc (gdbarch, arm_write_pc);
 
-  /* Frame handling.  */
-  set_gdbarch_unwind_sp (gdbarch, arm_unwind_sp);
-
   frame_base_set_default (gdbarch, &arm_normal_base);
 
   /* Address manipulation.  */
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index a731a673c3f..ab04921b1b4 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -651,9 +651,6 @@ static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc,
 					struct frame_info *this_frame,
 					struct cris_unwind_cache *info);
 
-static CORE_ADDR cris_unwind_sp (struct gdbarch *gdbarch, 
-				 struct frame_info *next_frame);
-
 /* When arguments must be pushed onto the stack, they go on in reverse
    order.  The below implements a FILO (stack) to do this.
    Copied from d10v-tdep.c.  */
@@ -1358,15 +1355,6 @@ cris_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return pc_after_prologue;
 }
 
-static CORE_ADDR
-cris_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST sp;
-  sp = frame_unwind_register_unsigned (next_frame,
-				       gdbarch_sp_regnum (gdbarch));
-  return sp;
-}
-
 /* Implement the breakpoint_kind_from_pc gdbarch method.  */
 
 static int
@@ -4072,8 +4060,6 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_breakpoint_kind_from_pc (gdbarch, cris_breakpoint_kind_from_pc);
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, cris_sw_breakpoint_from_kind);
   
-  set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
-
   if (tdep->cris_dwarf2_cfi == 1)
     {
       /* Hook in the Dwarf-2 frame sniffer.  */
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index d5b20e4af73..df2e5ddc6bd 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -213,6 +213,17 @@ default_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return addr;
 }
 
+/* Default unwind of the SP.  */
+
+CORE_ADDR
+default_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
+{
+  int sp_regnum;
+
+  sp_regnum = gdbarch_sp_regnum (gdbarch);
+  return frame_unwind_register_unsigned (next_frame, sp_regnum);
+}
+
 /* Helper functions for value-based register unwinding.  These return
    a (possibly lazy) value of the appropriate type.  */
 
diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h
index 4dfc7bedcc6..3ca3fdfe727 100644
--- a/gdb/frame-unwind.h
+++ b/gdb/frame-unwind.h
@@ -76,6 +76,12 @@ enum unwind_stop_reason
 extern CORE_ADDR default_unwind_pc (struct gdbarch *gdbarch,
 				    struct frame_info *next_frame);
 
+/* A default unwind_sp callback that simply unwinds the register identified
+   by GDBARCH_SP_REGNUM.  */
+
+extern CORE_ADDR default_unwind_sp (struct gdbarch *gdbarch,
+				    struct frame_info *next_frame);
+
 /* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
    use THIS frame, and through it the NEXT frame's register unwind
    method, to determine the frame ID of THIS frame.
diff --git a/gdb/frame.c b/gdb/frame.c
index 7796cd265d3..3e5001d187b 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2776,18 +2776,9 @@ get_frame_sp (struct frame_info *this_frame)
 {
   struct gdbarch *gdbarch = get_frame_arch (this_frame);
 
-  /* Normality - an architecture that provides a way of obtaining any
-     frame inner-most address.  */
-  if (gdbarch_unwind_sp_p (gdbarch))
-    /* NOTE drow/2008-06-28: gdbarch_unwind_sp could be converted to
-       operate on THIS_FRAME now.  */
-    return gdbarch_unwind_sp (gdbarch, this_frame->next);
-  /* Now things are really are grim.  Hope that the value returned by
-     the gdbarch_sp_regnum register is meaningful.  */
-  if (gdbarch_sp_regnum (gdbarch) >= 0)
-    return get_frame_register_unsigned (this_frame,
-					gdbarch_sp_regnum (gdbarch));
-  internal_error (__FILE__, __LINE__, _("Missing unwind SP method"));
+  /* NOTE drow/2008-06-28: gdbarch_unwind_sp could be converted to
+     operate on THIS_FRAME now.  */
+  return gdbarch_unwind_sp (gdbarch, this_frame->next);
 }
 
 /* Return the reason why we can't unwind past FRAME.  */
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index c967d2a6d16..33ab6137bdf 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1432,12 +1432,6 @@ static const struct frame_base frv_frame_base = {
   frv_frame_base_address
 };
 
-static CORE_ADDR
-frv_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, sp_regnum);
-}
-
 static struct gdbarch *
 frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
@@ -1521,7 +1515,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_return_value (gdbarch, frv_return_value);
 
   /* Frame stuff.  */
-  set_gdbarch_unwind_sp (gdbarch, frv_unwind_sp);
   set_gdbarch_frame_align (gdbarch, frv_frame_align);
   frame_base_set_default (gdbarch, &frv_frame_base);
   /* We set the sniffer lower down after the OSABI hooks have been
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 79cf1a08c1d..17f1ceb7a9b 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -383,14 +383,6 @@ ft32_address_class_name_to_type_flags (struct gdbarch *gdbarch,
     return 0;
 }
 
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-ft32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, FT32_SP_REGNUM);
-}
-
 /* Given a return value in `regbuf' with a type `valtype',
    extract and copy its value into `valbuf'.  */
 
@@ -586,8 +578,6 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 				     func_void_type);
   TYPE_INSTANCE_FLAGS (tdep->pc_type) |= TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
 
-  set_gdbarch_unwind_sp (gdbarch, ft32_unwind_sp);
-
   set_gdbarch_num_regs (gdbarch, FT32_NUM_REGS);
   set_gdbarch_sp_regnum (gdbarch, FT32_SP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, FT32_PC_REGNUM);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 1ba256f921a..41e596630ec 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -430,6 +430,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
   gdbarch->remote_register_number = default_remote_register_number;
   gdbarch->unwind_pc = default_unwind_pc;
+  gdbarch->unwind_sp = default_unwind_sp;
   gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr;
   gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
   gdbarch->addr_bits_remove = core_addr_identity;
@@ -613,7 +614,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of fetch_tls_load_module_address, has predicate.  */
   /* Skip verify of frame_args_skip, invalid_p == 0 */
   /* Skip verify of unwind_pc, invalid_p == 0 */
-  /* Skip verify of unwind_sp, has predicate.  */
+  /* Skip verify of unwind_sp, invalid_p == 0 */
   /* Skip verify of frame_num_args, has predicate.  */
   /* Skip verify of frame_align, has predicate.  */
   /* Skip verify of stabs_argument_has_addr, invalid_p == 0 */
@@ -1439,9 +1440,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "gdbarch_dump: unwind_pc = <%s>\n",
                       host_address_to_string (gdbarch->unwind_pc));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_unwind_sp_p() = %d\n",
-                      gdbarch_unwind_sp_p (gdbarch));
   fprintf_unfiltered (file,
                       "gdbarch_dump: unwind_sp = <%s>\n",
                       host_address_to_string (gdbarch->unwind_sp));
@@ -3049,13 +3047,6 @@ set_gdbarch_unwind_pc (struct gdbarch *gdbarch,
   gdbarch->unwind_pc = unwind_pc;
 }
 
-int
-gdbarch_unwind_sp_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->unwind_sp != NULL;
-}
-
 CORE_ADDR
 gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 4d994a17b50..1c9478efee8 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -622,8 +622,6 @@ typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct fra
 extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc);
 
-extern int gdbarch_unwind_sp_p (struct gdbarch *gdbarch);
-
 typedef CORE_ADDR (gdbarch_unwind_sp_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern CORE_ADDR gdbarch_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern void set_gdbarch_unwind_sp (struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype *unwind_sp);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 6db8b0eb50a..02b519043bb 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -597,7 +597,7 @@ F;CORE_ADDR;fetch_tls_load_module_address;struct objfile *objfile;objfile
 #
 v;CORE_ADDR;frame_args_skip;;;0;;;0
 m;CORE_ADDR;unwind_pc;struct frame_info *next_frame;next_frame;;default_unwind_pc;;0
-M;CORE_ADDR;unwind_sp;struct frame_info *next_frame;next_frame
+m;CORE_ADDR;unwind_sp;struct frame_info *next_frame;next_frame;;default_unwind_sp;;0
 # DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
 # frame-base.  Enable frame-base before frame-unwind.
 F;int;frame_num_args;struct frame_info *frame;frame
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index fa2597f9d0d..f043704591c 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -92,12 +92,6 @@ static int is_h8300_normal_mode (struct gdbarch *gdbarch);
 		  && !is_h8300_normal_mode (gdbarch)) \
 		 ? h8300h_reg_size : h8300_reg_size)
 
-static CORE_ADDR
-h8300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
-}
-
 /* Normal frames.  */
 
 /* Allocate and initialize a frame cache.  */
@@ -1340,7 +1334,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue);
 
   /* Frame unwinder.  */
-  set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp);
   frame_base_set_default (gdbarch, &h8300_frame_base);
 
   /* 
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index f98b9066858..5dbc18bb67e 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -434,12 +434,6 @@ static const struct frame_unwind iq2000_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-iq2000_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
-}   
-
 static CORE_ADDR
 iq2000_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -827,7 +821,6 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_inner_than           (gdbarch, core_addr_lessthan);
   set_gdbarch_register_type (gdbarch, iq2000_register_type);
   set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
-  set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
   frame_base_set_default (gdbarch, &iq2000_frame_base);
   set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call);
 
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 651b09c73ec..5cf15625304 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -382,12 +382,6 @@ lm32_return_value (struct gdbarch *gdbarch, struct value *function,
   return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-static CORE_ADDR
-lm32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, SIM_LM32_SP_REGNUM);
-}
-
 /* Put here the code to store, into fi->saved_regs, the addresses of
    the saved registers of frame described by FRAME_INFO.  This
    includes special registers such as pc and fp saved in special ways
@@ -537,7 +531,6 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frame unwinding.  */
   set_gdbarch_frame_align (gdbarch, lm32_frame_align);
   frame_base_set_default (gdbarch, &lm32_frame_base);
-  set_gdbarch_unwind_sp (gdbarch, lm32_unwind_sp);
   frame_unwind_append_unwinder (gdbarch, &lm32_frame_unwind);
 
   /* Breakpoints.  */
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 77019162d22..4b2ab6d01bf 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -649,13 +649,6 @@ m32r_frame_unwind_cache (struct frame_info *this_frame,
   return info;
 }
 
-static CORE_ADDR
-m32r_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
-}
-
-
 static CORE_ADDR
 m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
 		      struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
@@ -884,8 +877,6 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_wchar_bit (gdbarch, 16);
   set_gdbarch_wchar_signed (gdbarch, 0);
 
-  set_gdbarch_unwind_sp (gdbarch, m32r_unwind_sp);
-
   set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS);
   set_gdbarch_pc_regnum (gdbarch, M32R_PC_REGNUM);
   set_gdbarch_sp_regnum (gdbarch, M32R_SP_REGNUM);
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 52dc118e622..52320fbebb4 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -967,14 +967,6 @@ static const struct frame_base m68hc11_frame_base = {
   m68hc11_frame_args_address
 };
 
-static CORE_ADDR
-m68hc11_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST sp;
-  sp = frame_unwind_register_unsigned (next_frame, HARD_SP_REGNUM);
-  return sp;
-}
-
 /* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
    frame.  The frame ID's base needs to match the TOS value saved by
    save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint.  */
@@ -1481,8 +1473,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
   /* Characters are unsigned.  */
   set_gdbarch_char_signed (gdbarch, 0);
 
-  set_gdbarch_unwind_sp (gdbarch, m68hc11_unwind_sp);
-
   /* Set register info.  */
   set_gdbarch_fp0_regnum (gdbarch, -1);
 
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index 2e434daa41e..9fa64b2b46d 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -2061,16 +2061,6 @@ static const struct frame_unwind mep_frame_unwind = {
   NULL,
   default_frame_sniffer
 };
-
-
-/* Our general unwinding function can handle unwinding the SP.  */
-static CORE_ADDR
-mep_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MEP_SP_REGNUM);
-}
-
-
 \f
 /* Return values.  */
 
@@ -2446,7 +2436,6 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frames and frame unwinding.  */
   frame_unwind_append_unwinder (gdbarch, &mep_frame_unwind);
-  set_gdbarch_unwind_sp (gdbarch, mep_unwind_sp);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_frame_args_skip (gdbarch, 0);
 
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index 3b366e9322d..1dda06310cc 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1140,21 +1140,11 @@ static const struct frame_unwind mn10300_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-mn10300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST sp;
-
-  sp = frame_unwind_register_unsigned (this_frame, E_SP_REGNUM);
-  return sp;
-}
-
 static void
 mn10300_frame_unwind_init (struct gdbarch *gdbarch)
 {
   dwarf2_append_unwinders (gdbarch);
   frame_unwind_append_unwinder (gdbarch, &mn10300_frame_unwind);
-  set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp);
 }
 
 /* Function: push_dummy_call
@@ -1288,7 +1278,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
   {
     CORE_ADDR func_addr = find_function_addr (target_func, NULL);
     CORE_ADDR unwound_sp 
-      = mn10300_unwind_sp (gdbarch, create_new_frame (sp, func_addr));
+      = gdbarch_unwind_sp (gdbarch, create_new_frame (sp, func_addr));
     if (sp != unwound_sp)
       regcache_cooked_write_unsigned (regcache, E_SP_REGNUM,
                                       sp - (unwound_sp - sp));
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index ca235050df5..9835545ab27 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -447,14 +447,6 @@ moxie_software_single_step (struct regcache *regcache)
   return next_pcs;
 }
 
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-moxie_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MOXIE_SP_REGNUM);
-}
-
 /* Given a return value in `regbuf' with a type `valtype', 
    extract and copy its value into `valbuf'.  */
 
@@ -1073,8 +1065,6 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_wchar_bit (gdbarch, 32);
   set_gdbarch_wchar_signed (gdbarch, 0);
 
-  set_gdbarch_unwind_sp (gdbarch, moxie_unwind_sp);
-
   set_gdbarch_num_regs (gdbarch, MOXIE_NUM_REGS);
   set_gdbarch_sp_regnum (gdbarch, MOXIE_SP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, MOXIE_PC_REGNUM);
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 3f09b594f8b..b53ad567cb1 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -447,14 +447,6 @@ msp430_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return p.prologue_end;
 }
 
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-msp430_unwind_sp (struct gdbarch *arch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MSP430_SP_REGNUM);
-}
-
 /* Given a frame described by THIS_FRAME, decode the prologue of its
    associated function if there is not cache entry as specified by
    THIS_PROLOGUE_CACHE.  Save the decoded prologue in the cache and
@@ -975,7 +967,6 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frames, prologues, etc.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_prologue (gdbarch, msp430_skip_prologue);
-  set_gdbarch_unwind_sp (gdbarch, msp430_unwind_sp);
   set_gdbarch_frame_align (gdbarch, msp430_frame_align);
   dwarf2_append_unwinders (gdbarch);
   frame_unwind_append_unwinder (gdbarch, &msp430_unwind);
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index 5df7054f621..6a50d4f0c94 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -1388,14 +1388,6 @@ static const struct frame_unwind nds32_epilogue_frame_unwind =
   nds32_epilogue_frame_sniffer
 };
 \f
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-nds32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, NDS32_SP_REGNUM);
-}
-\f
 /* Floating type and struct type that has only one floating type member
    can pass value using FPU registers (when FPU ABI is used).  */
 
@@ -2120,7 +2112,6 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_sp_regnum (gdbarch, NDS32_SP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, NDS32_PC_REGNUM);
-  set_gdbarch_unwind_sp (gdbarch, nds32_unwind_sp);
   set_gdbarch_stack_frame_destroyed_p (gdbarch, nds32_stack_frame_destroyed_p);
   set_gdbarch_dwarf2_reg_to_regnum (gdbarch, nds32_dwarf2_reg_to_regnum);
 
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index f41fde2da2f..7e0cb3327b3 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -1878,14 +1878,6 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
   return sp;
 }
 
-/* Implement the unwind_sp gdbarch method.  */
-
-static CORE_ADDR
-nios2_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_unwind_register_unsigned (this_frame, NIOS2_SP_REGNUM);
-}
-
 /* Use prologue analysis to fill in the register cache
    *THIS_PROLOGUE_CACHE for THIS_FRAME.  This function initializes
    *THIS_PROLOGUE_CACHE first.  */
@@ -2300,8 +2292,6 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_breakpoint_kind_from_pc (gdbarch, nios2_breakpoint_kind_from_pc);
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, nios2_sw_breakpoint_from_kind);
 
-  set_gdbarch_unwind_sp (gdbarch, nios2_unwind_sp);
-
   /* The dwarf2 unwinder will normally produce the best results if
      the debug information is available, so register it first.  */
   dwarf2_append_unwinders (gdbarch);
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 7ef04627bef..7c35b129b48 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -2322,14 +2322,6 @@ riscv_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
   return align_down (addr, 16);
 }
 
-/* Implement the unwind_sp gdbarch method.  */
-
-static CORE_ADDR
-riscv_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, RISCV_SP_REGNUM);
-}
-
 /* Generate, or return the cached frame cache for the RiscV frame
    unwinder.  */
 
@@ -2526,9 +2518,6 @@ riscv_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_frame_align (gdbarch, riscv_frame_align);
 
-  /* Functions to access frame data.  */
-  set_gdbarch_unwind_sp (gdbarch, riscv_unwind_sp);
-
   /* Functions handling dummy frames.  */
   set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
   set_gdbarch_push_dummy_code (gdbarch, riscv_push_dummy_code);
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index 70955d966fa..5418a480bb7 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -1074,14 +1074,6 @@ rl78_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return p.prologue_end;
 }
 
-/* Implement the "unwind_sp" gdbarch method.  */
-
-static CORE_ADDR
-rl78_unwind_sp (struct gdbarch *arch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, RL78_SP_REGNUM);
-}
-
 /* Given a frame described by THIS_FRAME, decode the prologue of its
    associated function if there is not cache entry as specified by
    THIS_PROLOGUE_CACHE.  Save the decoded prologue in the cache and
@@ -1458,7 +1450,6 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frames, prologues, etc.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_prologue (gdbarch, rl78_skip_prologue);
-  set_gdbarch_unwind_sp (gdbarch, rl78_unwind_sp);
   set_gdbarch_frame_align (gdbarch, rl78_frame_align);
 
   dwarf2_append_unwinders (gdbarch);
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 07e83d0e11e..9c85c3cc232 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -751,16 +751,6 @@ static const struct frame_unwind rx_exception_unwind = {
   rx_exception_sniffer
 };
 
-/* Implement the "unwind_sp" gdbarch method.  */
-static CORE_ADDR
-rx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST sp;
-
-  sp = frame_unwind_register_unsigned (this_frame, RX_SP_REGNUM);
-  return sp;
-}
-
 /* Implement the "push_dummy_call" gdbarch method.  */
 static CORE_ADDR
 rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
@@ -1091,8 +1081,6 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, rx_breakpoint::bp_from_kind);
   set_gdbarch_skip_prologue (gdbarch, rx_skip_prologue);
 
-  set_gdbarch_unwind_sp (gdbarch, rx_unwind_sp);
-
   /* Target builtin data types.  */
   set_gdbarch_char_signed (gdbarch, 0);
   set_gdbarch_short_bit (gdbarch, 16);
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index f2d831899d1..67ea08154bd 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -64,12 +64,6 @@ score_register_type (struct gdbarch *gdbarch, int regnum)
   return builtin_type (gdbarch)->builtin_uint32;
 }
 
-static CORE_ADDR
-score_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM);
-}
-
 static const char *
 score7_register_name (struct gdbarch *gdbarch, int regnum)
 {
@@ -1465,7 +1459,6 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_type (gdbarch, score_register_type);
   set_gdbarch_frame_align (gdbarch, score_frame_align);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
-  set_gdbarch_unwind_sp (gdbarch, score_unwind_sp);
 
   switch (target_mach)
     {
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index a65fd170c02..b7407375d0d 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1975,13 +1975,6 @@ static const struct frame_unwind sh_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_sp_regnum (gdbarch));
-}
-
 static CORE_ADDR
 sh_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -2290,7 +2283,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
   set_gdbarch_frame_align (gdbarch, sh_frame_align);
-  set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp);
   frame_base_set_default (gdbarch, &sh_frame_base);
 
   set_gdbarch_stack_frame_destroyed_p (gdbarch, sh_stack_frame_destroyed_p);
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index 84fad648db1..78b90a4bec9 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -366,15 +366,6 @@ tic6x_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
     reg->how = DWARF2_FRAME_REG_UNDEFINED;
 }
 
-/* This is the implementation of gdbarch method unwind_sp.  */
-
-static CORE_ADDR
-tic6x_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  return frame_unwind_register_unsigned (this_frame, TIC6X_SP_REGNUM);
-}
-
-
 /* Frame base handling.  */
 
 static struct tic6x_unwind_cache*
@@ -1263,8 +1254,6 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch,
 				       tic6x_sw_breakpoint_from_kind);
 
-  set_gdbarch_unwind_sp (gdbarch, tic6x_unwind_sp);
-
   /* Unwinding.  */
   dwarf2_append_unwinders (gdbarch);
 
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index f8a8153bb3e..4f7bc9cfbc4 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -930,12 +930,6 @@ static const struct frame_base tilegx_frame_base = {
   tilegx_frame_base_address
 };
 
-static CORE_ADDR
-tilegx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, TILEGX_SP_REGNUM);
-}
-
 /* We cannot read/write the "special" registers.  */
 
 static int
@@ -1010,7 +1004,6 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
 
   /* Frame Info.  */
-  set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp);
   set_gdbarch_frame_align (gdbarch, tilegx_frame_align);
   frame_base_set_default (gdbarch, &tilegx_frame_base);
 
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 6434ceb1de4..719e1598ec9 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1326,13 +1326,6 @@ static const struct frame_unwind v850_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_sp_regnum (gdbarch));
-} 
-
 static CORE_ADDR
 v850_frame_base_address (struct frame_info *this_frame, void **this_cache)
 {
@@ -1449,7 +1442,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_skip_prologue (gdbarch, v850_skip_prologue);
 
   set_gdbarch_frame_align (gdbarch, v850_frame_align);
-  set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp);
   frame_base_set_default (gdbarch, &v850_frame_base);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index ee378600958..43b252a332e 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -751,12 +751,6 @@ static const struct frame_base xstormy16_frame_base = {
   xstormy16_frame_base_address
 };
 
-static CORE_ADDR
-xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
-}
-
 /* Function: xstormy16_gdbarch_init
    Initializer function for the xstormy16 gdbarch vector.
    Called by gdbarch.  Sets up the gdbarch vector(s) for this target.  */
@@ -810,7 +804,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /*
    * Frame Info
    */
-  set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
   set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
   frame_base_set_default (gdbarch, &xstormy16_frame_base);
 
-- 
2.14.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCHv3 1/4] gdb: Add a default_unwind_pc method for gdbarch
  2018-04-10 10:13 ` PING: Re: [PATCHv2 0/4] Supply additional default gdbarch methods Andrew Burgess
                     ` (3 preceding siblings ...)
  2018-06-05 14:35   ` [PATCHv3 3/4] gdb: Supply a default for gdbarch_dummy_id Andrew Burgess
@ 2018-06-05 14:35   ` Andrew Burgess
  4 siblings, 0 replies; 14+ messages in thread
From: Andrew Burgess @ 2018-06-05 14:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Many architectures gdbarch unwind_pc method follow the same pattern.
Provide a default method and convert targets to use it where possible.

gdb/ChangeLog:

	* aarch64-tdep.c (aarch64_unwind_pc): Deleted.
	(aarch64_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* alpha-tdep.c (alpha_unwind_pc): Deleted.
	(alpha_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* bfin-tdep.c (bfin_unwind_pc): Deleted.
	(bfin_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* cris-tdep.c (cris_unwind_pc): Deleted.
	(cris_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* frame-unwind.c (default_unwind_pc): New function.
	* frame-unwind.h (default_unwind_pc): Declare new function.
	* frame.c: Remove use of gdbarch_unwind_pc_p and reindent.
	* frv-tdep.c (frv_unwind_pc): Deleted.
	(frv_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* ft32-tdep.c (ft32_unwind_pc): Deleted.
	(ft32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.
	* gdbarch.sh: Update unwind_pc spec, and add new header file to be
	included.
	* h8300-tdep.c (h8300_unwind_pc): Deleted.
	(h8300_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* iq2000-tdep.c (iq2000_unwind_pc): Deleted.
	(iq2000_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* lm32-tdep.c (lm32_unwind_pc): Deleted.
	(lm32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* m32r-tdep.c (m32r_unwind_pc): Deleted.
	(m32r_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* m68hc11-tdep.c (m68hc11_unwind_pc): Deleted.
	(m68hc11_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* mep-tdep.c (mep_unwind_pc): Deleted.
	(mep_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* mn10300-tdep.c (mn10300_unwind_pc): Deleted.
	(mn10300_frame_unwind_init): Delete use of set_gdbarch_unwind_pc.
	* moxie-tdep.c (moxie_unwind_pc): Deleted.
	(moxie_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* msp430-tdep.c (msp430_unwind_pc): Deleted.
	(msp430_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* nds32-tdep.c (nds32_unwind_pc): Deleted.
	(nds32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* riscv-tdep.c (riscv_unwind_pc): Deleted.
	(riscv_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* rs6000-tdep.c (rs6000_unwind_pc): Deleted.
	(rs6000_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* rx-tdep.c (rx_unwind_pc): Deleted.
	(rx_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* score-tdep.c (score_unwind_pc): Deleted.
	(score_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* sh-tdep.c (sh_unwind_pc): Deleted.
	(sh_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* sparc-tdep.c (sparc_unwind_pc): Deleted.
	(sparc32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* tilegx-tdep.c (tilegx_unwind_pc): Deleted.
	(tilegx_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* v850-tdep.c (v850_unwind_pc): Deleted.
	(v850_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* vax-tdep.c (vax_unwind_pc): Deleted.
	(vax_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
	* xstormy16-tdep.c (xstormy16_unwind_pc): Deleted.
	(xstormy16_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
---
 gdb/ChangeLog        |  62 +++++++++++++++++++++++++++
 gdb/aarch64-tdep.c   |  12 ------
 gdb/alpha-tdep.c     |  11 -----
 gdb/bfin-tdep.c      |   7 ---
 gdb/cris-tdep.c      |  13 ------
 gdb/frame-unwind.c   |   9 ++++
 gdb/frame-unwind.h   |   6 +++
 gdb/frame.c          | 117 ++++++++++++++++++++++++---------------------------
 gdb/frv-tdep.c       |   7 ---
 gdb/ft32-tdep.c      |  10 -----
 gdb/gdbarch.c        |  14 ++----
 gdb/gdbarch.h        |   2 -
 gdb/gdbarch.sh       |   3 +-
 gdb/h8300-tdep.c     |   7 ---
 gdb/iq2000-tdep.c    |   7 ---
 gdb/lm32-tdep.c      |   7 ---
 gdb/m32r-tdep.c      |  11 -----
 gdb/m68hc11-tdep.c   |  14 ------
 gdb/mep-tdep.c       |   9 ----
 gdb/mn10300-tdep.c   |  10 -----
 gdb/moxie-tdep.c     |  10 -----
 gdb/msp430-tdep.c    |   9 ----
 gdb/nds32-tdep.c     |   9 ----
 gdb/riscv-tdep.c     |   9 ----
 gdb/rs6000-tdep.c    |   9 ----
 gdb/rx-tdep.c        |  11 -----
 gdb/score-tdep.c     |   7 ---
 gdb/sh-tdep.c        |   8 ----
 gdb/sparc-tdep.c     |   9 ----
 gdb/tilegx-tdep.c    |   7 ---
 gdb/v850-tdep.c      |   8 ----
 gdb/vax-tdep.c       |   8 ----
 gdb/xstormy16-tdep.c |   7 ---
 33 files changed, 138 insertions(+), 311 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f77cb67271c..9d316fbce98 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,65 @@
+2018-06-05  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* aarch64-tdep.c (aarch64_unwind_pc): Deleted.
+	(aarch64_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* alpha-tdep.c (alpha_unwind_pc): Deleted.
+	(alpha_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* bfin-tdep.c (bfin_unwind_pc): Deleted.
+	(bfin_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* cris-tdep.c (cris_unwind_pc): Deleted.
+	(cris_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* frame-unwind.c (default_unwind_pc): New function.
+	* frame-unwind.h (default_unwind_pc): Declare new function.
+	* frame.c: Remove use of gdbarch_unwind_pc_p and reindent.
+	* frv-tdep.c (frv_unwind_pc): Deleted.
+	(frv_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* ft32-tdep.c (ft32_unwind_pc): Deleted.
+	(ft32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* gdbarch.c: Regenerate.
+	* gdbarch.h: Regenerate.
+	* gdbarch.sh: Update unwind_pc spec, and add new header file to be
+	included.
+	* h8300-tdep.c (h8300_unwind_pc): Deleted.
+	(h8300_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* iq2000-tdep.c (iq2000_unwind_pc): Deleted.
+	(iq2000_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* lm32-tdep.c (lm32_unwind_pc): Deleted.
+	(lm32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* m32r-tdep.c (m32r_unwind_pc): Deleted.
+	(m32r_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* m68hc11-tdep.c (m68hc11_unwind_pc): Deleted.
+	(m68hc11_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* mep-tdep.c (mep_unwind_pc): Deleted.
+	(mep_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* mn10300-tdep.c (mn10300_unwind_pc): Deleted.
+	(mn10300_frame_unwind_init): Delete use of set_gdbarch_unwind_pc.
+	* moxie-tdep.c (moxie_unwind_pc): Deleted.
+	(moxie_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* msp430-tdep.c (msp430_unwind_pc): Deleted.
+	(msp430_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* nds32-tdep.c (nds32_unwind_pc): Deleted.
+	(nds32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* riscv-tdep.c (riscv_unwind_pc): Deleted.
+	(riscv_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* rs6000-tdep.c (rs6000_unwind_pc): Deleted.
+	(rs6000_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* rx-tdep.c (rx_unwind_pc): Deleted.
+	(rx_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* score-tdep.c (score_unwind_pc): Deleted.
+	(score_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* sh-tdep.c (sh_unwind_pc): Deleted.
+	(sh_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* sparc-tdep.c (sparc_unwind_pc): Deleted.
+	(sparc32_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* tilegx-tdep.c (tilegx_unwind_pc): Deleted.
+	(tilegx_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* v850-tdep.c (v850_unwind_pc): Deleted.
+	(v850_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* vax-tdep.c (vax_unwind_pc): Deleted.
+	(vax_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+	* xstormy16-tdep.c (xstormy16_unwind_pc): Deleted.
+	(xstormy16_gdbarch_init): Delete use of set_gdbarch_unwind_pc.
+
 2018-06-04  Tom Tromey  <tom@tromey.com>
 
 	* ada-lang.h (ada_lookup_symbol_list): Update.
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index c6b1e2a9a3c..1d837ec4771 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1014,17 +1014,6 @@ aarch64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 			 get_frame_pc (this_frame));
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-aarch64_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  CORE_ADDR pc
-    = frame_unwind_register_unsigned (this_frame, AARCH64_PC_REGNUM);
-
-  return pc;
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -2952,7 +2941,6 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame handling.  */
   set_gdbarch_dummy_id (gdbarch, aarch64_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, aarch64_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, aarch64_unwind_sp);
 
   /* Advance PC across function entry code.  */
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 53943e1d77a..26b7e34ad23 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -1477,14 +1477,6 @@ alpha_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
   return frame_id_build (base, get_frame_pc (this_frame));
 }
 
-static CORE_ADDR
-alpha_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST pc;
-  pc = frame_unwind_register_unsigned (next_frame, ALPHA_PC_REGNUM);
-  return pc;
-}
-
 \f
 /* Helper routines for alpha*-nat.c files to move register sets to and
    from core files.  The UNIQUE pointer is allowed to be NULL, as most
@@ -1809,9 +1801,6 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Methods for saving / extracting a dummy frame's ID.  */
   set_gdbarch_dummy_id (gdbarch, alpha_dummy_id);
 
-  /* Return the unwound PC value.  */
-  set_gdbarch_unwind_pc (gdbarch, alpha_unwind_pc);
-
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index da62130231b..b60dd00dbb5 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -766,12 +766,6 @@ bfin_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
   return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
-static CORE_ADDR
-bfin_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, BFIN_PC_REGNUM);
-}
-
 static CORE_ADDR
 bfin_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
 {
@@ -836,7 +830,6 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, bfin_sw_breakpoint_from_kind);
   set_gdbarch_decr_pc_after_break (gdbarch, 2);
   set_gdbarch_frame_args_skip (gdbarch, 8);
-  set_gdbarch_unwind_pc (gdbarch, bfin_unwind_pc);
   set_gdbarch_frame_align (gdbarch, bfin_frame_align);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index e0371a2a282..d86d9830b8d 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -651,9 +651,6 @@ static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc,
 					struct frame_info *this_frame,
 					struct cris_unwind_cache *info);
 
-static CORE_ADDR cris_unwind_pc (struct gdbarch *gdbarch, 
-				 struct frame_info *next_frame);
-
 static CORE_ADDR cris_unwind_sp (struct gdbarch *gdbarch, 
 				 struct frame_info *next_frame);
 
@@ -1373,15 +1370,6 @@ cris_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return pc_after_prologue;
 }
 
-static CORE_ADDR
-cris_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST pc;
-  pc = frame_unwind_register_unsigned (next_frame,
-				       gdbarch_pc_regnum (gdbarch));
-  return pc;
-}
-
 static CORE_ADDR
 cris_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -4096,7 +4084,6 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_breakpoint_kind_from_pc (gdbarch, cris_breakpoint_kind_from_pc);
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, cris_sw_breakpoint_from_kind);
   
-  set_gdbarch_unwind_pc (gdbarch, cris_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
   set_gdbarch_dummy_id (gdbarch, cris_dummy_id);
 
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index e6e63539ad7..0eed572ebbb 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -193,6 +193,15 @@ default_frame_unwind_stop_reason (struct frame_info *this_frame,
     return UNWIND_NO_REASON;
 }
 
+/* Default unwind of the PC.  */
+
+CORE_ADDR
+default_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
+{
+  int pc_regnum = gdbarch_pc_regnum (gdbarch);
+  return frame_unwind_register_unsigned (next_frame, pc_regnum);
+}
+
 /* Helper functions for value-based register unwinding.  These return
    a (possibly lazy) value of the appropriate type.  */
 
diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h
index af220f72a01..4dfc7bedcc6 100644
--- a/gdb/frame-unwind.h
+++ b/gdb/frame-unwind.h
@@ -70,6 +70,12 @@ enum unwind_stop_reason
   default_frame_unwind_stop_reason (struct frame_info *this_frame,
 				    void **this_cache);
 
+/* A default unwind_pc callback that simply unwinds the register identified
+   by GDBARCH_PC_REGNUM.  */
+
+extern CORE_ADDR default_unwind_pc (struct gdbarch *gdbarch,
+				    struct frame_info *next_frame);
+
 /* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
    use THIS frame, and through it the NEXT frame's register unwind
    method, to determine the frame ID of THIS frame.
diff --git a/gdb/frame.c b/gdb/frame.c
index 89f48aea696..7796cd265d3 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -872,76 +872,71 @@ frame_unwind_pc (struct frame_info *this_frame)
 {
   if (this_frame->prev_pc.status == CC_UNKNOWN)
     {
-      if (gdbarch_unwind_pc_p (frame_unwind_arch (this_frame)))
+      struct gdbarch *prev_gdbarch;
+      CORE_ADDR pc = 0;
+      int pc_p = 0;
+
+      /* The right way.  The `pure' way.  The one true way.  This
+	 method depends solely on the register-unwind code to
+	 determine the value of registers in THIS frame, and hence
+	 the value of this frame's PC (resume address).  A typical
+	 implementation is no more than:
+
+	 frame_unwind_register (this_frame, ISA_PC_REGNUM, buf);
+	 return extract_unsigned_integer (buf, size of ISA_PC_REGNUM);
+
+	 Note: this method is very heavily dependent on a correct
+	 register-unwind implementation, it pays to fix that
+	 method first; this method is frame type agnostic, since
+	 it only deals with register values, it works with any
+	 frame.  This is all in stark contrast to the old
+	 FRAME_SAVED_PC which would try to directly handle all the
+	 different ways that a PC could be unwound.  */
+      prev_gdbarch = frame_unwind_arch (this_frame);
+
+      TRY
 	{
-	  struct gdbarch *prev_gdbarch;
-	  CORE_ADDR pc = 0;
-	  int pc_p = 0;
-
-	  /* The right way.  The `pure' way.  The one true way.  This
-	     method depends solely on the register-unwind code to
-	     determine the value of registers in THIS frame, and hence
-	     the value of this frame's PC (resume address).  A typical
-	     implementation is no more than:
-	   
-	     frame_unwind_register (this_frame, ISA_PC_REGNUM, buf);
-	     return extract_unsigned_integer (buf, size of ISA_PC_REGNUM);
-
-	     Note: this method is very heavily dependent on a correct
-	     register-unwind implementation, it pays to fix that
-	     method first; this method is frame type agnostic, since
-	     it only deals with register values, it works with any
-	     frame.  This is all in stark contrast to the old
-	     FRAME_SAVED_PC which would try to directly handle all the
-	     different ways that a PC could be unwound.  */
-	  prev_gdbarch = frame_unwind_arch (this_frame);
-
-	  TRY
+	  pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
+	  pc_p = 1;
+	}
+      CATCH (ex, RETURN_MASK_ERROR)
+	{
+	  if (ex.error == NOT_AVAILABLE_ERROR)
 	    {
-	      pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
-	      pc_p = 1;
+	      this_frame->prev_pc.status = CC_UNAVAILABLE;
+
+	      if (frame_debug)
+		fprintf_unfiltered (gdb_stdlog,
+				    "{ frame_unwind_pc (this_frame=%d)"
+				    " -> <unavailable> }\n",
+				    this_frame->level);
 	    }
-	  CATCH (ex, RETURN_MASK_ERROR)
+	  else if (ex.error == OPTIMIZED_OUT_ERROR)
 	    {
-	      if (ex.error == NOT_AVAILABLE_ERROR)
-		{
-		  this_frame->prev_pc.status = CC_UNAVAILABLE;
-
-		  if (frame_debug)
-		    fprintf_unfiltered (gdb_stdlog,
-					"{ frame_unwind_pc (this_frame=%d)"
-					" -> <unavailable> }\n",
-					this_frame->level);
-		}
-	      else if (ex.error == OPTIMIZED_OUT_ERROR)
-		{
-		  this_frame->prev_pc.status = CC_NOT_SAVED;
-
-		  if (frame_debug)
-		    fprintf_unfiltered (gdb_stdlog,
-					"{ frame_unwind_pc (this_frame=%d)"
-					" -> <not saved> }\n",
-					this_frame->level);
-		}
-	      else
-		throw_exception (ex);
-	    }
-	  END_CATCH
+	      this_frame->prev_pc.status = CC_NOT_SAVED;
 
-	  if (pc_p)
-	    {
-	      this_frame->prev_pc.value = pc;
-	      this_frame->prev_pc.status = CC_VALUE;
 	      if (frame_debug)
 		fprintf_unfiltered (gdb_stdlog,
-				    "{ frame_unwind_pc (this_frame=%d) "
-				    "-> %s }\n",
-				    this_frame->level,
-				    hex_string (this_frame->prev_pc.value));
+				    "{ frame_unwind_pc (this_frame=%d)"
+				    " -> <not saved> }\n",
+				    this_frame->level);
 	    }
+	  else
+	    throw_exception (ex);
+	}
+      END_CATCH
+
+      if (pc_p)
+	{
+	  this_frame->prev_pc.value = pc;
+	  this_frame->prev_pc.status = CC_VALUE;
+	  if (frame_debug)
+	    fprintf_unfiltered (gdb_stdlog,
+				"{ frame_unwind_pc (this_frame=%d) "
+				"-> %s }\n",
+				this_frame->level,
+				hex_string (this_frame->prev_pc.value));
 	}
-      else
-	internal_error (__FILE__, __LINE__, _("No unwind_pc method"));
     }
 
   if (this_frame->prev_pc.status == CC_VALUE)
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 1eed441f2b3..8170bf94fdb 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1366,12 +1366,6 @@ frv_return_value (struct gdbarch *gdbarch, struct value *function,
     return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-static CORE_ADDR
-frv_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, pc_regnum);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -1539,7 +1533,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_return_value (gdbarch, frv_return_value);
 
   /* Frame stuff.  */
-  set_gdbarch_unwind_pc (gdbarch, frv_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, frv_unwind_sp);
   set_gdbarch_frame_align (gdbarch, frv_frame_align);
   frame_base_set_default (gdbarch, &frv_frame_base);
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 7198b84aca0..5c0a3384dbd 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -492,14 +492,6 @@ ft32_frame_cache (struct frame_info *this_frame, void **this_cache)
   return cache;
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-ft32_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, FT32_PC_REGNUM);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -627,8 +619,6 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, ft32_dummy_id);
 
-  set_gdbarch_unwind_pc (gdbarch, ft32_unwind_pc);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 558cc555b4b..dcd2d59f16c 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -48,6 +48,7 @@
 #include "regcache.h"
 #include "objfiles.h"
 #include "auxv.h"
+#include "frame-unwind.h"
 
 /* Static function declarations */
 
@@ -426,6 +427,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
   gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
   gdbarch->remote_register_number = default_remote_register_number;
+  gdbarch->unwind_pc = default_unwind_pc;
   gdbarch->stabs_argument_has_addr = default_stabs_argument_has_addr;
   gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
   gdbarch->addr_bits_remove = core_addr_identity;
@@ -608,7 +610,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of remote_register_number, invalid_p == 0 */
   /* Skip verify of fetch_tls_load_module_address, has predicate.  */
   /* Skip verify of frame_args_skip, invalid_p == 0 */
-  /* Skip verify of unwind_pc, has predicate.  */
+  /* Skip verify of unwind_pc, invalid_p == 0 */
   /* Skip verify of unwind_sp, has predicate.  */
   /* Skip verify of frame_num_args, has predicate.  */
   /* Skip verify of frame_align, has predicate.  */
@@ -1435,9 +1437,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "gdbarch_dump: type_align = <%s>\n",
                       host_address_to_string (gdbarch->type_align));
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n",
-                      gdbarch_unwind_pc_p (gdbarch));
   fprintf_unfiltered (file,
                       "gdbarch_dump: unwind_pc = <%s>\n",
                       host_address_to_string (gdbarch->unwind_pc));
@@ -3041,13 +3040,6 @@ set_gdbarch_frame_args_skip (struct gdbarch *gdbarch,
   gdbarch->frame_args_skip = frame_args_skip;
 }
 
-int
-gdbarch_unwind_pc_p (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  return gdbarch->unwind_pc != NULL;
-}
-
 CORE_ADDR
 gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 09edcd5eb28..c71974f2b36 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -620,8 +620,6 @@ extern void set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
 extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch);
 extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip);
 
-extern int gdbarch_unwind_pc_p (struct gdbarch *gdbarch);
-
 typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame);
 extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 0a23b1ee0e7..19aaa4200d2 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -596,7 +596,7 @@ m;int;remote_register_number;int regno;regno;;default_remote_register_number;;0
 F;CORE_ADDR;fetch_tls_load_module_address;struct objfile *objfile;objfile
 #
 v;CORE_ADDR;frame_args_skip;;;0;;;0
-M;CORE_ADDR;unwind_pc;struct frame_info *next_frame;next_frame
+m;CORE_ADDR;unwind_pc;struct frame_info *next_frame;next_frame;;default_unwind_pc;;0
 M;CORE_ADDR;unwind_sp;struct frame_info *next_frame;next_frame
 # DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
 # frame-base.  Enable frame-base before frame-unwind.
@@ -1657,6 +1657,7 @@ cat <<EOF
 #include "regcache.h"
 #include "objfiles.h"
 #include "auxv.h"
+#include "frame-unwind.h"
 
 /* Static function declarations */
 
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 65d33620c6a..48137ed02a0 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -92,12 +92,6 @@ static int is_h8300_normal_mode (struct gdbarch *gdbarch);
 		  && !is_h8300_normal_mode (gdbarch)) \
 		 ? h8300h_reg_size : h8300_reg_size)
 
-static CORE_ADDR
-h8300_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
-}
-
 static CORE_ADDR
 h8300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -1353,7 +1347,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_skip_prologue (gdbarch, h8300_skip_prologue);
 
   /* Frame unwinder.  */
-  set_gdbarch_unwind_pc (gdbarch, h8300_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp);
   set_gdbarch_dummy_id (gdbarch, h8300_dummy_id);
   frame_base_set_default (gdbarch, &h8300_frame_base);
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index 9f7f35d287c..74fefdab374 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -440,12 +440,6 @@ iq2000_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }   
 
-static CORE_ADDR
-iq2000_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
-}
-
 static struct frame_id
 iq2000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -841,7 +835,6 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_type (gdbarch, iq2000_register_type);
   set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
   set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, iq2000_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, iq2000_dummy_id);
   frame_base_set_default (gdbarch, &iq2000_frame_base);
   set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call);
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 942852140d7..26f2faee365 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -382,12 +382,6 @@ lm32_return_value (struct gdbarch *gdbarch, struct value *function,
   return RETURN_VALUE_REGISTER_CONVENTION;
 }
 
-static CORE_ADDR
-lm32_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, SIM_LM32_PC_REGNUM);
-}
-
 static CORE_ADDR
 lm32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -551,7 +545,6 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frame unwinding.  */
   set_gdbarch_frame_align (gdbarch, lm32_frame_align);
   frame_base_set_default (gdbarch, &lm32_frame_base);
-  set_gdbarch_unwind_pc (gdbarch, lm32_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, lm32_unwind_sp);
   set_gdbarch_dummy_id (gdbarch, lm32_dummy_id);
   frame_unwind_append_unwinder (gdbarch, &lm32_frame_unwind);
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index fd79f3f4cde..9bfff6b0675 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -798,14 +798,6 @@ m32r_return_value (struct gdbarch *gdbarch, struct value *function,
     }
 }
 
-
-
-static CORE_ADDR
-m32r_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, M32R_PC_REGNUM);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -933,9 +925,6 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, m32r_dummy_id);
 
-  /* Return the unwound PC value.  */
-  set_gdbarch_unwind_pc (gdbarch, m32r_unwind_pc);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 1490ee28668..52dc118e622 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -757,16 +757,6 @@ m68hc11_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return pc;
 }
 
-static CORE_ADDR
-m68hc11_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  ULONGEST pc;
-
-  pc = frame_unwind_register_unsigned (next_frame,
-				       gdbarch_pc_regnum (gdbarch));
-  return pc;
-}
-
 /* Put here the code to store, into fi->saved_regs, the addresses of
    the saved registers of frame described by FRAME_INFO.  This
    includes special registers such as pc and fp saved in special ways
@@ -1491,7 +1481,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
   /* Characters are unsigned.  */
   set_gdbarch_char_signed (gdbarch, 0);
 
-  set_gdbarch_unwind_pc (gdbarch, m68hc11_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, m68hc11_unwind_sp);
 
   /* Set register info.  */
@@ -1528,9 +1517,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, m68hc11_dummy_id);
 
-  /* Return the unwound PC value.  */
-  set_gdbarch_unwind_pc (gdbarch, m68hc11_unwind_pc);
-
   /* Minsymbol frobbing.  */
   set_gdbarch_elf_make_msymbol_special (gdbarch,
                                         m68hc11_elf_make_msymbol_special);
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index c8a5ecfbe07..0f205988680 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -2063,14 +2063,6 @@ static const struct frame_unwind mep_frame_unwind = {
 };
 
 
-/* Our general unwinding function can handle unwinding the PC.  */
-static CORE_ADDR
-mep_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MEP_PC_REGNUM);
-}
-
-
 /* Our general unwinding function can handle unwinding the SP.  */
 static CORE_ADDR
 mep_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
@@ -2463,7 +2455,6 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frames and frame unwinding.  */
   frame_unwind_append_unwinder (gdbarch, &mep_frame_unwind);
-  set_gdbarch_unwind_pc (gdbarch, mep_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, mep_unwind_sp);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_frame_args_skip (gdbarch, 0);
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index edc99a2faba..8b72c287ab4 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -1149,15 +1149,6 @@ static const struct frame_unwind mn10300_frame_unwind = {
   default_frame_sniffer
 };
 
-static CORE_ADDR
-mn10300_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST pc;
-
-  pc = frame_unwind_register_unsigned (this_frame, E_PC_REGNUM);
-  return pc;
-}
-
 static CORE_ADDR
 mn10300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -1173,7 +1164,6 @@ mn10300_frame_unwind_init (struct gdbarch *gdbarch)
   dwarf2_append_unwinders (gdbarch);
   frame_unwind_append_unwinder (gdbarch, &mn10300_frame_unwind);
   set_gdbarch_dummy_id (gdbarch, mn10300_dummy_id);
-  set_gdbarch_unwind_pc (gdbarch, mn10300_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp);
 }
 
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 078ff391e0b..515357c8ea3 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -556,14 +556,6 @@ moxie_frame_cache (struct frame_info *this_frame, void **this_cache)
   return cache;
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-moxie_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MOXIE_PC_REGNUM);
-}
-
 /* Given a GDB frame, determine the address of the calling function's
    frame.  This will be used to create a new GDB frame struct.  */
 
@@ -1114,8 +1106,6 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos.  */
   set_gdbarch_dummy_id (gdbarch, moxie_dummy_id);
 
-  set_gdbarch_unwind_pc (gdbarch, moxie_unwind_pc);
-
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index b6e062a380f..2e30a648de2 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -447,14 +447,6 @@ msp430_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
   return p.prologue_end;
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-msp430_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, MSP430_PC_REGNUM);
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -995,7 +987,6 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Frames, prologues, etc.  */
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_prologue (gdbarch, msp430_skip_prologue);
-  set_gdbarch_unwind_pc (gdbarch, msp430_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, msp430_unwind_sp);
   set_gdbarch_frame_align (gdbarch, msp430_frame_align);
   dwarf2_append_unwinders (gdbarch);
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index b616cc9b2ce..59cdacdad82 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -1398,14 +1398,6 @@ nds32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
   return frame_id_build (sp, get_frame_pc (this_frame));
 }
 
-/* Implement the "unwind_pc" gdbarch method.  */
-
-static CORE_ADDR
-nds32_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, NDS32_PC_REGNUM);
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 
 static CORE_ADDR
@@ -2139,7 +2131,6 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sp_regnum (gdbarch, NDS32_SP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, NDS32_PC_REGNUM);
   set_gdbarch_unwind_sp (gdbarch, nds32_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, nds32_unwind_pc);
   set_gdbarch_stack_frame_destroyed_p (gdbarch, nds32_stack_frame_destroyed_p);
   set_gdbarch_dwarf2_reg_to_regnum (gdbarch, nds32_dwarf2_reg_to_regnum);
 
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 154567136eb..c732f2cbe27 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -2322,14 +2322,6 @@ riscv_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
   return align_down (addr, 16);
 }
 
-/* Implement the unwind_pc gdbarch method.  */
-
-static CORE_ADDR
-riscv_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, RISCV_PC_REGNUM);
-}
-
 /* Implement the unwind_sp gdbarch method.  */
 
 static CORE_ADDR
@@ -2544,7 +2536,6 @@ riscv_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_frame_align (gdbarch, riscv_frame_align);
 
   /* Functions to access frame data.  */
-  set_gdbarch_unwind_pc (gdbarch, riscv_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, riscv_unwind_sp);
 
   /* Functions handling dummy frames.  */
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index a0f290f61b8..cf884b7f34f 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3098,13 +3098,6 @@ find_variant_by_arch (enum bfd_architecture arch, unsigned long mach)
 }
 
 \f
-static CORE_ADDR
-rs6000_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_pc_regnum (gdbarch));
-}
-
 static struct frame_id
 rs6000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -6425,7 +6418,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     case GDB_OSABI_LINUX:
     case GDB_OSABI_NETBSD:
     case GDB_OSABI_UNKNOWN:
-      set_gdbarch_unwind_pc (gdbarch, rs6000_unwind_pc);
       frame_unwind_append_unwinder (gdbarch, &rs6000_epilogue_frame_unwind);
       frame_unwind_append_unwinder (gdbarch, &rs6000_frame_unwind);
       set_gdbarch_dummy_id (gdbarch, rs6000_dummy_id);
@@ -6434,7 +6426,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
     default:
       set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
-      set_gdbarch_unwind_pc (gdbarch, rs6000_unwind_pc);
       frame_unwind_append_unwinder (gdbarch, &rs6000_epilogue_frame_unwind);
       frame_unwind_append_unwinder (gdbarch, &rs6000_frame_unwind);
       set_gdbarch_dummy_id (gdbarch, rs6000_dummy_id);
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 94d57913a31..3d982795db4 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -751,16 +751,6 @@ static const struct frame_unwind rx_exception_unwind = {
   rx_exception_sniffer
 };
 
-/* Implement the "unwind_pc" gdbarch method.  */
-static CORE_ADDR
-rx_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  ULONGEST pc;
-
-  pc = frame_unwind_register_unsigned (this_frame, RX_PC_REGNUM);
-  return pc;
-}
-
 /* Implement the "unwind_sp" gdbarch method.  */
 static CORE_ADDR
 rx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
@@ -1110,7 +1100,6 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sw_breakpoint_from_kind (gdbarch, rx_breakpoint::bp_from_kind);
   set_gdbarch_skip_prologue (gdbarch, rx_skip_prologue);
 
-  set_gdbarch_unwind_pc (gdbarch, rx_unwind_pc);
   set_gdbarch_unwind_sp (gdbarch, rx_unwind_sp);
 
   /* Target builtin data types.  */
diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c
index 16bf00ea024..e47d7ce18fa 100644
--- a/gdb/score-tdep.c
+++ b/gdb/score-tdep.c
@@ -70,12 +70,6 @@ score_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM);
 }
 
-static CORE_ADDR
-score_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, SCORE_PC_REGNUM);
-}
-
 static const char *
 score7_register_name (struct gdbarch *gdbarch, int regnum)
 {
@@ -1480,7 +1474,6 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frame_align (gdbarch, score_frame_align);
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_unwind_sp (gdbarch, score_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, score_unwind_pc);
 
   switch (target_mach)
     {
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index d1a143414df..6dd7e575e64 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1982,13 +1982,6 @@ sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 }
 
-static CORE_ADDR
-sh_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_pc_regnum (gdbarch));
-}
-
 static struct frame_id
 sh_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -2306,7 +2299,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, sh_frame_align);
   set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, sh_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, sh_dummy_id);
   frame_base_set_default (gdbarch, &sh_frame_base);
 
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 65c1f006204..985fe13a1b5 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1111,13 +1111,6 @@ sparc_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
   return pc;
 }
 
-static CORE_ADDR
-sparc_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-  return frame_unwind_register_unsigned (this_frame, tdep->pc_regnum);
-}
-
 /* Return PC of first real instruction of the function starting at
    START_PC.  */
 
@@ -1877,8 +1870,6 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_dummy_id (gdbarch, sparc_dummy_id);
 
-  set_gdbarch_unwind_pc (gdbarch, sparc_unwind_pc);
-
   frame_base_set_default (gdbarch, &sparc32_frame_base);
 
   /* Hook in the DWARF CFI frame unwinder.  */
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 9ed696630eb..5885f60dbca 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -936,12 +936,6 @@ tilegx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, TILEGX_SP_REGNUM);
 }
 
-static CORE_ADDR
-tilegx_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, TILEGX_PC_REGNUM);
-}
-
 static struct frame_id
 tilegx_unwind_dummy_id (struct gdbarch *gdbarch,
 			struct frame_info *this_frame)
@@ -1028,7 +1022,6 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Frame Info.  */
   set_gdbarch_unwind_sp (gdbarch, tilegx_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, tilegx_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, tilegx_unwind_dummy_id);
   set_gdbarch_frame_align (gdbarch, tilegx_frame_align);
   frame_base_set_default (gdbarch, &tilegx_frame_base);
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 2a3812d6c08..0f08c64f1d1 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1333,13 +1333,6 @@ v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 					 gdbarch_sp_regnum (gdbarch));
 } 
 
-static CORE_ADDR
-v850_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame,
-					 gdbarch_pc_regnum (gdbarch));
-}
-
 static struct frame_id
 v850_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -1465,7 +1458,6 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   set_gdbarch_frame_align (gdbarch, v850_frame_align);
   set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, v850_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, v850_dummy_id);
   frame_base_set_default (gdbarch, &v850_frame_base);
 
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index d07a4779076..28c86db76cf 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -435,12 +435,6 @@ vax_frame_num_args (struct frame_info *frame)
   args = get_frame_register_unsigned (frame, VAX_AP_REGNUM);
   return get_frame_memory_unsigned (frame, args, 1);
 }
-
-static CORE_ADDR
-vax_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, VAX_PC_REGNUM);
-}
 \f
 
 /* Initialize the current architecture based on INFO.  If possible, re-use an
@@ -501,8 +495,6 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_deprecated_function_start_offset (gdbarch, 2);
   set_gdbarch_believe_pcc_promotion (gdbarch, 1);
 
-  set_gdbarch_unwind_pc (gdbarch, vax_unwind_pc);
-
   frame_base_set_default (gdbarch, &vax_frame_base);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index b80d23e142d..45369cdf56a 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -757,12 +757,6 @@ xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
 }
 
-static CORE_ADDR
-xstormy16_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-{
-  return frame_unwind_register_unsigned (next_frame, E_PC_REGNUM);
-}
-
 static struct frame_id
 xstormy16_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 {
@@ -825,7 +819,6 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
    * Frame Info
    */
   set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
-  set_gdbarch_unwind_pc (gdbarch, xstormy16_unwind_pc);
   set_gdbarch_dummy_id (gdbarch, xstormy16_dummy_id);
   set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
   frame_base_set_default (gdbarch, &xstormy16_frame_base);
-- 
2.14.3

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-06-05 14:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-15 21:51 [PATCHv2 0/4] Supply additional default gdbarch methods Andrew Burgess
2018-03-07 22:04 ` [PATCH] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess
2018-03-08 22:32   ` Simon Marchi
2018-03-09 15:54     ` Yao Qi
2018-03-15 21:51   ` [PATCHv2 1/4] " Andrew Burgess
2018-03-15 21:51   ` [PATCHv2 4/4] gdb: Supply default gdbarch_unwind_sp and use where possible Andrew Burgess
2018-03-15 21:51   ` [PATCHv2 3/4] gdb: Supply a default for gdbarch_dummy_id Andrew Burgess
2018-03-15 21:51   ` [PATCHv2 2/4] gdb: Remove more targets unwind_pc methods Andrew Burgess
2018-04-10 10:13 ` PING: Re: [PATCHv2 0/4] Supply additional default gdbarch methods Andrew Burgess
2018-06-05 14:35   ` [PATCHv3 " Andrew Burgess
2018-06-05 14:35   ` [PATCHv3 4/4] gdb: Supply default gdbarch_unwind_sp and use where possible Andrew Burgess
2018-06-05 14:35   ` [PATCHv3 2/4] gdb: Remove more targets unwind_pc methods Andrew Burgess
2018-06-05 14:35   ` [PATCHv3 3/4] gdb: Supply a default for gdbarch_dummy_id Andrew Burgess
2018-06-05 14:35   ` [PATCHv3 1/4] gdb: Add a default_unwind_pc method for gdbarch Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).