Commit 93f22419 authored by David Schulz's avatar David Schulz

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: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 4072172d
...@@ -666,11 +666,23 @@ const QtInfo &QtInfo::get(const SymbolGroupValueContext &ctx) ...@@ -666,11 +666,23 @@ const QtInfo &QtInfo::get(const SymbolGroupValueContext &ctx)
modulePattern != total; ++modulePattern) { modulePattern != total; ++modulePattern) {
const std::string pattern = *modulePattern + qstrdupSymbol; const std::string pattern = *modulePattern + qstrdupSymbol;
const StringList &allMatches = SymbolGroupValue::resolveSymbolName(pattern.c_str(), ctx); 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())); : 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; continue;
qualifiedSymbol = *match; }
exclPos = qualifiedSymbol.find('!'); // Resolved: 'QtCored4!qstrdup' exclPos = qualifiedSymbol.find('!'); // Resolved: 'QtCored4!qstrdup'
libPos = qualifiedSymbol.find("Core"); libPos = qualifiedSymbol.find("Core");
if (exclPos != std::string::npos && libPos != std::string::npos) if (exclPos != std::string::npos && libPos != std::string::npos)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment