* [PATCH] S390: Fix crash when remote tdesc doesn't define vec128
@ 2018-10-18 17:54 Andreas Arnez
2018-10-19 11:32 ` Kevin Buettner
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Arnez @ 2018-10-18 17:54 UTC (permalink / raw)
To: gdb-patches; +Cc: Ulrich Weigand
I've encountered a GDB crash when trying to read registers from a remote
stub that provided a target.xml with vector registers, but without the
'vec128' data type. The crash is caused by NULL register type entries for
the "concatenated" pseudo-registers v0-v15. These NULL entries are
introduced by the logic in s390_pseudo_register_type(), where the tdesc
type 'vec128' is returned unconditionally -- even if it doesn't exist (is
NULL).
The fixed logic for determining a "concatenated" vector register's type
now returns the type of the raw register v16 instead. This also makes
sure that all vector register have the same type.
---
gdb/s390-tdep.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 81fa0329ea..23689aa71a 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -1275,8 +1275,9 @@ s390_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum_is_gpr_full (tdep, regnum))
return builtin_type (gdbarch)->builtin_uint64;
+ /* For the "concatenated" vector registers use the same type as v16. */
if (regnum_is_vxr_full (tdep, regnum))
- return tdesc_find_type (gdbarch, "vec128");
+ return tdesc_register_type (gdbarch, S390_V16_REGNUM);
internal_error (__FILE__, __LINE__, _("invalid regnum"));
}
--
2.17.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] S390: Fix crash when remote tdesc doesn't define vec128
2018-10-18 17:54 [PATCH] S390: Fix crash when remote tdesc doesn't define vec128 Andreas Arnez
@ 2018-10-19 11:32 ` Kevin Buettner
2018-10-19 12:10 ` Andreas Arnez
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2018-10-19 11:32 UTC (permalink / raw)
To: Andreas Arnez; +Cc: gdb-patches
Hi Andreas,
It needs a ChangeLog entry, but aside from that it looks okay to me.
Kevin
On Thu, 18 Oct 2018 19:54:22 +0200
Andreas Arnez <arnez@linux.ibm.com> wrote:
> I've encountered a GDB crash when trying to read registers from a remote
> stub that provided a target.xml with vector registers, but without the
> 'vec128' data type. The crash is caused by NULL register type entries for
> the "concatenated" pseudo-registers v0-v15. These NULL entries are
> introduced by the logic in s390_pseudo_register_type(), where the tdesc
> type 'vec128' is returned unconditionally -- even if it doesn't exist (is
> NULL).
>
> The fixed logic for determining a "concatenated" vector register's type
> now returns the type of the raw register v16 instead. This also makes
> sure that all vector register have the same type.
> ---
> gdb/s390-tdep.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
> index 81fa0329ea..23689aa71a 100644
> --- a/gdb/s390-tdep.c
> +++ b/gdb/s390-tdep.c
> @@ -1275,8 +1275,9 @@ s390_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
> if (regnum_is_gpr_full (tdep, regnum))
> return builtin_type (gdbarch)->builtin_uint64;
>
> + /* For the "concatenated" vector registers use the same type as v16. */
> if (regnum_is_vxr_full (tdep, regnum))
> - return tdesc_find_type (gdbarch, "vec128");
> + return tdesc_register_type (gdbarch, S390_V16_REGNUM);
>
> internal_error (__FILE__, __LINE__, _("invalid regnum"));
> }
> --
> 2.17.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] S390: Fix crash when remote tdesc doesn't define vec128
2018-10-19 11:32 ` Kevin Buettner
@ 2018-10-19 12:10 ` Andreas Arnez
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Arnez @ 2018-10-19 12:10 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
On Fri, Oct 19 2018, Kevin Buettner wrote:
> Hi Andreas,
>
> It needs a ChangeLog entry, but aside from that it looks okay to me.
Thanks. Here's the missing ChangeLog entry:
gdb/ChangeLog:
* s390-tdep.c (s390_pseudo_register_type): For v0-v15 don't yield
the possibly non-existent tdesc type 'vec128', but the type of raw
register v16 instead.
Pushed with that as commit #0667c50682.
--
Andreas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-19 12:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 17:54 [PATCH] S390: Fix crash when remote tdesc doesn't define vec128 Andreas Arnez
2018-10-19 11:32 ` Kevin Buettner
2018-10-19 12:10 ` Andreas Arnez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox