forked from qt-creator/qt-creator
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
@@ -2155,6 +2155,14 @@ static void qDumpStdMap(QDumper &d)
|
|||||||
P(d, "valuedisabled", "true");
|
P(d, "valuedisabled", "true");
|
||||||
P(d, "valueoffset", d.extraInt[2]);
|
P(d, "valueoffset", d.extraInt[2]);
|
||||||
|
|
||||||
|
// HACK: we need a properly const qualified version of the
|
||||||
|
// std::pair used. We extract it from the allocator parameter
|
||||||
|
// as it is there, and, equally importantly, in an order that
|
||||||
|
// gdb accepts when fed with it.
|
||||||
|
char *pairType = (char *)(d.templateParameters[3]) + 16;
|
||||||
|
pairType[strlen(pairType) - 2] = 0;
|
||||||
|
P(d, "pairtype", pairType);
|
||||||
|
|
||||||
if (d.dumpChildren) {
|
if (d.dumpChildren) {
|
||||||
bool simpleKey = isSimpleType(keyType);
|
bool simpleKey = isSimpleType(keyType);
|
||||||
bool simpleValue = isShortKey(valueType);
|
bool simpleValue = isShortKey(valueType);
|
||||||
@@ -2177,7 +2185,7 @@ static void qDumpStdMap(QDumper &d)
|
|||||||
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", "std::pair<const " << keyType << "," << valueType << " >");
|
P(d, "type", pairType);
|
||||||
d.endHash();
|
d.endHash();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,6 +108,34 @@ in C++.
|
|||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
|
|
||||||
|
\o Using Qt's foreach is ok in non-time critical code when using a QTL
|
||||||
|
container. It is a nice way to keep line noise down and to give the
|
||||||
|
loop variable a proper name:
|
||||||
|
|
||||||
|
\code
|
||||||
|
foreach (QWidget *widget, container)
|
||||||
|
doSomething(widget);
|
||||||
|
|
||||||
|
-VS-
|
||||||
|
|
||||||
|
Container::iterator end = container.end();
|
||||||
|
for (Container::iterator it = container.begin(); it != end; ++it)
|
||||||
|
doSomething(*it);
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
If the loop variable can be made const, do so. This can prevent
|
||||||
|
unnecessary detaching of shared data in some cases. So:
|
||||||
|
|
||||||
|
\code
|
||||||
|
foreach (const QString &name, someListOfNames)
|
||||||
|
doSomething(name);
|
||||||
|
|
||||||
|
- NOT -
|
||||||
|
|
||||||
|
foreach (QString name, someListOfNames)
|
||||||
|
doSomething(name);
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
|
||||||
\section1 Formatting
|
\section1 Formatting
|
||||||
|
|
||||||
|
|||||||
@@ -1362,7 +1362,7 @@ void GdbEngine::handleShowVersion(const GdbResultRecord &response)
|
|||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
m_gdbVersion = 100;
|
m_gdbVersion = 100;
|
||||||
QString msg = response.data.findChild("consolestreamoutput").data();
|
QString msg = response.data.findChild("consolestreamoutput").data();
|
||||||
QRegExp supported("GNU gdb(.*) (\\d+)\\.(\\d+)\\.(\\d+)");
|
QRegExp supported("GNU gdb(.*) (\\d+)\\.(\\d+)(\\.(\\d+))?");
|
||||||
if (supported.indexIn(msg) == -1) {
|
if (supported.indexIn(msg) == -1) {
|
||||||
qDebug() << "UNSUPPORTED GDB VERSION " << msg;
|
qDebug() << "UNSUPPORTED GDB VERSION " << msg;
|
||||||
QStringList list = msg.split("\n");
|
QStringList list = msg.split("\n");
|
||||||
@@ -1384,7 +1384,7 @@ void GdbEngine::handleShowVersion(const GdbResultRecord &response)
|
|||||||
} else {
|
} else {
|
||||||
m_gdbVersion = 10000 * supported.cap(2).toInt()
|
m_gdbVersion = 10000 * supported.cap(2).toInt()
|
||||||
+ 100 * supported.cap(3).toInt()
|
+ 100 * supported.cap(3).toInt()
|
||||||
+ 1 * supported.cap(4).toInt();
|
+ 1 * supported.cap(5).toInt();
|
||||||
//qDebug() << "GDB VERSION " << m_gdbVersion;
|
//qDebug() << "GDB VERSION " << m_gdbVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3022,8 +3022,13 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
|||||||
} else if (outertype == "std::map") {
|
} else if (outertype == "std::map") {
|
||||||
// We don't want the comparator and the allocator confuse gdb.
|
// We don't want the comparator and the allocator confuse gdb.
|
||||||
// But we need the offset of the second item in the value pair.
|
// But we need the offset of the second item in the value pair.
|
||||||
extraArgs[2] = "(size_t)&(('std::pair<const " + inners.at(0)
|
// We read the type of the pair from the allocator argument because
|
||||||
+ "," + inners.at(1) + ">'*)0)->second";
|
// that gets the constness "right" (in the sense that gdb can
|
||||||
|
// read it back;
|
||||||
|
QString pairType = inners.at(3);
|
||||||
|
// remove 'std::allocator<...>':
|
||||||
|
pairType = pairType.mid(15, pairType.size() - 15 - 2);
|
||||||
|
extraArgs[2] = "(size_t)&(('" + pairType + "'*)0)->second";
|
||||||
extraArgs[3] = "0";
|
extraArgs[3] = "0";
|
||||||
} else if (outertype == "std::basic_string") {
|
} else if (outertype == "std::basic_string") {
|
||||||
//qDebug() << "EXTRACT TEMPLATE: " << outertype << inners;
|
//qDebug() << "EXTRACT TEMPLATE: " << outertype << inners;
|
||||||
|
|||||||
@@ -74,8 +74,6 @@ uint qHash(const double & f)
|
|||||||
return int(f);
|
return int(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define X myns
|
|
||||||
X::QString str;
|
|
||||||
|
|
||||||
class Foo
|
class Foo
|
||||||
{
|
{
|
||||||
@@ -418,6 +416,11 @@ void testStdMap()
|
|||||||
gg3["33.0"] = Foo(33);
|
gg3["33.0"] = Foo(33);
|
||||||
gg3["44.0"] = Foo(44);
|
gg3["44.0"] = Foo(44);
|
||||||
|
|
||||||
|
|
||||||
|
std::map<const char *, Foo> m1;
|
||||||
|
m1["22.0"] = Foo(22);
|
||||||
|
m1["33.0"] = Foo(33);
|
||||||
|
m1["44.0"] = Foo(44);
|
||||||
#if 1
|
#if 1
|
||||||
std::map<uint, uint> gg;
|
std::map<uint, uint> gg;
|
||||||
gg[11] = 1;
|
gg[11] = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user