diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 6f443c92b47f0af150244046bb326cbd4e06bc15..5328a171aeaedd75001076214e245c9bba072e27 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -411,7 +411,7 @@ static QString niceType(QString type) "std::allocator<wchar_t> >", "std::wstring"); // std::vector - static QRegExp re1("std::vector<(.*)\\s*,std::allocator<(.*)>\\s*>"); + static QRegExp re1("std::vector<(.*), std::allocator<(.*)>\\s*>"); re1.setMinimal(true); for (int i = 0; i != 10; ++i) { if (re1.indexIn(type) == -1 || re1.cap(1) != re1.cap(2)) @@ -420,7 +420,7 @@ static QString niceType(QString type) } // std::list - static QRegExp re2("std::list<(.*)\\s*,std::allocator<(.*)>\\s*>"); + static QRegExp re2("std::list<(.*), std::allocator<(.*)>\\s*>"); re2.setMinimal(true); for (int i = 0; i != 10; ++i) { if (re2.indexIn(type) == -1 || re2.cap(1) != re2.cap(2)) @@ -428,6 +428,17 @@ static QString niceType(QString type) type.replace(re2.cap(0), "std::list<" + re2.cap(1) + ">"); } + // std::map + static QRegExp re3("std::map<(.*), (.*), std::less<(.*)\\s*>, " + "std::allocator<std::pair<const (.*), (.*)\\s*> > >"); + re3.setMinimal(true); + for (int i = 0; i != 10; ++i) { + if (re3.indexIn(type) == -1 || re3.cap(1) != re3.cap(3) + || re3.cap(1) != re3.cap(4) || re3.cap(2) != re3.cap(5)) + break; + type.replace(re3.cap(0), "std::map<" + re3.cap(1) + ", " + re3.cap(2) + ">"); + } + type.replace(" >", ">"); } return type; diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index dbc7eebcd3cf2f87c4a6b81618595d8089912ee7..ab5ee635b5afe67bf23a4e0aaf4f27385d73500a 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -53,6 +53,7 @@ #include <QtNetwork/QHostAddress> #include <iostream> +#include <map> #include <list> #include <stack> #include <string> @@ -131,7 +132,6 @@ void testArray() } } - void testQByteArray() { QByteArray ba = "Hello"; @@ -142,7 +142,6 @@ void testQByteArray() ba += 2; } - void testQHash() { QHash<int, float> hgg0; @@ -412,6 +411,41 @@ void testStdList() vec.push_back(false); } +void testStdMap() +{ + std::map<uint, QStringList> ggl; + ggl[11] = QStringList() << "11"; + ggl[22] = QStringList() << "22"; + + typedef std::map<uint, QStringList> T; + T ggt; + ggt[11] = QStringList() << "11"; + ggt[22] = QStringList() << "22"; + +#if 0 + std::map<uint, float> gg0; + gg0[11] = 11.0; + gg0[22] = 22.0; + + + std::map<QString, float> gg1; + gg1["22.0"] = 22.0; + + std::map<int, QString> gg2; + gg2[22] = "22.0"; + + std::map<QString, Foo> gg3; + gg3["22.0"] = Foo(22); + gg3["33.0"] = Foo(33); + + QObject ob; + std::map<QString, QPointer<QObject> > map; + map.insert("Hallo", QPointer<QObject>(&ob)); + map.insert("Welt", QPointer<QObject>(&ob)); + map.insert(".", QPointer<QObject>(&ob)); +#endif +} + void testStdStack() { std::stack<int *> plist1; @@ -795,6 +829,7 @@ int main(int argc, char *argv[]) testArray(); testStdList(); + testStdMap(); testStdStack(); testStdString(); testStdVector();