From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50628 invoked by alias); 7 Jul 2015 12:53:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 50615 invoked by uid 89); 7 Jul 2015 12:53:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 07 Jul 2015 12:53:12 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-14-KFQS5JZGTWSsnqgw93H0Kw-3 Received: from e105615-lin.cambridge.arm.com ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 7 Jul 2015 13:51:59 +0100 From: Pierre Langlois To: gdb-patches@sourceware.org Cc: Pierre Langlois Subject: [PATCH 1/8] [AArch64] Refactor aarch64_make_prologue_cache Date: Tue, 07 Jul 2015 12:53:00 -0000 Message-Id: <1436273518-5959-2-git-send-email-pierre.langlois@arm.com> In-Reply-To: <1436273518-5959-1-git-send-email-pierre.langlois@arm.com> References: <1436273518-5959-1-git-send-email-pierre.langlois@arm.com> X-MC-Unique: KFQS5JZGTWSsnqgw93H0Kw-3 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00162.txt.bz2 We would previously have to make sure the frame cache was not already created before calling aarch64_make_prologue_cache. This patch makes this function check it so that the caller does not need to do so. gdb/ChangeLog: * aarch64-tdep.c (aarch64_prologue_cache): New argument this_cache. Return early if this_cache is already set. Set this_cache. (aarch64_prologue_this_id): Update call to aarch64_prologue_cache. (aarch64_prologue_prev_register): Likewise. (aarch64_normal_frame_base): Likewise. --- gdb/aarch64-tdep.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 9650a7a..c4b7fe8 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -934,14 +934,18 @@ aarch64_scan_prologue (struct frame_info *this_frame, about the prologue of *THIS_FRAME. */ =20 static struct aarch64_prologue_cache * -aarch64_make_prologue_cache (struct frame_info *this_frame) +aarch64_make_prologue_cache (struct frame_info *this_frame, void **this_ca= che) { struct aarch64_prologue_cache *cache; CORE_ADDR unwound_fp; int reg; =20 + if (*this_cache) + return *this_cache; + cache =3D FRAME_OBSTACK_ZALLOC (struct aarch64_prologue_cache); cache->saved_regs =3D trad_frame_alloc_saved_regs (this_frame); + *this_cache =3D cache; =20 aarch64_scan_prologue (this_frame, cache); =20 @@ -970,14 +974,11 @@ static void aarch64_prologue_this_id (struct frame_info *this_frame, void **this_cache, struct frame_id *this_id) { - struct aarch64_prologue_cache *cache; + struct aarch64_prologue_cache *cache + =3D aarch64_make_prologue_cache (this_frame, this_cache); struct frame_id id; CORE_ADDR pc, func; =20 - if (*this_cache =3D=3D NULL) - *this_cache =3D aarch64_make_prologue_cache (this_frame); - cache =3D *this_cache; - /* This is meant to halt the backtrace at "_start". */ pc =3D get_frame_pc (this_frame); if (pc <=3D gdbarch_tdep (get_frame_arch (this_frame))->lowest_pc) @@ -999,11 +1000,8 @@ aarch64_prologue_prev_register (struct frame_info *th= is_frame, void **this_cache, int prev_regnum) { struct gdbarch *gdbarch =3D get_frame_arch (this_frame); - struct aarch64_prologue_cache *cache; - - if (*this_cache =3D=3D NULL) - *this_cache =3D aarch64_make_prologue_cache (this_frame); - cache =3D *this_cache; + struct aarch64_prologue_cache *cache + =3D aarch64_make_prologue_cache (this_frame, this_cache); =20 /* If we are asked to unwind the PC, then we need to return the LR instead. The prologue may save PC, but it will point into this @@ -1120,11 +1118,8 @@ struct frame_unwind aarch64_stub_unwind =3D static CORE_ADDR aarch64_normal_frame_base (struct frame_info *this_frame, void **this_cach= e) { - struct aarch64_prologue_cache *cache; - - if (*this_cache =3D=3D NULL) - *this_cache =3D aarch64_make_prologue_cache (this_frame); - cache =3D *this_cache; + struct aarch64_prologue_cache *cache + =3D aarch64_make_prologue_cache (this_frame, this_cache); =20 return cache->prev_sp - cache->framesize; } --=20 2.1.0