]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc: Fix gdbhooks.py VecPrinter for vec<> as well as vec<>* [PR109006]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 3 Mar 2023 16:41:29 +0000 (16:41 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 3 Mar 2023 18:14:51 +0000 (18:14 +0000)
gcc/ChangeLog:

PR middle-end/109006
* gdbhooks.py (VecPrinter): Handle vec<T> as well as vec<T>*.

gcc/gdbhooks.py

index 78e6c97c30d7027aa7bd92ee79fbf082d88519a4..e29bd458909c3410fed32edd6f163b83e3da0961 100644 (file)
@@ -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])
 
 ######################################################################