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

Fixes: debugger: fix dumping of QString used as hash key

parent 2932203a
......@@ -311,7 +311,7 @@ static bool isSimpleType(const char *type)
static bool isShortKey(const char *type)
{
return isSimpleType(type) || isEqual(type, "QString");
return isSimpleType(type) || isEqual(type, NS"QString");
}
static bool isMovableType(const char *type)
......@@ -704,44 +704,44 @@ static void qDumpUnknown(QDumper &d)
}
static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr,
const char *key = "value")
const char *field = "value")
{
type = stripNamespace(type);
switch (type[1]) {
case 'l':
if (isEqual(type, "float"))
P(d, key, *(float*)addr);
P(d, field, *(float*)addr);
return;
case 'n':
if (isEqual(type, "int"))
P(d, key, *(int*)addr);
P(d, field, *(int*)addr);
else if (isEqual(type, "unsigned"))
P(d, key, *(unsigned int*)addr);
P(d, field, *(unsigned int*)addr);
else if (isEqual(type, "unsigned int"))
P(d, key, *(unsigned int*)addr);
P(d, field, *(unsigned int*)addr);
else if (isEqual(type, "unsigned long"))
P(d, key, *(unsigned long*)addr);
P(d, field, *(unsigned long*)addr);
else if (isEqual(type, "unsigned long long"))
P(d, key, *(qulonglong*)addr);
P(d, field, *(qulonglong*)addr);
return;
case 'o':
if (isEqual(type, "bool"))
switch (*(bool*)addr) {
case 0: P(d, key, "false"); break;
case 1: P(d, key, "true"); break;
default: P(d, key, *(bool*)addr); break;
case 0: P(d, field, "false"); break;
case 1: P(d, field, "true"); break;
default: P(d, field, *(bool*)addr); break;
}
else if (isEqual(type, "double"))
P(d, key, *(double*)addr);
P(d, field, *(double*)addr);
else if (isEqual(type, "long"))
P(d, key, *(long*)addr);
P(d, field, *(long*)addr);
else if (isEqual(type, "long long"))
P(d, key, *(qulonglong*)addr);
P(d, field, *(qulonglong*)addr);
return;
case 'B':
if (isEqual(type, "QByteArray")) {
d << key << "encoded=\"1\",";
P(d, key, *(QByteArray*)addr);
d << field << "encoded=\"1\",";
P(d, field, *(QByteArray*)addr);
}
return;
case 'L':
......@@ -769,8 +769,8 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr
return;
case 'S':
if (isEqual(type, "QString")) {
d << key << "encoded=\"1\",";
P(d, key, *(QString*)addr);
d << field << "encoded=\"1\",";
P(d, field, *(QString*)addr);
}
return;
default:
......
......@@ -3555,8 +3555,11 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
if (item.findChild("nameencoded").data()[0] == '1')
data1.name = QByteArray::fromBase64(data1.name.toUtf8());
QString key = item.findChild("key").data();
if (!key.isEmpty())
if (!key.isEmpty()) {
if (item.findChild("keyencoded").data()[0] == '1')
key = QByteArray::fromBase64(key.toUtf8());
data1.name += " (" + key + ")";
}
setWatchDataType(data1, item.findChild("type"));
setWatchDataExpression(data1, item.findChild("exp"));
setWatchDataChildCount(data1, item.findChild("numchild"));
......
Supports Markdown
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