forked from qt-creator/qt-creator
Fixes: debugger: sort array and list indices numerically
This commit is contained in:
@@ -839,7 +839,7 @@ static void qDumpQByteArray(QDumper &d)
|
|||||||
unsigned char u = (isprint(c) && c != '\'' && c != '"') ? c : '?';
|
unsigned char u = (isprint(c) && c != '\'' && c != '"') ? c : '?';
|
||||||
sprintf(buf, "%02x (%u '%c')", c, c, u);
|
sprintf(buf, "%02x (%u '%c')", c, c, u);
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
P(d, "value", buf);
|
P(d, "value", buf);
|
||||||
d.endHash();
|
d.endHash();
|
||||||
}
|
}
|
||||||
@@ -1104,14 +1104,14 @@ static void qDumpQHash(QDumper &d)
|
|||||||
while (node != end) {
|
while (node != end) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
if (simpleKey) {
|
if (simpleKey) {
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
|
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
|
||||||
if (simpleValue)
|
if (simpleValue)
|
||||||
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
|
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
|
||||||
P(d, "type", valueType);
|
P(d, "type", valueType);
|
||||||
P(d, "addr", addOffset(node, valueOffset));
|
P(d, "addr", addOffset(node, valueOffset));
|
||||||
} else {
|
} else {
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
//P(d, "exp", "*(char*)" << node);
|
//P(d, "exp", "*(char*)" << node);
|
||||||
P(d, "exp", "*('"NS"QHashNode<" << keyType << "," << valueType << " >'*)" << node);
|
P(d, "exp", "*('"NS"QHashNode<" << keyType << "," << valueType << " >'*)" << node);
|
||||||
P(d, "type", "'"NS"QHashNode<" << keyType << "," << valueType << " >'");
|
P(d, "type", "'"NS"QHashNode<" << keyType << "," << valueType << " >'");
|
||||||
@@ -1215,7 +1215,7 @@ static void qDumpQList(QDumper &d)
|
|||||||
d << ",children=[";
|
d << ",children=[";
|
||||||
for (int i = 0; i != n; ++i) {
|
for (int i = 0; i != n; ++i) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
if (innerTypeIsPointer) {
|
if (innerTypeIsPointer) {
|
||||||
void *p = ldata.d->array + i + pdata->begin;
|
void *p = ldata.d->array + i + pdata->begin;
|
||||||
if (p) {
|
if (p) {
|
||||||
@@ -1275,7 +1275,7 @@ static void qDumpQLinkedList(QDumper &d)
|
|||||||
const void *p = deref(ldata);
|
const void *p = deref(ldata);
|
||||||
for (int i = 0; i != n; ++i) {
|
for (int i = 0; i != n; ++i) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
const void *addr = addOffset(p, 2 * sizeof(void*));
|
const void *addr = addOffset(p, 2 * sizeof(void*));
|
||||||
qDumpInnerValueOrPointer(d, d.innertype, stripped, addr);
|
qDumpInnerValueOrPointer(d, d.innertype, stripped, addr);
|
||||||
p = deref(p);
|
p = deref(p);
|
||||||
@@ -1414,7 +1414,7 @@ static void qDumpQMap(QDumper &d)
|
|||||||
|
|
||||||
while (node != end) {
|
while (node != end) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
if (simpleKey) {
|
if (simpleKey) {
|
||||||
P(d, "type", valueType);
|
P(d, "type", valueType);
|
||||||
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
|
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
|
||||||
@@ -1660,7 +1660,7 @@ static void qDumpQObjectMethodList(QDumper &d)
|
|||||||
const QMetaMethod & method = mo->method(i);
|
const QMetaMethod & method = mo->method(i);
|
||||||
int mt = method.methodType();
|
int mt = method.methodType();
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "] " << mo->indexOfMethod(method.signature())
|
P(d, "name", i << " " << mo->indexOfMethod(method.signature())
|
||||||
<< " " << method.signature());
|
<< " " << method.signature());
|
||||||
P(d, "value", (mt == QMetaMethod::Signal ? "<Signal>" : "<Slot>") << " (" << mt << ")");
|
P(d, "value", (mt == QMetaMethod::Signal ? "<Signal>" : "<Slot>") << " (" << mt << ")");
|
||||||
d.endHash();
|
d.endHash();
|
||||||
@@ -1712,11 +1712,11 @@ static void qDumpQObjectSignal(QDumper &d)
|
|||||||
for (int i = 0; i != connList.size(); ++i) {
|
for (int i = 0; i != connList.size(); ++i) {
|
||||||
const QObjectPrivate::Connection &conn = connList.at(i);
|
const QObjectPrivate::Connection &conn = connList.at(i);
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "] receiver");
|
P(d, "name", i << " receiver");
|
||||||
qDumpInnerValueHelper(d, NS"QObject *", conn.receiver);
|
qDumpInnerValueHelper(d, NS"QObject *", conn.receiver);
|
||||||
d.endHash();
|
d.endHash();
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "] slot");
|
P(d, "name", i << " slot");
|
||||||
P(d, "type", "");
|
P(d, "type", "");
|
||||||
if (conn.receiver)
|
if (conn.receiver)
|
||||||
P(d, "value", conn.receiver->metaObject()->method(conn.method).signature());
|
P(d, "value", conn.receiver->metaObject()->method(conn.method).signature());
|
||||||
@@ -1725,7 +1725,7 @@ static void qDumpQObjectSignal(QDumper &d)
|
|||||||
P(d, "numchild", "0");
|
P(d, "numchild", "0");
|
||||||
d.endHash();
|
d.endHash();
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "] type");
|
P(d, "name", i << " type");
|
||||||
P(d, "type", "");
|
P(d, "type", "");
|
||||||
P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>");
|
P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>");
|
||||||
P(d, "numchild", "0");
|
P(d, "numchild", "0");
|
||||||
@@ -1756,7 +1756,7 @@ static void qDumpQObjectSignalList(QDumper &d)
|
|||||||
int k = mo->indexOfSignal(method.signature());
|
int k = mo->indexOfSignal(method.signature());
|
||||||
const QObjectPrivate::ConnectionList &connList = qConnectionList(ob, k);
|
const QObjectPrivate::ConnectionList &connList = qConnectionList(ob, k);
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << k << "]");
|
P(d, "name", k);
|
||||||
P(d, "value", method.signature());
|
P(d, "value", method.signature());
|
||||||
P(d, "numchild", connList.size());
|
P(d, "numchild", connList.size());
|
||||||
//P(d, "numchild", "1");
|
//P(d, "numchild", "1");
|
||||||
@@ -1796,17 +1796,17 @@ static void qDumpQObjectSlot(QDumper &d)
|
|||||||
const QMetaMethod & method =
|
const QMetaMethod & method =
|
||||||
sender.sender->metaObject()->method(sender.signal);
|
sender.sender->metaObject()->method(sender.signal);
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << s << "] sender");
|
P(d, "name", s << " sender");
|
||||||
qDumpInnerValueHelper(d, NS"QObject *", sender.sender);
|
qDumpInnerValueHelper(d, NS"QObject *", sender.sender);
|
||||||
d.endHash();
|
d.endHash();
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << s << "] signal");
|
P(d, "name", s << " signal");
|
||||||
P(d, "type", "");
|
P(d, "type", "");
|
||||||
P(d, "value", method.signature());
|
P(d, "value", method.signature());
|
||||||
P(d, "numchild", "0");
|
P(d, "numchild", "0");
|
||||||
d.endHash();
|
d.endHash();
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << s << "] type");
|
P(d, "name", s << " type");
|
||||||
P(d, "type", "");
|
P(d, "type", "");
|
||||||
P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>");
|
P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>");
|
||||||
P(d, "numchild", "0");
|
P(d, "numchild", "0");
|
||||||
@@ -1843,7 +1843,7 @@ static void qDumpQObjectSlotList(QDumper &d)
|
|||||||
if (method.methodType() == QMetaMethod::Slot) {
|
if (method.methodType() == QMetaMethod::Slot) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
int k = mo->indexOfSlot(method.signature());
|
int k = mo->indexOfSlot(method.signature());
|
||||||
P(d, "name", "[" << k << "]");
|
P(d, "name", k);
|
||||||
P(d, "value", method.signature());
|
P(d, "value", method.signature());
|
||||||
|
|
||||||
// count senders. expensive...
|
// count senders. expensive...
|
||||||
@@ -1911,7 +1911,7 @@ static void qDumpQSet(QDumper &d)
|
|||||||
for (int bucket = 0; bucket != hd->numBuckets && i <= 10000; ++bucket) {
|
for (int bucket = 0; bucket != hd->numBuckets && i <= 10000; ++bucket) {
|
||||||
for (node = hd->buckets[bucket]; node->next; node = node->next) {
|
for (node = hd->buckets[bucket]; node->next; node = node->next) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
P(d, "type", d.innertype);
|
P(d, "type", d.innertype);
|
||||||
P(d, "exp", "(('"NS"QHashNode<" << d.innertype
|
P(d, "exp", "(('"NS"QHashNode<" << d.innertype
|
||||||
<< ","NS"QHashDummyValue>'*)"
|
<< ","NS"QHashDummyValue>'*)"
|
||||||
@@ -1970,7 +1970,7 @@ static void qDumpQStringList(QDumper &d)
|
|||||||
d << ",children=[";
|
d << ",children=[";
|
||||||
for (int i = 0; i != n; ++i) {
|
for (int i = 0; i != n; ++i) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
P(d, "value", list[i]);
|
P(d, "value", list[i]);
|
||||||
P(d, "valueencoded", "1");
|
P(d, "valueencoded", "1");
|
||||||
d.endHash();
|
d.endHash();
|
||||||
@@ -2108,7 +2108,7 @@ static void qDumpQVector(QDumper &d)
|
|||||||
d << ",children=[";
|
d << ",children=[";
|
||||||
for (int i = 0; i != n; ++i) {
|
for (int i = 0; i != n; ++i) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
qDumpInnerValueOrPointer(d, d.innertype, stripped,
|
qDumpInnerValueOrPointer(d, d.innertype, stripped,
|
||||||
addOffset(v, i * innersize + typeddatasize));
|
addOffset(v, i * innersize + typeddatasize));
|
||||||
d.endHash();
|
d.endHash();
|
||||||
@@ -2156,7 +2156,7 @@ static void qDumpStdList(QDumper &d)
|
|||||||
it = list.begin();
|
it = list.begin();
|
||||||
for (int i = 0; i < 1000 && it != list.end(); ++i, ++it) {
|
for (int i = 0; i < 1000 && it != list.end(); ++i, ++it) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
qDumpInnerValueOrPointer(d, d.innertype, stripped, it.operator->());
|
qDumpInnerValueOrPointer(d, d.innertype, stripped, it.operator->());
|
||||||
d.endHash();
|
d.endHash();
|
||||||
}
|
}
|
||||||
@@ -2218,7 +2218,7 @@ static void qDumpStdMap(QDumper &d)
|
|||||||
d.endHash();
|
d.endHash();
|
||||||
} else {
|
} else {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
P(d, "addr", it.operator->());
|
P(d, "addr", it.operator->());
|
||||||
P(d, "type", pairType);
|
P(d, "type", pairType);
|
||||||
d.endHash();
|
d.endHash();
|
||||||
@@ -2305,7 +2305,7 @@ static void qDumpStdVector(QDumper &d)
|
|||||||
d << ",children=[";
|
d << ",children=[";
|
||||||
for (int i = 0; i != n; ++i) {
|
for (int i = 0; i != n; ++i) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", i);
|
||||||
qDumpInnerValueOrPointer(d, d.innertype, stripped,
|
qDumpInnerValueOrPointer(d, d.innertype, stripped,
|
||||||
addOffset(v->start, i * innersize));
|
addOffset(v->start, i * innersize));
|
||||||
d.endHash();
|
d.endHash();
|
||||||
|
|||||||
@@ -565,9 +565,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
|||||||
connect(resetToSimpleAction, SIGNAL(triggered()),
|
connect(resetToSimpleAction, SIGNAL(triggered()),
|
||||||
m_manager, SLOT(setSimpleDockWidgetArrangement()));
|
m_manager, SLOT(setSimpleDockWidgetArrangement()));
|
||||||
|
|
||||||
|
|
||||||
m_generalOptionPage = 0;
|
|
||||||
|
|
||||||
// FIXME:
|
// FIXME:
|
||||||
m_generalOptionPage = new GdbOptionPage(this);
|
m_generalOptionPage = new GdbOptionPage(this);
|
||||||
addObject(m_generalOptionPage);
|
addObject(m_generalOptionPage);
|
||||||
|
|||||||
@@ -3548,6 +3548,8 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
|
|||||||
WatchData data1 = childtemplate;
|
WatchData data1 = childtemplate;
|
||||||
data1.name = item.findChild("name").data();
|
data1.name = item.findChild("name").data();
|
||||||
data1.iname = data.iname + "." + data1.name;
|
data1.iname = data.iname + "." + data1.name;
|
||||||
|
if (!data1.name.isEmpty() && data1.name.at(0).isDigit())
|
||||||
|
data1.name = '[' + data1.name + ']';
|
||||||
//qDebug() << "NAMEENCODED: " << item.findChild("nameencoded").data()
|
//qDebug() << "NAMEENCODED: " << item.findChild("nameencoded").data()
|
||||||
// << item.findChild("nameencoded").data()[1];
|
// << item.findChild("nameencoded").data()[1];
|
||||||
if (item.findChild("nameencoded").data()[0] == '1')
|
if (item.findChild("nameencoded").data()[0] == '1')
|
||||||
|
|||||||
@@ -255,7 +255,6 @@ QString WatchData::toString() const
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool iNameSorter(const WatchData &d1, const WatchData &d2)
|
static bool iNameSorter(const WatchData &d1, const WatchData &d2)
|
||||||
{
|
{
|
||||||
if (d1.level != d2.level)
|
if (d1.level != d2.level)
|
||||||
@@ -265,19 +264,9 @@ static bool iNameSorter(const WatchData &d1, const WatchData &d2)
|
|||||||
QString name1 = d1.iname.section('.', level, level);
|
QString name1 = d1.iname.section('.', level, level);
|
||||||
QString name2 = d2.iname.section('.', level, level);
|
QString name2 = d2.iname.section('.', level, level);
|
||||||
//MODEL_DEBUG(" SORT: " << name1 << name2 << (name1 < name2));
|
//MODEL_DEBUG(" SORT: " << name1 << name2 << (name1 < name2));
|
||||||
|
if (name1 != name2 && !name1.isEmpty() && !name2.isEmpty()) {
|
||||||
if (name1 != name2) {
|
if (name1.at(0).isDigit() && name2.at(0).isDigit())
|
||||||
// This formerly used inames. in this case 'lastIndexOf' probably
|
return name1.toInt() < name2.toInt();
|
||||||
// makes more sense.
|
|
||||||
if (name1.startsWith('[') && name2.startsWith('[')) {
|
|
||||||
return name1.mid(1, name1.indexOf(']') - 1).toInt()
|
|
||||||
< name2.mid(1, name2.indexOf(']') - 1).toInt();
|
|
||||||
// numbers should be sorted according to their numerical value
|
|
||||||
//int pos = d1.name.lastIndexOf('.');
|
|
||||||
//if (pos != -1 && pos + 1 != d1.name.size() && d1.name.at(pos + 1).isDigit())
|
|
||||||
// return d1.name.size() < d2.name.size();
|
|
||||||
// fall through
|
|
||||||
}
|
|
||||||
return name1 < name2;
|
return name1 < name2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -437,6 +437,7 @@ void FakeVimHandler::Private::setupWidget()
|
|||||||
m_plaintextedit->setLineWrapMode(QPlainTextEdit::NoWrap);
|
m_plaintextedit->setLineWrapMode(QPlainTextEdit::NoWrap);
|
||||||
}
|
}
|
||||||
m_wasReadOnly = EDITOR(isReadOnly());
|
m_wasReadOnly = EDITOR(isReadOnly());
|
||||||
|
//EDITOR(setReadOnly(true));
|
||||||
showBlackMessage("vi emulation mode.");
|
showBlackMessage("vi emulation mode.");
|
||||||
updateMiniBuffer();
|
updateMiniBuffer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,7 +244,6 @@ void testQLinkedList()
|
|||||||
f.append(Foo(1));
|
f.append(Foo(1));
|
||||||
f.append(Foo(2));
|
f.append(Foo(2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QLinkedList<std::string> v;
|
QLinkedList<std::string> v;
|
||||||
v.push_back("aa");
|
v.push_back("aa");
|
||||||
v.push_back("bb");
|
v.push_back("bb");
|
||||||
@@ -258,7 +257,7 @@ void testQList()
|
|||||||
QList<int> li;
|
QList<int> li;
|
||||||
QList<uint> lu;
|
QList<uint> lu;
|
||||||
|
|
||||||
for (int i = 0; i != 3; ++i) {
|
for (int i = 0; i != 30; ++i) {
|
||||||
li.append(i);
|
li.append(i);
|
||||||
}
|
}
|
||||||
li.append(101);
|
li.append(101);
|
||||||
|
|||||||
Reference in New Issue
Block a user