forked from qt-creator/qt-creator
Debugger: Work on LLDB dumper autotests
Implement putEmptyValue, use type priorities, introduce concept of backend specific tests. 39 pass, 136 fail... Change-Id: I71e89259dc925f799bca413b537b65e9e689e1b8 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -610,6 +610,12 @@ class Dumper:
|
||||
#if numchild != self.currentChildNumChild:
|
||||
self.put('numchild="%s",' % numchild)
|
||||
|
||||
def putEmptyValue(self, priority = -10):
|
||||
if priority >= self.currentValuePriority:
|
||||
self.currentValue = ""
|
||||
self.currentValuePriority = priority
|
||||
self.currentValueEncoding = None
|
||||
|
||||
def putValue(self, value, encoding = None, priority = 0):
|
||||
# Higher priority values override lower ones.
|
||||
if priority >= self.currentValuePriority:
|
||||
@@ -865,7 +871,7 @@ class Dumper:
|
||||
formatter.update()
|
||||
numchild = formatter.num_children()
|
||||
self.put('iname="%s",' % self.currentIName)
|
||||
self.put('type="%s",' % typeName)
|
||||
self.putType(typeName)
|
||||
self.put('numchild="%s",' % numchild)
|
||||
self.put('addr="0x%x",' % value.GetLoadAddress())
|
||||
self.putItemCount(numchild)
|
||||
@@ -884,11 +890,12 @@ class Dumper:
|
||||
if value.GetType().IsReferenceType():
|
||||
type = value.GetType().GetDereferencedType().GetPointerType()
|
||||
# FIXME: Find something more direct.
|
||||
origType = value.GetTypeName();
|
||||
value = value.CreateValueFromAddress(value.GetName(),
|
||||
value.AddressOf().GetValueAsUnsigned(), type).Dereference()
|
||||
#value = value.cast(value.dynamic_type)
|
||||
self.putItem(value)
|
||||
self.putBetterType("%s &" % value.GetTypeName())
|
||||
self.putBetterType(origType)
|
||||
return
|
||||
|
||||
# Pointers
|
||||
@@ -910,8 +917,8 @@ class Dumper:
|
||||
#numchild = 1 if value.MightHaveChildren() else 0
|
||||
numchild = value.GetNumChildren()
|
||||
self.put('iname="%s",' % self.currentIName)
|
||||
self.put('type="%s",' % typeName)
|
||||
self.putValue("" if v is None else v)
|
||||
self.putType(typeName)
|
||||
self.putValue('' if v is None else v)
|
||||
self.put('numchild="%s",' % numchild)
|
||||
self.put('addr="0x%x",' % value.GetLoadAddress())
|
||||
if self.currentIName in self.expandedINames:
|
||||
|
||||
@@ -332,6 +332,9 @@ struct Cxx11Profile : public Profile
|
||||
Cxx11Profile() : Profile("QMAKE_CXXFLAGS += -std=c++0x") {}
|
||||
};
|
||||
|
||||
struct GdbOnly {};
|
||||
struct LldbOnly {};
|
||||
|
||||
struct GdbVersion
|
||||
{
|
||||
// Minimum and maximum are inclusive.
|
||||
@@ -349,6 +352,23 @@ struct GdbVersion
|
||||
int max;
|
||||
};
|
||||
|
||||
struct LldbVersion
|
||||
{
|
||||
// Minimum and maximum are inclusive.
|
||||
LldbVersion(int minimum = 0, int maximum = 0)
|
||||
{
|
||||
if (minimum && !maximum)
|
||||
maximum = minimum;
|
||||
if (maximum == 0)
|
||||
maximum = INT_MAX;
|
||||
|
||||
max = maximum;
|
||||
min = minimum;
|
||||
}
|
||||
int min;
|
||||
int max;
|
||||
};
|
||||
|
||||
struct ForceC {};
|
||||
|
||||
struct CoreProfile {};
|
||||
@@ -357,11 +377,14 @@ struct GuiProfile {};
|
||||
|
||||
struct DataBase
|
||||
{
|
||||
DataBase() : useQt(false), forceC(false), neededGdbVersion() {}
|
||||
DataBase() : useQt(false), forceC(false), gdbOnly(false), lldbOnly(false) {}
|
||||
|
||||
mutable bool useQt;
|
||||
mutable bool forceC;
|
||||
mutable bool gdbOnly;
|
||||
mutable bool lldbOnly;
|
||||
mutable GdbVersion neededGdbVersion;
|
||||
mutable LldbVersion neededLldbVersion;
|
||||
};
|
||||
|
||||
class Data : public DataBase
|
||||
@@ -392,6 +415,24 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Data &operator%(const LldbVersion &lldbVersion) const
|
||||
{
|
||||
neededLldbVersion = lldbVersion;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Data &operator%(const LldbOnly &) const
|
||||
{
|
||||
lldbOnly = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Data &operator%(const GdbOnly &) const
|
||||
{
|
||||
gdbOnly = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Data &operator%(const CoreProfile &) const
|
||||
{
|
||||
profileExtra +=
|
||||
@@ -602,9 +643,26 @@ void tst_Dumpers::dumper()
|
||||
|
||||
if (m_debuggerEngine == DumpTestGdbEngine) {
|
||||
if (data.neededGdbVersion.min > m_gdbVersion)
|
||||
MSKIP_SINGLE("Need minimum GDB version " + QByteArray::number(data.neededGdbVersion.min));
|
||||
MSKIP_SINGLE("Need minimum GDB version "
|
||||
+ QByteArray::number(data.neededGdbVersion.min));
|
||||
if (data.neededGdbVersion.max < m_gdbVersion)
|
||||
MSKIP_SINGLE("Need maximum GDB version " + QByteArray::number(data.neededGdbVersion.max));
|
||||
MSKIP_SINGLE("Need maximum GDB version "
|
||||
+ QByteArray::number(data.neededGdbVersion.max));
|
||||
} else {
|
||||
if (data.gdbOnly)
|
||||
MSKIP_SINGLE("Test is GDB specific");
|
||||
}
|
||||
|
||||
if (m_debuggerEngine == DumpTestLldbEngine) {
|
||||
if (data.neededLldbVersion.min > m_gdbVersion)
|
||||
MSKIP_SINGLE("Need minimum LLDB version "
|
||||
+ QByteArray::number(data.neededLldbVersion.min));
|
||||
if (data.neededLldbVersion.max < m_gdbVersion)
|
||||
MSKIP_SINGLE("Need maximum LLDB version "
|
||||
+ QByteArray::number(data.neededLldbVersion.max));
|
||||
} else {
|
||||
if (data.lldbOnly)
|
||||
MSKIP_SINGLE("Test is LLDB specific");
|
||||
}
|
||||
|
||||
QString cmd;
|
||||
@@ -3919,8 +3977,8 @@ void tst_Dumpers::dumper_data()
|
||||
% Check("n@2", "1", "int");
|
||||
|
||||
|
||||
QTest::newRow("RValueReference")
|
||||
<< Data("#include <utility>\n"
|
||||
const Data rvalueData = Data(
|
||||
"#include <utility>\n"
|
||||
"struct X { X() : a(2), b(3) {} int a, b; };\n"
|
||||
"X testRValueReferenceHelper1() { return X(); }\n"
|
||||
"X testRValueReferenceHelper2(X &&x) { return x; }\n",
|
||||
@@ -3932,13 +3990,24 @@ void tst_Dumpers::dumper_data()
|
||||
"X y3 = testRValueReferenceHelper2(testRValueReferenceHelper1());\n"
|
||||
"unused(&x1, &x2, &x3, &y1, &y2, &y3);\n")
|
||||
% Cxx11Profile()
|
||||
% Check("x1", "", "X &")
|
||||
% Check("x2", "", "X &")
|
||||
% Check("x3", "", "X &")
|
||||
% Check("y1", "", "X")
|
||||
% Check("y2", "", "X")
|
||||
% Check("y3", "", "X");
|
||||
|
||||
QTest::newRow("RValueReferenceGdb")
|
||||
<< Data(rvalueData)
|
||||
% GdbOnly()
|
||||
% Check("x1", "", "X &")
|
||||
% Check("x2", "", "X &")
|
||||
% Check("x3", "", "X &");
|
||||
|
||||
QTest::newRow("RValueReferenceLldb")
|
||||
<< Data(rvalueData)
|
||||
% LldbOnly()
|
||||
% Check("x1", "", "X &&")
|
||||
% Check("x2", "", "X &&")
|
||||
% Check("x3", "", "X &&");
|
||||
|
||||
QTest::newRow("SSE")
|
||||
<< Data("#include <xmmintrin.h>\n"
|
||||
"#include <stddef.h>\n",
|
||||
|
||||
Reference in New Issue
Block a user