Commit 9c035bb6 authored by hjk's avatar hjk

Debugger: Handle namespaced Qt in LLDB dumper auto tests

Change-Id: Ib81b82d81dd821be7161eef6515ae1f08091d5e3
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent ae34bfd6
...@@ -432,14 +432,26 @@ class Dumper(DumperBase): ...@@ -432,14 +432,26 @@ class Dumper(DumperBase):
coreExpression = re.compile(r"(lib)?Qt5?Core") coreExpression = re.compile(r"(lib)?Qt5?Core")
for n in range(0, self.target.GetNumModules()): for n in range(0, self.target.GetNumModules()):
module = self.target.GetModuleAtIndex(n) module = self.target.GetModuleAtIndex(n)
if coreExpression.match(module.GetFileSpec().GetFilename()): fileName = module.GetFileSpec().GetFilename()
if coreExpression.match(fileName):
# Extract version. # Extract version.
reverseVersion = module.GetVersion() reverseVersion = module.GetVersion()
reverseVersion.reverse() if len(reverseVersion):
shift = 0 # Mac, Clang?
for v in reverseVersion: reverseVersion.reverse()
self.cachedQtVersion += v << shift shift = 0
shift += 8 for v in reverseVersion:
self.cachedQtVersion += v << shift
shift += 8
else:
# Linux, gcc?
if fileName.endswith(".5"):
self.cachedQtVersion = 0x50000
elif fileName.endswith(".4"):
self.cachedQtVersion = 0x40800
else:
warn("CANNOT GUESS QT VERSION")
# Look for some Qt symbol to extract namespace. # Look for some Qt symbol to extract namespace.
for symbol in module.symbols: for symbol in module.symbols:
...@@ -461,7 +473,7 @@ class Dumper(DumperBase): ...@@ -461,7 +473,7 @@ class Dumper(DumperBase):
return self.cachedQtNamespace return self.cachedQtNamespace
def qtVersion(self): def qtVersion(self):
self.extraceqtVersionAndNamespace() self.qtVersionAndNamespace()
return self.cachedQtVersion return self.cachedQtVersion
def intSize(self): def intSize(self):
...@@ -840,7 +852,7 @@ class Dumper(DumperBase): ...@@ -840,7 +852,7 @@ class Dumper(DumperBase):
def putItem(self, value, tryDynamic=True): def putItem(self, value, tryDynamic=True):
#value = value.GetDynamicValue(lldb.eDynamicCanRunTarget) #value = value.GetDynamicValue(lldb.eDynamicCanRunTarget)
typeName = value.GetTypeName() typeName = value.GetType().GetUnqualifiedType().GetName()
value.SetPreferDynamicValue(tryDynamic) value.SetPreferDynamicValue(tryDynamic)
typeClass = value.GetType().GetTypeClass() typeClass = value.GetType().GetTypeClass()
...@@ -1509,7 +1521,9 @@ def testit(): ...@@ -1509,7 +1521,9 @@ def testit():
None, None, 0, False, error) None, None, 0, False, error)
db.report = savedReport db.report = savedReport
ns = db.qtNamespace()
db.reportVariables() db.reportVariables()
db.report("@NS@%s@" % ns)
#db.report("DUMPER=%s" % qqDumpers) #db.report("DUMPER=%s" % qqDumpers)
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -1147,12 +1147,14 @@ void tst_Dumpers::dumper() ...@@ -1147,12 +1147,14 @@ void tst_Dumpers::dumper()
output = output.mid(pos); output = output.mid(pos);
contents = output; contents = output;
//int posNameSpaceStart = output.indexOf("@NS@"); int posNameSpaceStart = output.indexOf("@NS@");
//QVERIFY(posNameSpaceStart != -1); if (posNameSpaceStart == -1)
//posNameSpaceStart += sizeof("@NS@") - 1; qDebug() << "OUTPUT: " << output;
//int posNameSpaceEnd = output.indexOf("@", posNameSpaceStart); QVERIFY(posNameSpaceStart != -1);
//QVERIFY(posNameSpaceEnd != -1); posNameSpaceStart += sizeof("@NS@") - 1;
//context.nameSpace = output.mid(posNameSpaceStart, posNameSpaceEnd - posNameSpaceStart); int posNameSpaceEnd = output.indexOf("@", posNameSpaceStart);
QVERIFY(posNameSpaceEnd != -1);
context.nameSpace = output.mid(posNameSpaceStart, posNameSpaceEnd - posNameSpaceStart);
//qDebug() << "FOUND NS: " << context.nameSpace; //qDebug() << "FOUND NS: " << context.nameSpace;
if (context.nameSpace == "::") if (context.nameSpace == "::")
context.nameSpace.clear(); context.nameSpace.clear();
......
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