From: Jonathan Wakely Date: Fri, 3 Mar 2023 16:41:29 +0000 (+0000) Subject: gcc: Fix gdbhooks.py VecPrinter for vec<> as well as vec<>* [PR109006] X-Git-Tag: basepoints/gcc-14~753 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59a576f274b9093fd4b25eb6be556b40c2424478;p=thirdparty%2Fgcc.git gcc: Fix gdbhooks.py VecPrinter for vec<> as well as vec<>* [PR109006] gcc/ChangeLog: PR middle-end/109006 * gdbhooks.py (VecPrinter): Handle vec as well as vec*. --- diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py index 78e6c97c30d7..e29bd458909c 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]) ######################################################################