diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index b6dad71d4acfcb56596b04961aaa9f32cd0acb78..953b91b67caa1eb75cdbbec26f731a7df055457a 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -180,8 +180,17 @@ void WatchData::setType(const QString &str) changed = false; } setTypeUnneeded(); - if (isIntOrFloatType(type)) - setHasChildren(false); + switch (guessChildren(type)) { + case HasChildren: + setHasChildren(true); + break; + case HasNoChildren: + setHasChildren(false); + break; + case HasPossiblyChildren: + setHasChildren(true); // FIXME: bold assumption + break; + } } void WatchData::setAddress(const QString &str) diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp index 4ca9b22b9803eb14e1dee6bb6f55592f7e95e9c0..cd6c7e21b32873bbb16855a13ad3751cccc40598 100644 --- a/src/plugins/debugger/watchutils.cpp +++ b/src/plugins/debugger/watchutils.cpp @@ -337,6 +337,17 @@ bool isIntOrFloatType(const QString &type) return isIntType(type) || types.contains(type); } +GuessChildrenResult guessChildren(const QString &type) +{ + if (isIntOrFloatType(type)) + return HasNoChildren; + if (isPointerType(type)) + return HasChildren; + if (type.endsWith(QLatin1String("QString"))) + return HasNoChildren; + return HasPossiblyChildren; +} + QString sizeofTypeExpression(const QString &type) { if (type.endsWith(QLatin1Char('*'))) diff --git a/src/plugins/debugger/watchutils.h b/src/plugins/debugger/watchutils.h index 9d02ad75f89015f04e9a82d2764fce3a14d4b928..4d828bbc156d5a9a590d8674867124c0aa8e944f 100644 --- a/src/plugins/debugger/watchutils.h +++ b/src/plugins/debugger/watchutils.h @@ -73,6 +73,10 @@ bool extractTemplate(const QString &type, QString *tmplate, QString *inner); QString extractTypeFromPTypeOutput(const QString &str); bool isIntOrFloatType(const QString &type); bool isIntType(const QString &type); + +enum GuessChildrenResult { HasChildren, HasNoChildren, HasPossiblyChildren }; +GuessChildrenResult guessChildren(const QString &type); + QString sizeofTypeExpression(const QString &type); QString quoteUnprintableLatin1(const QByteArray &ba);