Test for array of function pointers in LLDB dumper

Test checks that the dumper doesn't go through the slow "iterate
through every type defined in target" dumper path.

Done-by: Alexandru Croitor
Change-Id: I4e1aea22ea2912467635f2e62fe1f6b2aa58e897
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alexandru Croitor
2017-01-25 12:19:23 +01:00
committed by hjk
parent cfa25be0a4
commit 6bf8f85b33

View File

@@ -478,6 +478,15 @@ struct TypeDef : Type
}
};
struct RequiredMessage
{
RequiredMessage() {}
RequiredMessage(const QString &message) : message(message) {}
QString message;
};
struct Check
{
Check() {}
@@ -689,6 +698,12 @@ public:
return *this;
}
const Data &operator+(const RequiredMessage &check) const
{
requiredMessages.append(check);
return *this;
}
const Data &operator+(const Profile &profile) const
{
profileExtra += profile.contents;
@@ -903,6 +918,7 @@ public:
mutable QString code;
mutable QList<Check> checks;
mutable QList<RequiredMessage> requiredMessages;
};
struct TempStuff
@@ -1629,6 +1645,15 @@ void tst_Dumpers::dumper()
qDebug() << "SEEN INAMES " << seenINames;
qDebug() << "EXPANDED : " << expanded;
}
for (int i = data.requiredMessages.size(); --i >= 0; ) {
RequiredMessage check = data.requiredMessages.at(i);
if (fullOutput.contains(check.message.toLatin1())) {
qDebug() << " EXPECTED MESSAGE TO BE MISSING, BUT FOUND: " << check.message;
ok = false;
}
}
if (ok) {
m_keepTemp = false;
} else {
@@ -6496,6 +6521,14 @@ void tst_Dumpers::dumper_data()
+ Check("tc.1.bar", "15", "int")
+ Check("tc.2.bar", "15", "int")
+ Check("tc.3.bar", "15", "int");
QTest::newRow("ArrayOfFunctionPointers")
<< Data("typedef int (*FP)(int *); \n"
"int func(int *param) { unused(param); return 0; } \n",
"FP fps[5]; fps[0] = func; fps[0](0); unused(&fps);\n")
+ RequiredMessage("Searching for type int (*)(int *) across all target modules, this could be very slow")
+ LldbEngine;
#if 0
#ifdef Q_OS_LINUX
// Hint: To open a failing test in Creator, do: