Commit bbba0f58 authored by hjk's avatar hjk

debugger: cache results of finding out the current Qt namespace

parent 39b16d86
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment