Bug 17457 - aarch64/gdbserver: wrong floating point registers display
Summary: aarch64/gdbserver: wrong floating point registers display
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: server (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 7.9
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 17296 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-06 09:02 UTC by Catalin Udma
Modified: 2015-10-13 20:51 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Catalin Udma 2014-10-06 09:02:51 UTC
When using aarch64 gdb with gdbserver, floating point registers are
not correctly displayed, as below:
  (gdb) info registers fpsr fpcr
  fpsr           <unavailable>
  fpcr           <unavailable>

Also, the offset for floating point v0-v31 registers in gdbserver
is wrong because of the CPSR register size mismatch between gdb and gdbserver.
Comment 1 Pedro Alves 2014-10-06 14:12:27 UTC
This is fixed in both master and 7.8.1, by:

commit bdc144174bcb11e808b4e73089b850cf9620a7ee
...
    Aarch64: Make CPSR a 32-bit register again in the target description
Comment 2 Catalin Udma 2014-10-06 14:21:38 UTC
Hi,

Actually in the bug I described two problems:
- one is wrong v0-v31 offset -> this is fixed in bdc1441
- the second is that fpsr and fpcr registers are missing: this is fixed in bdc1441 + the patch I sent (aarch64/gdbserver: fix floating point registers display)

Regards,
Catalin

> -----Original Message-----
> From: gdb-prs-owner@sourceware.org [mailto:gdb-prs-owner@sourceware.org]
> On Behalf Of palves at redhat dot com
> Sent: Monday, October 06, 2014 5:12 PM
> To: gdb-prs@sourceware.org
> Subject: [Bug server/17457] aarch64/gdbserver: wrong floating point
> registers display
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=17457
> 
> Pedro Alves <palves at redhat dot com> changed:
> 
>            What    |Removed                     |Added
> -------------------------------------------------------------------------
> ---
>              Status|NEW                         |RESOLVED
>                  CC|                            |palves at redhat dot com
>          Resolution|---                         |FIXED
>    Target Milestone|---                         |7.9
> 
> --- Comment #1 from Pedro Alves <palves at redhat dot com> ---
> This is fixed in both master and 7.8.1, by:
> 
> commit bdc144174bcb11e808b4e73089b850cf9620a7ee
> ...
>     Aarch64: Make CPSR a 32-bit register again in the target description
> 
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 3 Pedro Alves 2014-10-06 14:30:03 UTC
Ah.  Is that patch in already?

This looks like something it'd be nice to have a testcase for.  Like, the program would setup the floating point registers in some way (like v0=1, v1=2, etc.) and then printing them from GDB should result in the expected values.  And then for fpsr/fpcr we should be able to test that at least a number comes out...
Comment 4 Catalin Udma 2014-10-06 14:48:50 UTC
This is the patch:
https://sourceware.org/ml/gdb-patches/2014-08/msg00496.html 

And this is the latest approval for the patch
https://sourceware.org/ml/gdb-patches/2014-09/msg00053.html
I assumed it will be pushed as it is.

Then should I submit a new patch with the testcase for v0..fpsr/fpcr?
Comment 5 Pedro Alves 2014-10-06 14:53:20 UTC
Yes, if you could send an updated patch that no longer references the aarch64.dat issue in the commit log, it'd be great.
Comment 6 Catalin Udma 2014-10-06 15:00:54 UTC
> if you could send an updated patch that no longer references the aarch64.dat issue in the commit log, it'd be great.
 Already done: the patch I mentioned is v2 - this removes any reference to aarch64.dat

I'll send the patch with the testcase soon.
Comment 7 Catalin Udma 2014-10-08 12:27:36 UTC
Sent for review the testcase:
https://sourceware.org/ml/gdb-patches/2014-10/msg00147.html
Comment 8 Sourceware Commits 2014-12-16 07:59:51 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  bf330350c212fb8880faab663f5b3565319d0a95 (commit)
      from  8fda9068191372d8282648986055493be17feff0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bf330350c212fb8880faab663f5b3565319d0a95

commit bf330350c212fb8880faab663f5b3565319d0a95
Author: Catalin Udma <catalin.udma@freescale.com>
Date:   Tue Dec 16 09:51:42 2014 +0200

    aarch64/gdbserver: fix floating point registers display
    
    When using aarch64 gdb with gdbserver, floating point registers are
    not correctly displayed, as below:
      (gdb) info registers fpsr fpcr
      fpsr           <unavailable>
      fpcr           <unavailable>
    
    To fix these problems, the missing fpsr and fpcr registers are added
    when floating point registers are read/write
    Add test for aarch64 floating point
    PR server/17457
    
    gdb/gdbserver/
    
        PR server/17457
        * linux-aarch64-low.c (AARCH64_FPSR_REGNO): New define.
        (AARCH64_FPCR_REGNO): Likewise.
        (AARCH64_NUM_REGS): Update to include fpsr/fpcr registers.
        (aarch64_fill_fpregset): Add missing fpsr/fpcr registers.
        (aarch64_store_fpregset): Likewise.
    
    gdb/testsuite/
    
        PR server/17457
        * gdb.arch/aarch64-fp.c: New file.
        * gdb.arch/aarch64-fp.exp: New file.
    
    Signed-off-by: Catalin Udma <catalin.udma@freescale.com>

-----------------------------------------------------------------------

Summary of changes:
 gdb/gdbserver/ChangeLog               |    9 ++++
 gdb/gdbserver/linux-aarch64-low.c     |    8 +++-
 gdb/testsuite/ChangeLog               |    6 ++
 gdb/testsuite/gdb.arch/aarch64-fp.c   |   38 +++++++++++++++
 gdb/testsuite/gdb.arch/aarch64-fp.exp |   85 +++++++++++++++++++++++++++++++++
 5 files changed, 145 insertions(+), 1 deletions(-)
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-fp.c
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-fp.exp
Comment 9 Yao Qi 2015-02-24 22:20:28 UTC
We can close it, can't we?
Comment 10 Catalin Udma 2015-02-25 09:41:41 UTC
We can close it. The above commit fixed the bug.
Comment 11 Yao Qi 2015-02-25 10:53:35 UTC
Close it.
Comment 12 Josh Gao 2015-10-13 20:51:44 UTC
*** Bug 17296 has been marked as a duplicate of this bug. ***