Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
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 08:58:00 -0000	[thread overview]
Message-ID: <20180629085731.8439-1-sebastian.huber@embedded-brains.de> (raw)

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(-)

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


             reply	other threads:[~2018-06-29  8:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  8:58 Sebastian Huber [this message]
2018-06-29 12:08 ` Andrew Burgess
2018-06-29 16:48   ` Jim Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180629085731.8439-1-sebastian.huber@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=gdb-patches@sourceware.org \
    --cc=jimw@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox