[13/25] gdb/or1k: Use default gdbarch methods where possible

Message ID 381d1981b991b2d2de32cd5178f1b2202bc49f5a.1553721876.git.andrew.burgess@embecosm.com
State New, archived
Headers

Commit Message

Andrew Burgess March 27, 2019, 9:34 p.m. UTC
  Make use of the default gdbarch method gdbarch_dummy_id 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.

This commit leaves or1k_unwind_sp and or1k_unwind_pc in place.  These
functions do match the default methods except that they add additional
debugging code.  In order to preserve the debug I have left these
functions unchanged.

gdb/ChangeLog:

	* or1k-tdep.c (or1k_dummy_id): Delete.
	(or1k_gdbarch_init): Don't register deleted function with gdbarch.
---
 gdb/ChangeLog   | 5 +++++
 gdb/or1k-tdep.c | 9 ---------
 2 files changed, 5 insertions(+), 9 deletions(-)
  

Comments

Stafford Horne March 27, 2019, 9:50 p.m. UTC | #1
On Wed, Mar 27, 2019 at 09:34:09PM +0000, Andrew Burgess wrote:
> Make use of the default gdbarch method gdbarch_dummy_id 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.
> 
> This commit leaves or1k_unwind_sp and or1k_unwind_pc in place.  These
> functions do match the default methods except that they add additional
> debugging code.  In order to preserve the debug I have left these
> functions unchanged.

This looks good to me.

-Stafford
  

Patch

diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index 13e130c6fd3..8f6f6e19609 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -789,14 +789,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));
-}
 
 
 /* Support functions for frame handling.  */
@@ -1184,7 +1176,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.  */