From patchwork Fri Mar 3 18:07:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 64024 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp553023wrd; Fri, 3 Mar 2023 10:08:34 -0800 (PST) X-Google-Smtp-Source: AK7set8340JhRq0OkD33kuvOljceVhheYMsWdndswHT6/0SqndJx6IbmMEXyHrnzg+vPuUo8sfPV X-Received: by 2002:a17:907:8e88:b0:878:7cf3:a9e7 with SMTP id tx8-20020a1709078e8800b008787cf3a9e7mr2911742ejc.65.1677866914655; Fri, 03 Mar 2023 10:08:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677866914; cv=none; d=google.com; s=arc-20160816; b=hmx569PJPc5js8DwkfAYsmn2adBRVhW0iT+m4V+SPccRO0GO9hRAVUyzmf2UDwiLUr owjWlD1Q+wI5m+WRA5l0Rew9UlKPjvk/c6rgTigMXZUWtsVCKbsgSqfba+rYVGorauk2 2KqpPSuwXgtHzjavWnqiEWsxfp5b9IBOX7WspTAMk8p5uI2fN0zAg1hxQxYI9sAR7cn5 YF89cHonF6L2ozNwb4LRCBxuOcAtehmO/XJhwR4MdoQ4OrUflxoDBerPzQYxrPjrgpt6 ntXoUDKhr2Z6vRm/ap9iHyeGgsx8Ltcnylw8MKYRU3vDMz6I+WzO5YDaOM6DK/xvvkZv vEIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=hhiNL8pdop/9j5iaLuK8XyQ/bMY4lVjd0al8bBRA06E=; b=zUUB+JQNeLQ/ggDWKbGXCAugtWahCOf+45DSh3YEzMyu2qPiwYUjJvHfwUZ1kqfmbH HTQT8F7zHc0Gs8hzciO4Adycw6yGCZFzf1Omebn1iHoqoTiWh1vXm26IFLeiBbu7AZQW gOYk7IBTTGLk9NwyhoN/1CjTqsf5tq3RwQ+23wUd42yHSg/+b0M74KbCvmjFA5JuNMX+ neBzDFcKs+U0Cpw/NNcghCKtaUnemlLa5zmJ9/pyKEWCzpT5JzBpEvfhljQnxcVH7QaI No675v5BiXJYs6zcKr5gHAxdl03xXcA4mmGrHTohyogBxADvRtHpjqJs8/jPVyTN+nN7 uNVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=M6GhcicB; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q22-20020a1709064c9600b008cd04d9ea72si2525926eju.847.2023.03.03.10.08.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 10:08:34 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=M6GhcicB; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B4AF33858416 for ; Fri, 3 Mar 2023 18:08:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4AF33858416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677866913; bh=hhiNL8pdop/9j5iaLuK8XyQ/bMY4lVjd0al8bBRA06E=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=M6GhcicB+O9meSNd+cchAyX7zM5ty3Y2ip+KPz921LXiiRGeNw0SS9IB3GkWyvHvx XXKtQiV/JJMk1+CO4NJma9cKHBz8XegrAUdDM7vdPfTl2K/h6zsvpEuH2al/WiaVrh VxQrS+Mc3q1Symu0vELKJjPTKBlgwiPWHwSCLdSY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id AF08A3858D37 for ; Fri, 3 Mar 2023 18:07:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AF08A3858D37 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-500-gE94N5pmMsOf7s1hsH6a7w-1; Fri, 03 Mar 2023 13:07:49 -0500 X-MC-Unique: gE94N5pmMsOf7s1hsH6a7w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1383A29DD993 for ; Fri, 3 Mar 2023 18:07:49 +0000 (UTC) Received: from localhost (unknown [10.33.36.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF53940C6EC4 for ; Fri, 3 Mar 2023 18:07:48 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] gcc: Fix gdbhooks.py VecPrinter for vec<> as well as vec<>* [PR109006] Date: Fri, 3 Mar 2023 18:07:48 +0000 Message-Id: <20230303180748.1645712-1-jwakely@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759370977660820375?= X-GMAIL-MSGID: =?utf-8?q?1759370977660820375?= This fixes Jakub's second testcase. The printer needs to do slightly different things depending on whether the gdbval obejct is a vec or a pointer to a vec. OK for trunk? -- >8 -- gcc/ChangeLog: PR middle-end/109006 * gdbhooks.py (VecPrinter): Handle vec as well as vec*. --- gcc/gdbhooks.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py index 78e6c97c30d..e29bd458909 100644 --- a/gcc/gdbhooks.py +++ b/gcc/gdbhooks.py @@ -461,13 +461,16 @@ class VecPrinter: return m_vecpfx = self.gdbval['m_vecpfx'] m_num = m_vecpfx['m_num'] - typ = self.gdbval.type + val = self.gdbval + typ = val.type if typ.code == gdb.TYPE_CODE_PTR: typ = typ.target() - typ = typ.template_argument(0) # the type T - m_vecdata = (self.gdbval.address + 1).cast(typ.pointer()) + else: + val = val.address + typ_T = typ.template_argument(0) # the type T + vecdata = (val + 1).cast(typ_T.pointer()) for i in range(m_num): - yield ('[%d]' % i, m_vecdata[i]) + yield ('[%d]' % i, vecdata[i]) ######################################################################