Message ID | 20180629085731.8439-1-sebastian.huber@embedded-brains.de |
---|---|
State | New, archived |
Headers |
Received: (qmail 17445 invoked by alias); 29 Jun 2018 08:58:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 106794 invoked by uid 89); 29 Jun 2018 08:57:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=fp, Hx-languages-length:1054 X-HELO: dedi548.your-server.de Received: from dedi548.your-server.de (HELO dedi548.your-server.de) (85.10.215.148) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 29 Jun 2018 08:57:35 +0000 Received: from [78.46.172.2] (helo=sslproxy05.your-server.de) by dedi548.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from <sebastian.huber@embedded-brains.de>) id 1fYpDh-0006oK-1Q; Fri, 29 Jun 2018 10:57:33 +0200 Received: from [82.135.62.35] (helo=mail.embedded-brains.de) by sslproxy05.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from <sebastian.huber@embedded-brains.de>) id 1fYpDg-000XgQ-Jb; Fri, 29 Jun 2018 10:57:32 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id E67632A167D; Fri, 29 Jun 2018 10:58:06 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id rvPMmhmpeCIU; Fri, 29 Jun 2018 10:58:06 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id A6E932A1680; Fri, 29 Jun 2018 10:58:06 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id LWaBZHTsSnMU; Fri, 29 Jun 2018 10:58:06 +0200 (CEST) Received: from linux-diu0.suse (unknown [192.168.96.149]) by mail.embedded-brains.de (Postfix) with ESMTP id 8AA292A167D; Fri, 29 Jun 2018 10:58:06 +0200 (CEST) From: Sebastian Huber <sebastian.huber@embedded-brains.de> To: gdb-patches@sourceware.org Cc: Jim Wilson <jimw@sifive.com> Subject: [PATCH] gdb: Prefer RISC-V register name "s0" over "fp" Date: Fri, 29 Jun 2018 10:57:31 +0200 Message-Id: <20180629085731.8439-1-sebastian.huber@embedded-brains.de> X-IsSubscribed: yes |
Commit Message
Sebastian Huber
June 29, 2018, 8:57 a.m. UTC
The "fp" register name is an alias for "s0" which is an alias for "x8". The "fp" name is not understood by the Binutils and thus not used by GCC. GCC does not emit a frame pointer with common optimization options such as -Og or -O2. It is still possible to use the "fp" register name, e.g. (gdb) p/x $fp $1 = 0x800367c8 works. However, in the register dump you see now: (gdb) info registers ... t2 0xffffffffffffffff 18446744073709551615 s0 0x800367c8 0x800367c8 s1 0x80033280 2147693184 ... gdb/ * riscv-tdep.c (riscv_register_aliases): Swap "fp" and "s0" entries. --- gdb/riscv-tdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
* Sebastian Huber <sebastian.huber@embedded-brains.de> [2018-06-29 10:57:31 +0200]: > The "fp" register name is an alias for "s0" which is an alias for "x8". > The "fp" name is not understood by the Binutils and thus not used by > GCC. GCC does not emit a frame pointer with common optimization options > such as -Og or -O2. > > It is still possible to use the "fp" register name, e.g. > > (gdb) p/x $fp > $1 = 0x800367c8 > > works. > > However, in the register dump you see now: > > (gdb) info registers > ... > t2 0xffffffffffffffff 18446744073709551615 > s0 0x800367c8 0x800367c8 > s1 0x80033280 2147693184 > ... > > gdb/ > > * riscv-tdep.c (riscv_register_aliases): Swap "fp" and "s0" > entries. This is fine with me based on GCC no generating $fp relative code by default. However, I think we need to get binutils fixed too, $fp _is_ a valid register name. Thanks, Andrew > --- > gdb/riscv-tdep.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c > index 154567136e..4c68ef73fc 100644 > --- a/gdb/riscv-tdep.c > +++ b/gdb/riscv-tdep.c > @@ -128,8 +128,8 @@ static const struct register_alias riscv_register_aliases[] = > { "t0", 5 }, > { "t1", 6 }, > { "t2", 7 }, > - { "fp", 8 }, > { "s0", 8 }, > + { "fp", 8 }, > { "s1", 9 }, > { "a0", 10 }, > { "a1", 11 }, > -- > 2.13.7 >
On Fri, Jun 29, 2018 at 5:08 AM, Andrew Burgess <andrew.burgess@embecosm.com> wrote: > This is fine with me based on GCC no generating $fp relative code by > default. However, I think we need to get binutils fixed too, $fp _is_ > a valid register name. I can fix the assembler. Jim
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 154567136e..4c68ef73fc 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -128,8 +128,8 @@ static const struct register_alias riscv_register_aliases[] = { "t0", 5 }, { "t1", 6 }, { "t2", 7 }, - { "fp", 8 }, { "s0", 8 }, + { "fp", 8 }, { "s1", 9 }, { "a0", 10 }, { "a1", 11 },