From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Subject: [PATCH 1/2] S390: Take value from sub-register if applicable
Date: Fri, 15 Apr 2016 10:43:00 -0000 [thread overview]
Message-ID: <1460716939-27850-2-git-send-email-arnez@linux.vnet.ibm.com> (raw)
In-Reply-To: <1460716939-27850-1-git-send-email-arnez@linux.vnet.ibm.com>
On an s390 target with vector registers store.exp emits various FAILs
while trying to access a variable located in an unwound floating-point
register. In those cases the variable's DWARF location happens to be
DW_OP_reg24, which refers to FP register f8 or to vector register v8,
depending on whether the target has vector registers. But while f8 is
call-saved and thus can be unwound by GDB, v8 is not. Thus an uplevel
variable with such a location can neither be read nor written.
A similar situation occurs on an s390 (32-bit) target with high GPRs.
For that case we already have logic in s390_unwind_pseudo_register which
unwinds a full GPR by casting its lower half to the larger type.
However, that cast does not result in an lvalue, so an uplevel variable
based on such a location is readable, but not writable. Again, this
results in various FAILs from store.exp.
Both issues are addressed with a change to the s390 implementation of
the gdbarch method 'value_from_register': If the given type is small
enough to fit in the appropriate sub-register, then take the value from
that sub-register instead of from the full register.
gdb/ChangeLog:
* s390-linux-tdep.c (s390_value_from_register): Use sub-register
if appropriate.
---
gdb/s390-linux-tdep.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index fc57592..8b4efb1 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -518,12 +518,18 @@ s390_value_from_register (struct gdbarch *gdbarch, struct type *type,
int regnum, struct frame_id frame_id)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- struct value *value = default_value_from_register (gdbarch, type,
- regnum, frame_id);
- check_typedef (type);
+ unsigned int len = TYPE_LENGTH (check_typedef (type));
+ struct value *value;
- if ((regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM
- && TYPE_LENGTH (type) < 8)
+ /* If the value fits in a sub-register, use that instead. */
+ if (regnum_is_vxr_full (tdep, regnum) && len <= 8)
+ regnum = regnum - tdep->v0_full_regnum + S390_F0_REGNUM;
+ else if (regnum_is_gpr_full (tdep, regnum) && len <= 4)
+ regnum = regnum - tdep->gpr_full_regnum + S390_R0_REGNUM;
+
+ value = default_value_from_register (gdbarch, type, regnum, frame_id);
+
+ if ((regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM && len < 8)
|| regnum_is_vxr_full (tdep, regnum)
|| (regnum >= S390_V16_REGNUM && regnum <= S390_V31_REGNUM))
set_value_offset (value, 0);
--
2.5.0
next prev parent reply other threads:[~2016-04-15 10:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-15 10:42 [PATCH 0/2] Fixes for some s390 fails with store.exp Andreas Arnez
2016-04-15 10:43 ` Andreas Arnez [this message]
2016-04-15 18:08 ` [PATCH 1/2] S390: Take value from sub-register if applicable Ulrich Weigand
2016-04-15 10:43 ` [PATCH 2/2] Involve gdbarch in taking DWARF register pieces Andreas Arnez
2016-04-15 18:10 ` Ulrich Weigand
2016-04-15 18:37 ` Pedro Alves
2016-04-18 11:53 ` Andreas Arnez
2016-04-18 13:53 ` Pedro Alves
2016-04-18 15:02 ` Andreas Arnez
2016-04-18 15:55 ` Pedro Alves
2016-04-18 15:57 ` Doug Evans
2016-04-19 12:08 ` Andreas Arnez
2016-04-28 13:24 ` [PING][PATCH " Andreas Arnez
2016-04-28 14:47 ` Pedro Alves
2016-04-28 16:51 ` Andreas Arnez
2016-04-28 18:16 ` Andreas Arnez
2016-04-28 22:15 ` Pedro Alves
2016-04-28 22:15 ` Pedro Alves
2016-06-14 17:03 ` Jan Kratochvil
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=1460716939-27850-2-git-send-email-arnez@linux.vnet.ibm.com \
--to=arnez@linux.vnet.ibm.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
/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