Commit 0f4cfa7e authored by hjk's avatar hjk
Browse files

Debugger: Enable dumper autotest suite for LLDB



26 pass, 149 fail...

Change-Id: I243eb03fe0ddcb193ed8d45e672564f7113b662f
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent b8a2983f
......@@ -898,6 +898,8 @@ class Dumper:
stripped = self.stripNamespaceFromType(typeName).replace("::", "__")
#warn("VALUE: %s" % value)
#warn("STRIPPED: %s" % stripped)
#warn("DUMPABLE: %s" % (stripped in qqDumpers))
if stripped in qqDumpers:
self.putType(typeName)
qqDumpers[stripped](self, value)
......@@ -1345,7 +1347,7 @@ def doit():
db.execute(eval(line[3:]))
def testit():
def testit1():
db = Dumper()
......@@ -1367,6 +1369,36 @@ def testit():
db.executeDebuggerCommand({'command':line})
# Used in dumper auto test.
# Usage: python lbridge.py /path/to/testbinary comma-separated-inames
def testit():
db = Dumper()
# Disable intermediate reporting.
savedReport = db.report
db.report = lambda stuff: 0
db.debugger.SetAsync(False)
db.expandedINames = set(sys.argv[3].split(','))
db.setupInferior({'cmd':'setupInferior','executable':sys.argv[2],'token':1})
db.handleBreakpoints({'cmd':'handleBreakpoints','bkpts':[{'operation':'add',
'modelid':'1','type':2,'ignorecount':0,'condition':'','function':'breakHere',
'oneshot':0,'enabled':1,'file':'','line':0}]})
error = lldb.SBError()
listener = db.debugger.GetListener()
db.process = db.target.Launch(listener, None, None, None, None,
None, None, 0, False, error)
db.currentThread().SetSelectedFrame(1)
db.report = savedReport
db.reportVariables()
#db.report("DUMPER=%s" % qqDumpers)
if len(sys.argv) > 2:
testit()
else:
......
......@@ -1337,11 +1337,8 @@ def qdump__QPixmap(d, value):
def qdump__QPoint(d, value):
x = value["xp"]
y = value["yp"]
# should not be needed, but sometimes yield myns::QVariant::Private::Data::qreal
x = x.cast(x.type.strip_typedefs())
y = y.cast(y.type.strip_typedefs())
x = int(value["xp"])
y = int(value["yp"])
d.putValue("(%s, %s)" % (x, y))
d.putNumChild(2)
if d.isExpanded():
......@@ -1350,7 +1347,13 @@ def qdump__QPoint(d, value):
def qdump__QPointF(d, value):
qdump__QPoint(d, value)
x = float(value["xp"])
y = float(value["yp"])
d.putValue("(%s, %s)" % (x, y))
d.putNumChild(2)
if d.isExpanded():
with Children(d):
d.putFields(value)
def qdump__QRect(d, value):
......
......@@ -471,7 +471,7 @@ public:
tst_Dumpers()
{
t = 0;
m_keepTemp = false;
m_keepTemp = true;
m_gdbVersion = 0;
m_gdbBuildVersion = 0;
m_lldbVersion = 0;
......@@ -512,9 +512,7 @@ void tst_Dumpers::initTestCase()
if (m_debuggerBinary.endsWith("cdb.exe"))
m_debuggerEngine = DumpTestCdbEngine;
if (m_debuggerBinary.endsWith("lldb")
|| m_debuggerBinary.endsWith("lbridge.py")
|| m_debuggerBinary.contains("/lldb-"))
if (m_debuggerBinary.endsWith("lldb"))
m_debuggerEngine = DumpTestLldbEngine;
m_qmakeBinary = qgetenv("QTC_QMAKE_PATH");
......@@ -572,8 +570,12 @@ void tst_Dumpers::initTestCase()
output += debugger.readAllStandardError();
output = output.trimmed();
// Should be something like LLDB-178
m_lldbVersion = output.mid(5).toInt();
qDebug() << "Lldb version " << output << m_lldbVersion;
QByteArray ba = output.mid(output.indexOf('-') + 1);
int pos = ba.indexOf('.');
if (pos >= 0)
ba = ba.left(pos);
m_lldbVersion = ba.toInt();
qDebug() << "Lldb version " << output << ba << m_lldbVersion;
QVERIFY(m_lldbVersion);
}
m_env = utilsEnv.toProcessEnvironment();
......@@ -616,6 +618,7 @@ void tst_Dumpers::dumper()
proFile.write("SOURCES = ");
proFile.write(mainFile);
proFile.write("\nTARGET = doit\n");
proFile.write("\nCONFIG -= app_bundle\n");
proFile.write("\nCONFIG -= release\n");
proFile.write("\nCONFIG += debug\n");
if (data.useQt)
......@@ -748,13 +751,16 @@ void tst_Dumpers::dumper()
sortediNames << QString::fromLatin1(iName);
sortediNames.sort();
foreach (QString iName, sortediNames)
cmds += "!qtcreatorcdbext.locals -t " + QByteArray::number(++token) + " -c 0 " + iName.toLatin1() + "\n";
cmds += "!qtcreatorcdbext.locals -t " + QByteArray::number(++token)
+ " -c 0 " + iName.toLatin1() + "\n";
cmds += "q\n";
} else if (m_debuggerEngine == DumpTestLldbEngine) {
exe = "python";
args << QLatin1String(dumperDir + "/lbridge.py")
<< QString::fromUtf8(m_debuggerBinary)
<< t->buildPath + QLatin1String("/doit");
<< t->buildPath + QLatin1String("/doit")
<< QString::fromUtf8(expanded);
//qDebug() << exe.constData() << ' ' << qPrintable(args.join(QLatin1Char(' ')));
}
t->input = cmds;
......@@ -799,6 +805,21 @@ void tst_Dumpers::dumper()
if (context.nameSpace == "::")
context.nameSpace.clear();
contents.replace("\\\"", "\"");
} else if (m_debuggerEngine == DumpTestLldbEngine) {
//qDebug() << "GOT OUTPUT: " << output;
QVERIFY(output.startsWith("data="));
contents = output;
//int posNameSpaceStart = output.indexOf("@NS@");
//QVERIFY(posNameSpaceStart != -1);
//posNameSpaceStart += sizeof("@NS@") - 1;
//int posNameSpaceEnd = output.indexOf("@", posNameSpaceStart);
//QVERIFY(posNameSpaceEnd != -1);
//context.nameSpace = output.mid(posNameSpaceStart, posNameSpaceEnd - posNameSpaceStart);
//qDebug() << "FOUND NS: " << context.nameSpace;
if (context.nameSpace == "::")
context.nameSpace.clear();
contents.replace("\\\"", "\"");
} else {
const QByteArray locals = "|locals|";
int pos1 = output.indexOf(locals);
......@@ -1970,8 +1991,8 @@ void tst_Dumpers::dumper_data()
"QPointF s0, s;\n"
"s = QPointF(100, 200);\n")
% CoreProfile()
% Check("s0", "(0, 0)", "@QPointF")
% Check("s", "(100, 200)", "@QPointF");
% Check("s0", "(0.0, 0.0)", "@QPointF")
% Check("s", "(100.0, 200.0)", "@QPointF");
QTest::newRow("QRect")
<< Data("#include <QRect>\n"
......
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