From patchwork Wed Mar 27 21:34:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 32014 Received: (qmail 97165 invoked by alias); 27 Mar 2019 21:34:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 97079 invoked by uid 89); 27 Mar 2019 21:34:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=unavailable version=3.3.1 spammy=8996, Hook X-HELO: mail-wm1-f65.google.com Received: from mail-wm1-f65.google.com (HELO mail-wm1-f65.google.com) (209.85.128.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Mar 2019 21:34:37 +0000 Received: by mail-wm1-f65.google.com with SMTP id z24so1656197wmi.5 for ; Wed, 27 Mar 2019 14:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=IQUDhgjBz5xa/mDjmZzLN04wh/3fAHP7rwbavVYTSos=; b=bFHiRBptc9Bp0qkN/JA2laqtJcMl1N5goAGIRxDPwChetD7BIAJefY7jl/4UFdf/Dv RGmowZYzzQd9GQ9SWUJzEjEwSp7tltr2HhVR4WY9/dbGVcBvq0lqWFOdFFQNQXpQ+QVg 9Vb+5eLxwJi5g2GPct+1SkVEsZ6dVPDY6FIJEfOE3rKQXL1swxbGcxb8ngxsoYrePzKC ncfrG6MMTImr9PNMwI92K3UH3EcYYj5slnmg2T0YidIYv/7xRjnrZvKfQgSOYOuA575m nU5MABiYrxJhhNdcxD2dk7hT5DWBYDrqS6brVEbVU4oO50SLcFha1KbAbZNUjbqj5dIR /U8g== Return-Path: Received: from localhost (host81-151-161-58.range81-151.btcentralplus.com. [81.151.161.58]) by smtp.gmail.com with ESMTPSA id y66sm746617wmd.37.2019.03.27.14.34.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Mar 2019 14:34:34 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: kevinb@redhat.com, macro@linux-mips.org, brobecker@adacore.com, green@moxielogic.com, qiyao@sourceware.org, shorne@gmail.com, Andrew Burgess Subject: [PATCH 04/25] gdb/m32r: Use default gdbarch methods where possible Date: Wed, 27 Mar 2019 21:34:00 +0000 Message-Id: <9b41b925d676c7f0bf37602091f6362e235e4f79.1553721872.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes 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: * m32r-tdep.c (m32r_unwind_sp): Delete. (m32r_unwind_pc): Delete. (m32r_dummy_id): Delete. (m32r_gdbarch_init): Don't register deleted functions with gdbarch. --- gdb/ChangeLog | 8 ++++++++ gdb/m32r-tdep.c | 37 ------------------------------------- 2 files changed, 8 insertions(+), 37 deletions(-) diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 18acdb6990c..a10558d59be 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -648,13 +648,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, @@ -798,14 +791,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. */ @@ -872,18 +857,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 * @@ -904,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); @@ -928,14 +899,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); - - /* 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);