Message ID | 20230303164439.1625702-1-jwakely@redhat.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp511342wrd; Fri, 3 Mar 2023 08:45:27 -0800 (PST) X-Google-Smtp-Source: AK7set/y1qxmAXJe2ntCxR+hbrEBl90wfF2WoX87UfF32xr7vma1M2BKJQv2dpvtf4UVOiO60v/Q X-Received: by 2002:a17:906:3893:b0:885:a62c:5a5c with SMTP id q19-20020a170906389300b00885a62c5a5cmr2493610ejd.46.1677861927202; Fri, 03 Mar 2023 08:45:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677861927; cv=none; d=google.com; s=arc-20160816; b=jOSJvuaJcsyJTaR836rC0g19VGqxzLOCuNzOP08q2L0UM0cSLVdiPAIo5AhMz2xAXh uDDspYvnhoXorOAooU0fumeEdAA5S0OQ8Rwjk/Q8WbGipz92338vn0FyUTsHtVrFQH6K WBZ2P2tpsxpA8HkXap0iSs0I5KP4Tju+WnxHqrkIAAvSoTDdxCKHy2Z/IgCoQdlP+721 tawoZTTFJNusuwi+LbXqmA7AxhT6+5bZ4T6EnP/vuvGIMcV771a8bRVmKJ3z4CbxgARB ItUeqHYNSf44oPxndZ2/eW/SB0aHlvYDg6fmamxgt1z3vA7vC27KnL3duQXa63gK8LQu jYfg== 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:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=BG/mA9agn28bWUpW0Xfb+GPopvrP9HP/e5gco+11UWE=; b=WGcJdh9gO0U50EFexfQvMGd3oeHT8Z0KSIiBMqE7ncPvJkXk6Q6QCGuoZRRKtUa6Fl UQ7FWPprOxV6ogW/fUPMLpETzNqFU+rL3QvyBOsyot+dM1HcbWViOzL3FLYy36jKIn69 sz28+3XdkPmaO9UpnlMamqPXquIo6BrCfFUxtTfvmbsFpNOpnJOIAn7gWGHAplSAMJ4V HMJbceC8yQIP5QMt87KyPhd1xJnkyO5J+Z9a8olNhZeU948OTokUTBSIs9WUKuM6BWla kKEbgkMbS1J4rWg8bdBMOtgVB4Uk+NNGWY3CTKPxZNNx5psx4y5FWLupf6mW9g84Q8V6 zISg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JojmxONV; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l3-20020a056402124300b004acddcb7501si3053657edw.116.2023.03.03.08.45.27 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 08:45:27 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JojmxONV; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 080AF3858C3A for <ouuuleilei@gmail.com>; Fri, 3 Mar 2023 16:45:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 080AF3858C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677861926; bh=BG/mA9agn28bWUpW0Xfb+GPopvrP9HP/e5gco+11UWE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=JojmxONVqi4g+esiYe2eq5z4RQMFdo3TCuTjRV3+RgA3QcFajEy5OwCOV/zU8l6iW uyBAfLYdpNloyt53uKgcN8Tcxl1QNaYHPF7k4PPk232+9HxXFLxUMCX9t/jV+/Qd/L pxvzS+BO3SdISdQhSqT5XFRwSCR9MgnYpXxnWGoU= 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 A3BEC3858D37 for <gcc-patches@gcc.gnu.org>; Fri, 3 Mar 2023 16:44:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A3BEC3858D37 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-588-u_BLZ32MPO-mnkEL_hZK2Q-1; Fri, 03 Mar 2023 11:44:40 -0500 X-MC-Unique: u_BLZ32MPO-mnkEL_hZK2Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 72B21380406A for <gcc-patches@gcc.gnu.org>; Fri, 3 Mar 2023 16:44:40 +0000 (UTC) Received: from localhost (unknown [10.33.36.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3376A2166B2B for <gcc-patches@gcc.gnu.org>; Fri, 3 Mar 2023 16:44:40 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] gcc: Adjust gdbhooks.py VecPrinter for vec layout changes Date: Fri, 3 Mar 2023 16:44:39 +0000 Message-Id: <20230303164439.1625702-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Jonathan Wakely via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Jonathan Wakely <jwakely@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759365748274068982?= X-GMAIL-MSGID: =?utf-8?q?1759365748274068982?= |
Series |
gcc: Adjust gdbhooks.py VecPrinter for vec layout changes
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jonathan Wakely
March 3, 2023, 4:44 p.m. UTC
OK for trunk? gcc/ChangeLog: * gdbhooks.py (VecPrinter): Adjust for new vec layout. --- gcc/gdbhooks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Comments
On Fri, Mar 03, 2023 at 04:44:39PM +0000, Jonathan Wakely via Gcc-patches wrote: > OK for trunk? > > gcc/ChangeLog: > Please add PR middle-end/109006 here > * gdbhooks.py (VecPrinter): Adjust for new vec layout. Ok with that, thanks. > gcc/gdbhooks.py | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py > index c9dea9bf828..78e6c97c30d 100644 > --- a/gcc/gdbhooks.py > +++ b/gcc/gdbhooks.py > @@ -461,7 +461,11 @@ class VecPrinter: > return > m_vecpfx = self.gdbval['m_vecpfx'] > m_num = m_vecpfx['m_num'] > - m_vecdata = self.gdbval['m_vecdata'] > + typ = self.gdbval.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()) > for i in range(m_num): > yield ('[%d]' % i, m_vecdata[i]) > > -- > 2.39.2 Jakub
On Fri, Mar 03, 2023 at 05:45:59PM +0100, Jakub Jelinek via Gcc-patches wrote: > On Fri, Mar 03, 2023 at 04:44:39PM +0000, Jonathan Wakely via Gcc-patches wrote: > > OK for trunk? > > > > gcc/ChangeLog: > > > > Please add > PR middle-end/109006 > here > > * gdbhooks.py (VecPrinter): Adjust for new vec layout. > > Ok with that, thanks. Though, trying it on another vector it doesn't work in that case. Testcase: int foo (void) { return 1; } gdb ./cc1 -quiet -O2 test.c b pass_reassoc::execute r p debug_bb_n (2) p $1->preds (gdb) p $1->preds $2 = 0x7fffea2d1f50 = {<error reading variable: Cannot access memory at address 0x100000058>} (gdb) p $1->succs $3 = 0x7fffea3010a0 = {<edge 0x0>} But if I try to print it the hard way: (gdb) p ((edge_def**)(&$1->preds.m_vecpfx+1))[0] $4 = <edge 0x7fffea2fcdb0 (ENTRY -> 2)> (gdb) p ((edge_def**)(&$1->succs.m_vecpfx+1))[0] $5 = <edge 0x7fffea2fce70 (2 -> EXIT)> > > diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py > > index c9dea9bf828..78e6c97c30d 100644 > > --- a/gcc/gdbhooks.py > > +++ b/gcc/gdbhooks.py > > @@ -461,7 +461,11 @@ class VecPrinter: > > return > > m_vecpfx = self.gdbval['m_vecpfx'] > > m_num = m_vecpfx['m_num'] > > - m_vecdata = self.gdbval['m_vecdata'] > > + typ = self.gdbval.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()) > > for i in range(m_num): > > yield ('[%d]' % i, m_vecdata[i]) Jakub
On Fri, 3 Mar 2023 at 17:01, Jakub Jelinek <jakub@redhat.com> wrote: > On Fri, Mar 03, 2023 at 05:45:59PM +0100, Jakub Jelinek via Gcc-patches > wrote: > > On Fri, Mar 03, 2023 at 04:44:39PM +0000, Jonathan Wakely via > Gcc-patches wrote: > > > OK for trunk? > > > > > > gcc/ChangeLog: > > > > > > > Please add > > PR middle-end/109006 > > here > > > * gdbhooks.py (VecPrinter): Adjust for new vec layout. > > > > Ok with that, thanks. > > Though, trying it on another vector it doesn't work in that case. > Testcase: > int > foo (void) > { > return 1; > } > gdb ./cc1 -quiet -O2 test.c > b pass_reassoc::execute > r > p debug_bb_n (2) > p $1->preds > (gdb) p $1->preds > $2 = 0x7fffea2d1f50 = {<error reading variable: Cannot access memory at > address 0x100000058>} > (gdb) p $1->succs > $3 = 0x7fffea3010a0 = {<edge 0x0>} > > But if I try to print it the hard way: > (gdb) p ((edge_def**)(&$1->preds.m_vecpfx+1))[0] > $4 = <edge 0x7fffea2fcdb0 (ENTRY -> 2)> > (gdb) p ((edge_def**)(&$1->succs.m_vecpfx+1))[0] > $5 = <edge 0x7fffea2fce70 (2 -> EXIT)> > Here's a fix for that testcase: --- a/gcc/gdbhooks.py +++ b/gcc/gdbhooks.py @@ -462,10 +462,13 @@ class VecPrinter: m_vecpfx = self.gdbval['m_vecpfx'] m_num = m_vecpfx['m_num'] typ = self.gdbval.type + val = self.gdbval if typ.code == gdb.TYPE_CODE_PTR: typ = typ.target() + else: + val = val.address typ = typ.template_argument(0) # the type T - m_vecdata = (self.gdbval.address + 1).cast(typ.pointer()) + m_vecdata = (val + 1).cast(typ.pointer()) for i in range(m_num): yield ('[%d]' % i, m_vecdata[i])
diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py index c9dea9bf828..78e6c97c30d 100644 --- a/gcc/gdbhooks.py +++ b/gcc/gdbhooks.py @@ -461,7 +461,11 @@ class VecPrinter: return m_vecpfx = self.gdbval['m_vecpfx'] m_num = m_vecpfx['m_num'] - m_vecdata = self.gdbval['m_vecdata'] + typ = self.gdbval.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()) for i in range(m_num): yield ('[%d]' % i, m_vecdata[i])