From bbba0f58a951ebb025228801edb63801a7a25a9e Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 20 Dec 2010 13:54:57 +0100 Subject: [PATCH] debugger: cache results of finding out the current Qt namespace --- share/qtcreator/gdbmacros/dumper.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/share/qtcreator/gdbmacros/dumper.py b/share/qtcreator/gdbmacros/dumper.py index 22e76fe7d5..c1d8879754 100644 --- a/share/qtcreator/gdbmacros/dumper.py +++ b/share/qtcreator/gdbmacros/dumper.py @@ -788,8 +788,13 @@ def makeExpression(value): #warn(" EXP: %s" % exp) return exp +qqNs = None + def qtNamespace(): + if not qqNs is None: + return qqNs try: + global qqNs str = catchCliOutput("ptype QString::Null")[0] # The result looks like: # "type = const struct myns::QString::Null {" @@ -797,7 +802,8 @@ def qtNamespace(): # "}" pos1 = str.find("struct") + 7 pos2 = str.find("QString::Null") - return str[pos1:pos2] + qqNs = str[pos1:pos2] + return qqNs except: return "" @@ -977,7 +983,6 @@ qqDumpers = {} # This is a cache of the namespace of the currently used Qt version. # FIXME: This is not available on 'bbsetup' time, only at 'bb' time. -qqNs = "" # This is a cache of typenames->bool saying whether we are QObject # derived. @@ -1011,10 +1016,11 @@ def bbsetup(): pass qqFormats[name] = formats result = "dumpers=[" - qqNs = qtNamespace() + #qqNs = qtNamespace() # This is too early for key, value in qqFormats.items(): result += '{type="%s",formats="%s"},' % (key, value) - result += '],namespace="%s"' % qqNs + result += ']' + #result += ',namespace="%s"' % qqNs result += ',hasInferiorThreadList="%s"' % int(hasInferiorThreadList()) return result @@ -1120,8 +1126,8 @@ class Dumper: options = [] varList = [] watchers = "" - resultVarName = "" + resultVarName = "" for arg in args.split(' '): pos = arg.find(":") + 1 if arg.startswith("options:"): @@ -1151,12 +1157,12 @@ class Dumper: self.passExceptions = "pe" in options self.autoDerefPointers = "autoderef" in options self.partialUpdate = "partial" in options - #self.ns = qqNs self.ns = qtNamespace() - try: - self.alienSource = catchCliOutput("info source")[0][-3:-1]==".d" - except: - self.alienSource = False + self.alienSource = False + #try: + # self.alienSource = catchCliOutput("info source")[0][-3:-1]==".d" + #except: + # self.alienSource = False #warn("NAMESPACE: '%s'" % self.ns) #warn("VARIABLES: %s" % varList) -- 2.11.0