diff options
author | David Schulz <david.schulz@theqtcompany.com> | 2015-03-16 11:09:41 +0100 |
---|---|---|
committer | David Schulz <david.schulz@theqtcompany.com> | 2015-07-01 12:39:33 +0000 |
commit | f11bc8c607d3e93c3dadbc1e2f55e14925f1d873 (patch) | |
tree | 4b6c4953d6ba921c73e69d95c0800230a26af555 /src/libs/qtcreatorcdbext/symbolgroup.cpp | |
parent | 60e84fbaf4718be7cb7ebc2e8827cf6293c3958c (diff) | |
download | qt-creator-f11bc8c607d3e93c3dadbc1e2f55e14925f1d873.tar.gz |
Cdbext: Allow to watch members.
Change-Id: I185d188c8847d90a75694a680bc20488f3d0a9e6
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Diffstat (limited to 'src/libs/qtcreatorcdbext/symbolgroup.cpp')
-rw-r--r-- | src/libs/qtcreatorcdbext/symbolgroup.cpp | 67 |
1 files changed, 50 insertions, 17 deletions
diff --git a/src/libs/qtcreatorcdbext/symbolgroup.cpp b/src/libs/qtcreatorcdbext/symbolgroup.cpp index 8ca0f56640..69bf44dc93 100644 --- a/src/libs/qtcreatorcdbext/symbolgroup.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroup.cpp @@ -756,23 +756,56 @@ std::string WatchesSymbolGroup::fixWatchExpressionI(CIDebugSymbols *s, const std // Check if it matches the form std::string::size_type typeStartPos; std::string::size_type typeEndPos; - if (!parseWatchExpression(expression, &typeStartPos, &typeEndPos)) - return expression; - std::string type = expression.substr(typeStartPos, typeEndPos - typeStartPos); - trimFront(type); - trimBack(type); - // Do not qualify POD types - const KnownType kt = knownType(type, 0); - if (kt & KT_POD_Type) - return expression; - SymbolGroupValueContext ctx; - ctx.symbols = s; - const std::string resolved = SymbolGroupValue::resolveType(type, ctx); - if (resolved.empty() || resolved == type) - return expression; - std::string fixed = expression; - fixed.replace(typeStartPos, typeEndPos - typeStartPos, resolved); - return fixed; + if (parseWatchExpression(expression, &typeStartPos, &typeEndPos)) { + std::string type = expression.substr(typeStartPos, typeEndPos - typeStartPos); + trimFront(type); + trimBack(type); + // Do not qualify POD types + const KnownType kt = knownType(type, 0); + if (kt & KT_POD_Type) + return expression; + SymbolGroupValueContext ctx; + ctx.symbols = s; + const std::string resolved = SymbolGroupValue::resolveType(type, ctx); + if (resolved.empty() || resolved == type) + return expression; + std::string fixed = expression; + fixed.replace(typeStartPos, typeEndPos - typeStartPos, resolved); + return fixed; + } else { + // unify the access operator + std::string fixed; + const std::string::const_iterator end = expression.end(); + for (std::string::const_iterator pos = expression.begin(); pos != end; ++pos) { + switch (*pos) { + case '*': + case '&': + case '(': + case ')': + break; + case '-': + ++pos; + if (pos == end) { + fixed.push_back('-'); + return fixed; + } + if (*pos == '>') { + fixed.push_back('.'); + } else { + fixed.push_back('-'); + fixed.push_back(*pos); + } + break; + case '[': + fixed.push_back('.'); + // fall through + default: + fixed.push_back(*pos); + break; + } + } + return fixed; + } } // Wrapper with debug output. |