From patchwork Thu Oct 18 17:54:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 29790 Received: (qmail 4205 invoked by alias); 18 Oct 2018 17:54:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 4188 invoked by uid 89); 18 Oct 2018 17:54:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1360, H*Ad:U*uweigand X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 Oct 2018 17:54:33 +0000 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9IHs0L6096761 for ; Thu, 18 Oct 2018 13:54:31 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n6w91vw8n-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 13:54:31 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 18:54:28 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 18 Oct 2018 18:54:27 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9IHsQ0o917920 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 17:54:26 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A51E2AE051; Thu, 18 Oct 2018 17:54:26 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 85B33AE04D; Thu, 18 Oct 2018 17:54:26 +0000 (GMT) Received: from oc0404454431.ibm.com (unknown [9.152.222.49]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 18 Oct 2018 17:54:26 +0000 (GMT) From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Ulrich Weigand Subject: [PATCH] S390: Fix crash when remote tdesc doesn't define vec128 Date: Thu, 18 Oct 2018 19:54:22 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 x-cbid: 18101817-0016-0000-0000-00000215196F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101817-0017-0000-0000-0000326CBC91 Message-Id: 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")); }