public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-6454] gcc: Fix gdbhooks.py VecPrinter for vec<> as well as vec<>* [PR109006]
@ 2023-03-03 18:15 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-03-03 18:15 UTC (permalink / raw)
  To: gcc-cvs

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-03 18:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03 18:15 [gcc r13-6454] gcc: Fix gdbhooks.py VecPrinter for vec<> as well as vec<>* [PR109006] Jonathan Wakely

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).