public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-6454] gcc: Fix gdbhooks.py VecPrinter for vec<> as well as vec<>* [PR109006]
Date: Fri,  3 Mar 2023 18:15:10 +0000 (GMT)	[thread overview]
Message-ID: <20230303181510.C21C73851ABE@sourceware.org> (raw)

https://gcc.gnu.org/g:59a576f274b9093fd4b25eb6be556b40c2424478

commit r13-6454-g59a576f274b9093fd4b25eb6be556b40c2424478
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Mar 3 16:41:29 2023 +0000

    gcc: Fix gdbhooks.py VecPrinter for vec<> as well as vec<>* [PR109006]
    
    gcc/ChangeLog:
    
            PR middle-end/109006
            * gdbhooks.py (VecPrinter): Handle vec<T> as well as vec<T>*.

Diff:
---
 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])
 
 ######################################################################

                 reply	other threads:[~2023-03-03 18:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230303181510.C21C73851ABE@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).