Debugger: prevent calling functions with gdb on windows

and adjust tests accordingly

Change-Id: I172e08cfccc248eea06a94208c9e8e312d69e334
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2020-10-15 14:47:34 +02:00
parent c9d2a8d69e
commit 3b611e07f7
3 changed files with 17 additions and 25 deletions

View File

@@ -1117,7 +1117,8 @@ class Dumper(DumperBase):
self.qtCustomEventPltFunc = self.findSymbol(sym)
sym = '_ZNK%s7QObject8propertyEPKc' % strns
self.qtPropertyFunc = self.findSymbol(sym)
if not self.isWindowsTarget(): # prevent calling the property function on windows
self.qtPropertyFunc = self.findSymbol(sym)
def assignValue(self, args):
typeName = self.hexdecode(args['type'])

View File

@@ -1982,18 +1982,9 @@ def qdump__QVariant(d, value):
if d.isExpanded():
innerType = None
with Children(d):
ev = d.parseAndEvaluate
p = None
if p is None:
# Without debug info.
symbol = d.mangleName(d.qtNamespace() + 'QMetaType::typeName') + 'i'
p = ev('((const char *(*)(int))%s)(%d)' % (symbol, variantType))
#if p is None:
# p = ev('((const char *(*)(int))%sQMetaType::typeName)(%d)' % (ns, variantType))
if p is None:
# LLDB on Linux
p = ev('((const char *(*)(int))QMetaType::typeName)(%d)' % variantType)
if p is None:
try:
p = d.call('const char *', value, 'typeName')
except:
d.putSpecialValue('notcallable')
return None
ptr = p.pointer()

View File

@@ -3992,22 +3992,22 @@ void tst_Dumpers::dumper_data()
+ Check("my.1.value", "<1 items>", "@QStringList")
+ Check("my.1.value.0", "[0]", "\"World\"", "@QString")
//+ CheckType("v2", "@QVariant (MyType)")
+ Check("v2.data.0.key", "1", "unsigned int") % NoCdbEngine
+ Check("v2.data.0.value", "<1 items>", "@QStringList") % NoCdbEngine
+ Check("v2.data.0.value.0", "[0]", "\"Hello\"", "@QString") % NoCdbEngine
+ Check("v2.data.1.key", "3", "unsigned int") % NoCdbEngine
+ Check("v2.data.1.value", "<1 items>", "@QStringList") % NoCdbEngine
+ Check("v2.data.1.value.0", "[0]", "\"World\"", "@QString") % NoCdbEngine
+ Check("v2.data.0.key", "1", "unsigned int") % NeedsInferiorCall
+ Check("v2.data.0.value", "<1 items>", "@QStringList") % NeedsInferiorCall
+ Check("v2.data.0.value.0", "[0]", "\"Hello\"", "@QString") % NeedsInferiorCall
+ Check("v2.data.1.key", "3", "unsigned int") % NeedsInferiorCall
+ Check("v2.data.1.value", "<1 items>", "@QStringList") % NeedsInferiorCall
+ Check("v2.data.1.value.0", "[0]", "\"World\"", "@QString") % NeedsInferiorCall
+ Check("list", "<3 items>", "@QList<int>")
+ Check("list.0", "[0]", "1", "int")
+ Check("list.1", "[1]", "2", "int")
+ Check("list.2", "[2]", "3", "int")
//+ Check("v3", "", "@QVariant (@QList<int>)")
+ Check("v3.data", "<3 items>", TypePattern(".*QList<int>")) % NoCdbEngine
+ Check("v3.data.0", "[0]", "1", "int") % NoCdbEngine
+ Check("v3.data.1", "[1]", "2", "int") % NoCdbEngine
+ Check("v3.data.2", "[2]", "3", "int") % NoCdbEngine;
+ Check("v3.data", "<3 items>", TypePattern(".*QList<int>")) % NeedsInferiorCall
+ Check("v3.data.0", "[0]", "1", "int") % NeedsInferiorCall
+ Check("v3.data.1", "[1]", "2", "int") % NeedsInferiorCall
+ Check("v3.data.2", "[2]", "3", "int") % NeedsInferiorCall;
QTest::newRow("QVariant2")
@@ -4221,8 +4221,8 @@ void tst_Dumpers::dumper_data()
//+ Check("ha1.protocol", "IPv4Protocol",
// "@QAbstractSocket::NetworkLayerProtocol") % LldbEngine
+ Check("ha1.scopeId", "\"\"", "@QString")
+ Check("var", "", "@QVariant (@QHostAddress)") % NoCdbEngine
+ Check("var.data", ValuePattern(".*127.0.0.1.*"), "@QHostAddress") % NoCdbEngine;
+ Check("var", "", "@QVariant (@QHostAddress)") % NeedsInferiorCall
+ Check("var.data", ValuePattern(".*127.0.0.1.*"), "@QHostAddress") % NeedsInferiorCall;
QTest::newRow("QVariantList")