From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id AE9CB3857829 for ; Mon, 9 Aug 2021 22:29:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AE9CB3857829 Received: from ubuntu.lan (unknown [IPv6:2a02:390:9086::635]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 7685281882; Mon, 9 Aug 2021 22:29:20 +0000 (UTC) Date: Mon, 9 Aug 2021 22:29:15 +0000 From: Lancelot SIX To: Andrew Burgess Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb: riscv_scan_prologue: handle LD instruction Message-ID: <20210809222915.pxg5jeor4izzusne@ubuntu.lan> References: <20210804214935.704303-1-lsix@lancelotsix.com> <20210809090822.GD462163@embecosm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210809090822.GD462163@embecosm.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Mon, 09 Aug 2021 22:29:20 +0000 (UTC) X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2021 22:29:32 -0000 > > Would you be willing to add support for LW? I think the test cold be > adapted to cover both cases pretty easily, more below... Yes, I’ll try to do that shortly. > > > + addi sp,sp,-32 > > + lla t3,__canary # Load the fake canary address. > > + ld t4,0(t3) # Load the canary. > > As we don't actually check the canary anywhere (unless I'm missing > something), then you could just add an extra: You are right. In this test I only reproduce the installation of the canary. I did not install an epilogue that checks for its value since has no use in the context of this test. > > lw t4,0(t3) > > here before the ld, and then both cases will be covered. Adding the > support for this in GDB should be easy enough (based on SW/SD). > > What do you think? As you point out, the test can easily modified to incorporate a LW instruction to cover both cases. If I use other registers than T3/T4, I can also test for C.LD / C.LW (the corresponding instructions from the compressed instruction set). I did test my implementation against C.LD but did not include it in the testcase to keep it simple. If I add a LW I can as well test the 4 instructions (to be more precise, I test that GDB can scan the prologue past those instructions, I never test what GDB thinks those instructions do). Best, Lancelot. > > Thanks, > Andrew