From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18190 invoked by alias); 17 Apr 2013 14:33:07 -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 18181 invoked by uid 89); 17 Apr 2013 14:33:07 -0000 X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,TW_EG autolearn=ham version=3.3.1 Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 17 Apr 2013 14:33:06 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 17 Apr 2013 15:33:03 +0100 Received: from [10.1.69.62] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Wed, 17 Apr 2013 15:33:02 +0100 Message-ID: <516EB29D.2030409@arm.com> Date: Wed, 17 Apr 2013 17:07:00 -0000 From: Yufeng Zhang User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Joel Brobecker CC: Marcus Shawcroft , "gdb-patches@sourceware.org" Subject: Re: unnecessary aarch64_write_pc ? References: <20130415125021.GB3525@adacore.com> In-Reply-To: <20130415125021.GB3525@adacore.com> X-MC-Unique: 113041715330300501 Content-Type: multipart/mixed; boundary="------------080601090908080007060204" X-Virus-Found: No X-SW-Source: 2013-04/txt/msg00532.txt.bz2 This is a multi-part message in MIME format. --------------080601090908080007060204 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable Content-length: 1299 Hello Joel, On 04/15/13 13:50, Joel Brobecker wrote: > I noticed the following code: > >> /* Implement the "write_pc" gdbarch method. */ >> >> static void >> aarch64_write_pc (struct regcache *regcache, CORE_ADDR pc) >> { >> regcache_cooked_write_unsigned (regcache, AARCH64_PC_REGNUM, pc); >> } > > But looking at the only use of the gdbarch_write_pc function, I see: > >> void >> regcache_write_pc (struct regcache *regcache, CORE_ADDR pc) >> { >> struct gdbarch *gdbarch =3D get_regcache_arch (regcache); >> >> if (gdbarch_write_pc_p (gdbarch)) >> gdbarch_write_pc (gdbarch, regcache, pc); >> else if (gdbarch_pc_regnum (gdbarch)>=3D 0) >> regcache_cooked_write_unsigned (regcache, >> gdbarch_pc_regnum (gdbarch), pc); >> else >> internal_error (__FILE__, __LINE__, >> _("regcache_write_pc: Unable to update PC")); >> >> /* Writing the PC (for instance, from "load") invalidates the >> current frame. */ >> reinit_frame_cache (); >> } > > And gdbarch_pc_regnum is AARCH64_PC_REGNUM. > > So it looks like we shouldn't need aarch64_write_pc? Thanks for the heads up; yes, aarch64_write_pc doesn't appear necessary.=20 I've prepared the attached patch to remove the function. Thanks, Yufeng= --------------080601090908080007060204 Content-Type: text/plain; name=patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="patch" Content-length: 983 diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index ebc78d6..2b03106 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -2499,14 +2499,6 @@ aarch64_pseudo_write (struct gdbarch *gdbarch, struc= t regcache *regcache, gdb_assert_not_reached ("regnum out of bound"); } =20 -/* Implement the "write_pc" gdbarch method. */ - -static void -aarch64_write_pc (struct regcache *regcache, CORE_ADDR pc) -{ - regcache_cooked_write_unsigned (regcache, AARCH64_PC_REGNUM, pc); -} - /* Callback function for user_reg_add. */ =20 static struct value * @@ -2618,8 +2610,6 @@ aarch64_gdbarch_init (struct gdbarch_info info, struc= t gdbarch_list *arches) set_gdbarch_push_dummy_call (gdbarch, aarch64_push_dummy_call); set_gdbarch_frame_align (gdbarch, aarch64_frame_align); =20 - set_gdbarch_write_pc (gdbarch, aarch64_write_pc); - /* Frame handling. */ set_gdbarch_dummy_id (gdbarch, aarch64_dummy_id); set_gdbarch_unwind_pc (gdbarch, aarch64_unwind_pc);= --------------080601090908080007060204--