forked from qt-creator/qt-creator
Debugger: Avoid infinite loop in dumper
Change-Id: I71e89574a9eecc079b4d8e91da352fd2b7b0d9ab Done-by: Xander (@bugreports.qt.io) Task-number: QTCREATORBUG-22637 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1230,12 +1230,28 @@ class DumperBase:
|
|||||||
ns = self.qtNamespace()
|
ns = self.qtNamespace()
|
||||||
if len(ns) > 0 and typeName.startswith(ns):
|
if len(ns) > 0 and typeName.startswith(ns):
|
||||||
typeName = typeName[len(ns):]
|
typeName = typeName[len(ns):]
|
||||||
pos = typeName.find('<')
|
# warn( 'stripping %s' % typeName )
|
||||||
# FIXME: make it recognize foo<A>::bar<B>::iterator?
|
lvl = 0
|
||||||
while pos != -1:
|
pos = None
|
||||||
pos1 = typeName.rfind('>', pos)
|
stripChunks = []
|
||||||
typeName = typeName[0:pos] + typeName[pos1+1:]
|
sz = len(typeName)
|
||||||
pos = typeName.find('<')
|
for index in range(0, sz):
|
||||||
|
s = typeName[index]
|
||||||
|
if s == '<':
|
||||||
|
lvl += 1
|
||||||
|
if lvl == 1:
|
||||||
|
pos = index
|
||||||
|
continue
|
||||||
|
elif s == '>':
|
||||||
|
lvl -= 1
|
||||||
|
if lvl < 0 :
|
||||||
|
error("Unbalanced '<' in type, @index %d" % index)
|
||||||
|
if lvl == 0:
|
||||||
|
stripChunks.append((pos, index+1))
|
||||||
|
if lvl != 0:
|
||||||
|
error("unbalanced at end of type name")
|
||||||
|
for (f, l) in reversed(stripChunks):
|
||||||
|
typeName = typeName[:f] + typeName[l:]
|
||||||
return typeName
|
return typeName
|
||||||
|
|
||||||
def tryPutPrettyItem(self, typeName, value):
|
def tryPutPrettyItem(self, typeName, value):
|
||||||
|
Reference in New Issue
Block a user