forked from qt-creator/qt-creator
Debugger: Fix display of pointers as arrays
Task-number: QTCREATORBUG-18204 Task-number: QTCREATORBUG-17803 Change-Id: I4efe359c206b53ef773127cf29107d3cce720819 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1385,7 +1385,7 @@ class DumperBase:
|
||||
n = (10, 100, 1000, 10000)[displayFormat - Array10Format]
|
||||
self.putType(typeName)
|
||||
self.putItemCount(n)
|
||||
self.putArrayData(value.address(), n, innerType)
|
||||
self.putArrayData(value.pointer(), n, innerType)
|
||||
return
|
||||
|
||||
if innerType.code == TypeCodeFunction:
|
||||
|
@@ -473,6 +473,13 @@ struct RequiredMessage
|
||||
QString message;
|
||||
};
|
||||
|
||||
struct DumperOptions
|
||||
{
|
||||
DumperOptions(const QString &opts = QString()) : options(opts) {}
|
||||
|
||||
QString options;
|
||||
};
|
||||
|
||||
struct Check
|
||||
{
|
||||
Check() {}
|
||||
@@ -699,6 +706,12 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Data &operator+(const DumperOptions &options) const
|
||||
{
|
||||
dumperOptions += options.options;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Data &operator+(const Profile &profile) const
|
||||
{
|
||||
profileExtra += profile.contents;
|
||||
@@ -921,6 +934,7 @@ public:
|
||||
mutable QString mainFile = "main.cpp";
|
||||
mutable QString projectFile = "doit.pro";
|
||||
|
||||
mutable QString dumperOptions;
|
||||
mutable QString profileExtra;
|
||||
mutable QString includes;
|
||||
mutable QString code;
|
||||
@@ -1442,6 +1456,10 @@ void tst_Dumpers::dumper()
|
||||
QStringList args;
|
||||
QString cmds;
|
||||
|
||||
QString dumperOptions = data.dumperOptions;
|
||||
if (!dumperOptions.isEmpty() && !dumperOptions.endsWith(','))
|
||||
dumperOptions += ',';
|
||||
|
||||
if (m_debuggerEngine == GdbEngine) {
|
||||
const QFileInfo gdbBinaryFile(exe);
|
||||
const QString uninstalledData = gdbBinaryFile.absolutePath()
|
||||
@@ -1465,7 +1483,7 @@ void tst_Dumpers::dumper()
|
||||
"python theDumper.setupDumpers()\n"
|
||||
"run " + nograb + "\n"
|
||||
"up " + QString::number(data.skipLevels) + "\n"
|
||||
"python theDumper.fetchVariables({"
|
||||
"python theDumper.fetchVariables({" + dumperOptions +
|
||||
"'token':2,'fancy':1,'forcens':1,"
|
||||
"'autoderef':1,'dyntype':1,'passexceptions':1,"
|
||||
"'testing':1,'qobjectnames':1,"
|
||||
@@ -5320,6 +5338,18 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("a2.3", "[3]", "100", "char");
|
||||
|
||||
|
||||
QTest::newRow("Array10Format")
|
||||
<< Data("",
|
||||
"int arr[4] = { 1, 2, 3, 4};\n"
|
||||
"int *nums = new int[4] { 1, 2, 3, 4};\n")
|
||||
|
||||
+ NoLldbEngine // FIXME: DumperOptions not handled yet.
|
||||
+ DumperOptions("'formats':{'local.nums':12}") // Array10Format
|
||||
|
||||
+ Check("arr.1", "[1]", "2", "int")
|
||||
+ Check("nums.1", "[1]", "2", "int");
|
||||
|
||||
|
||||
QTest::newRow("ArrayQt")
|
||||
<< Data("#include <QByteArray>\n"
|
||||
"#include <QString>\n" + fooData,
|
||||
|
Reference in New Issue
Block a user