[06/25] gdb/mep: Use default gdbarch methods where possible

Message ID b90fb6b3bc4a38294a12b51933e5043986461c98.1553721873.git.andrew.burgess@embecosm.com
State New
Headers show
Series
  • Make use of default gdbarch methods for some more targets
Related show

Commit Message

Andrew Burgess March 27, 2019, 9:34 p.m.
Make use of the default gdbarch methods for gdbarch_dummy_id,
gdbarch_unwind_pc, and gdbarch_unwind_sp where possible.

I have not tested this change but, by inspecting the code, I believe
the default methods are equivalent to the code being deleted.

gdb/ChangeLog:

	* mep-tdep.c (mep_unwind_pc): Delete.
	(mep_unwind_sp): Delete.
	(mep_dummy_id): Delete.
	(mep_gdbarch_init): Don't register deleted functions with
	gdbarch.
---
 gdb/ChangeLog  |  8 ++++++++
 gdb/mep-tdep.c | 29 -----------------------------
 2 files changed, 8 insertions(+), 29 deletions(-)

-- 
2.14.5

Comments

Kevin Buettner March 27, 2019, 9:54 p.m. | #1
On Wed, 27 Mar 2019 21:34:02 +0000
Andrew Burgess <andrew.burgess@embecosm.com> wrote:

> Make use of the default gdbarch methods for gdbarch_dummy_id,

> gdbarch_unwind_pc, and gdbarch_unwind_sp where possible.

> 

> I have not tested this change but, by inspecting the code, I believe

> the default methods are equivalent to the code being deleted.

> 

> gdb/ChangeLog:

> 

> 	* mep-tdep.c (mep_unwind_pc): Delete.

> 	(mep_unwind_sp): Delete.

> 	(mep_dummy_id): Delete.

> 	(mep_gdbarch_init): Don't register deleted functions with

> 	gdbarch.


Okay.

Kevin

Patch

diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index 3288291a461..5b1d64c991c 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -2061,23 +2061,6 @@  static const struct frame_unwind mep_frame_unwind = {
   default_frame_sniffer
 };
 
-
-/* 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)
-{
-  return frame_unwind_register_unsigned (next_frame, MEP_SP_REGNUM);
-}
-
-
 
 /* Return values.  */
 
@@ -2334,15 +2317,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));
-}
-
-
 
 /* Initialization.  */
 
@@ -2461,8 +2435,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);
 
@@ -2472,7 +2444,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;
 }