From 93f22419b33c931b5fa4c458c20e230d9f384d7d Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 3 Mar 2015 08:16:18 +0100 Subject: [PATCH] CdbExtension: Fix qt version lookup for builds with a libinfix. Explicitly check for "Core" in the qualified symbol name when using wildcards. Change-Id: I63c1d2cc71b20457b2ed298c5f0161ddd0bf8e1c Reviewed-by: Christian Stenger --- src/libs/qtcreatorcdbext/symbolgroupvalue.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp index 3fb27917e7..b08eacd1f6 100644 --- a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp @@ -666,11 +666,23 @@ const QtInfo &QtInfo::get(const SymbolGroupValueContext &ctx) modulePattern != total; ++modulePattern) { const std::string pattern = *modulePattern + qstrdupSymbol; const StringList &allMatches = SymbolGroupValue::resolveSymbolName(pattern.c_str(), ctx); - const StringListConstIt match = *modulePattern == "*" ? allMatches.begin() + const bool wildcardPattern = *modulePattern == "*"; + const StringListConstIt match = wildcardPattern + ? std::find_if(allMatches.begin(), allMatches.end(), SubStringPredicate("Core")) : std::find_if(allMatches.begin(), allMatches.end(), SubStringPredicate(modulePattern->c_str())); - if (match == allMatches.end()) + + if (match != allMatches.end()) { + qualifiedSymbol = *match; + } else if (wildcardPattern && !allMatches.empty()) { + // Use the first qstrdup symbol if there is no Core in all available qstrdup symbols + // This is useful when qt is statically linked. + qualifiedSymbol = *allMatches.begin(); + } else { + // If we haven't found a match and this isn't the wildcard pattern we continue + // we could still find a dynamic qt library with a libinfix continue; - qualifiedSymbol = *match; + } + exclPos = qualifiedSymbol.find('!'); // Resolved: 'QtCored4!qstrdup' libPos = qualifiedSymbol.find("Core"); if (exclPos != std::string::npos && libPos != std::string::npos) -- GitLab