This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] [AArch64] Mark single precision pseudo registers unavailable if invalid


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

commit 4bcddaceb01a5ece549b2d807166b5e050801f5a
Author: Pierre Langlois <pierre.langlois@arm.com>
Date:   Thu Jul 16 10:16:14 2015 +0100

    [AArch64] Mark single precision pseudo registers unavailable if invalid
    
    I noticed two failure in gdb.trace/mi-trace-frame-collected.exp:
    
    FAIL: gdb.trace/mi-trace-frame-collected.exp: live:
      -trace-frame-collected (register)
    FAIL: gdb.trace/mi-trace-frame-collected.exp: tfile:
      -trace-frame-collected (register)
    
    In these cases, we are not collecting registers so the MI command
    -trace-frame-collected should only give us the value of the PC.
    However, it also gives us all of the single precision pseudo registers,
    initialized with 0x0.
    
    We can reproduce this error by simply issuing the
    'maint print cooked-register' when no inferior is connected:
    
    ~~~
    ...
    (gdb) maint print cooked-register
     Name         Nr  Rel Offset    Size  Type            Cooked value
     x0            0    0      0       8 long            <unavailable>
     x1            1    1      8       8 long            <unavailable>
     ...
     d30         130   62   1540       8 *1              <unavailable>
     d31         131   63   1548       8 *1              <unavailable>
     s0          132   64   1556       4 *1              0x00000000
     s1          133   65   1560       4 *1              0x00000000
     s2          134   66   1564       4 *1              0x00000000
     ...
     s28         160   92   1668       4 *1              0x00000000
     s29         161   93   1672       4 *1              0x00000000
     s30         162   94   1676       4 *1              0x00000000
     s31         163   95   1680       4 *1              0x00000000
     h0          164   96   1684       2 *1              <unavailable>
     h1          165   97   1686       2 *1              <unavailable>
     h2          166   98   1688       2 *1              <unavailable>
     ...
    ~~~
    
    It turns out GDB does not check if S registers are valid before returning
    a value for them.  It should return <unavailable> in this case.
    
    gdb/ChangeLog:
    
    	* aarch64-tdep.c (aarch64_pseudo_read_value): Mark S register as
    	unavailable if invalid.

Diff:
---
 gdb/ChangeLog      | 5 +++++
 gdb/aarch64-tdep.c | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7410103..f4857e3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-16  Pierre Langlois  <pierre.langlois@arm.com>
+
+	* aarch64-tdep.c (aarch64_pseudo_read_value): Mark S register as
+	unavailable if invalid.
+
 2015-07-15  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	Revert the previous 6 commits:
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 2cecad0..cec4d3e 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -2482,7 +2482,11 @@ aarch64_pseudo_read_value (struct gdbarch *gdbarch,
 
       v_regnum = AARCH64_V0_REGNUM + regnum - AARCH64_S0_REGNUM;
       status = regcache_raw_read (regcache, v_regnum, reg_buf);
-      memcpy (buf, reg_buf, S_REGISTER_SIZE);
+      if (status != REG_VALID)
+	mark_value_bytes_unavailable (result_value, 0,
+				      TYPE_LENGTH (value_type (result_value)));
+      else
+	memcpy (buf, reg_buf, S_REGISTER_SIZE);
       return result_value;
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]