Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: Prefer RISC-V register name "s0" over "fp"
@ 2018-06-29  8:58 Sebastian Huber
  2018-06-29 12:08 ` Andrew Burgess
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Huber @ 2018-06-29  8:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jim Wilson

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb: Prefer RISC-V register name "s0" over "fp"
  2018-06-29  8:58 [PATCH] gdb: Prefer RISC-V register name "s0" over "fp" Sebastian Huber
@ 2018-06-29 12:08 ` Andrew Burgess
  2018-06-29 16:48   ` Jim Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2018-06-29 12:08 UTC (permalink / raw)
  To: Sebastian Huber; +Cc: gdb-patches, Jim Wilson

* 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
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb: Prefer RISC-V register name "s0" over "fp"
  2018-06-29 12:08 ` Andrew Burgess
@ 2018-06-29 16:48   ` Jim Wilson
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Wilson @ 2018-06-29 16:48 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: Sebastian Huber, gdb-patches

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-29 16:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-29  8:58 [PATCH] gdb: Prefer RISC-V register name "s0" over "fp" Sebastian Huber
2018-06-29 12:08 ` Andrew Burgess
2018-06-29 16:48   ` Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox