forked from qt-creator/qt-creator
Debugger[CDB]: Add version number to QtInfo struct in ext lib.
Run in a loop over qtVersion =4,5 when detecting the Qt modules (quick detection). Add version field for later evaluation in dumpers. Reformat comments. Change-Id: Ia3005fccbb92b847a0f1feef99a53eb4c318246f Reviewed-on: http://codereview.qt.nokia.com/313 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
@@ -552,11 +552,13 @@ std::string SymbolGroupValue::pointedToSymbolName(ULONG64 address, const std::st
|
|||||||
* as 'QtCored4![namespace::]qstrdup'. In the event someone really uses a different
|
* as 'QtCored4![namespace::]qstrdup'. In the event someone really uses a different
|
||||||
* library prefix or namespaced Qt, this should be found.
|
* library prefix or namespaced Qt, this should be found.
|
||||||
* The crux is here that the underlying IDebugSymbols::StartSymbolMatch()
|
* The crux is here that the underlying IDebugSymbols::StartSymbolMatch()
|
||||||
* does not accept module wildcards (as opposed to the 'x' command where 'x QtCo*!*qstrdup'
|
* does not accept module wildcards (as opposed to the 'x' command where
|
||||||
* would be acceptable and fast). OTOH, doing a wildcard search like '*qstrdup' is
|
* 'x QtCo*!*qstrdup' would be acceptable and fast). OTOH, doing a wildcard search
|
||||||
* very slow and should be done only if there is really a different namespace or lib prefix.
|
* like '*qstrdup' is very slow and should be done only if there is really a
|
||||||
* Parameter 'modulePatternC' is used to do a search on the modules returned (due to
|
* different namespace or lib prefix.
|
||||||
* the amiguities and artifacts that appear like 'QGuid4!qstrdup'). */
|
* Parameter 'modulePatternC' is used to do a search on the modules returned
|
||||||
|
* (due to the amiguities and artifacts that appear like 'QGuid4!qstrdup'). */
|
||||||
|
|
||||||
static inline std::string resolveQtSymbol(const char *symbolC,
|
static inline std::string resolveQtSymbol(const char *symbolC,
|
||||||
const char *defaultModuleNameC,
|
const char *defaultModuleNameC,
|
||||||
const char *modulePatternC,
|
const char *modulePatternC,
|
||||||
@@ -569,19 +571,22 @@ static inline std::string resolveQtSymbol(const char *symbolC,
|
|||||||
if (debugResolveQtSymbol)
|
if (debugResolveQtSymbol)
|
||||||
DebugPrint() << ">resolveQtSymbol" << symbolC << " def=" << defaultModuleNameC << " defModName="
|
DebugPrint() << ">resolveQtSymbol" << symbolC << " def=" << defaultModuleNameC << " defModName="
|
||||||
<< defaultModuleNameC << " modPattern=" << modulePatternC;
|
<< defaultModuleNameC << " modPattern=" << modulePatternC;
|
||||||
// First try a match with the default module name 'QtCored4!qstrdup' for speed reasons
|
|
||||||
std::string defaultPattern = defaultModuleNameC;
|
|
||||||
defaultPattern.push_back('!');
|
|
||||||
defaultPattern += symbolC;
|
|
||||||
const StringList defaultMatches = SymbolGroupValue::resolveSymbolName(defaultPattern.c_str(), ctx);
|
|
||||||
if (debugResolveQtSymbol)
|
|
||||||
DebugPrint() << "resolveQtSymbol: defaultMatches=" << DebugSequence<StringListConstIt>(defaultMatches.begin(), defaultMatches.end());
|
|
||||||
const SubStringPredicate modulePattern(modulePatternC);
|
const SubStringPredicate modulePattern(modulePatternC);
|
||||||
const StringListConstIt defaultIt = std::find_if(defaultMatches.begin(), defaultMatches.end(), modulePattern);
|
// First try a match with the default module name 'QtCored4!qstrdup' for speed reasons
|
||||||
if (defaultIt != defaultMatches.end()) {
|
for (int qtVersion = 4; qtVersion < 6; qtVersion++) {
|
||||||
|
std::ostringstream str;
|
||||||
|
str << defaultModuleNameC << qtVersion << '!' << symbolC;
|
||||||
|
const std::string defaultPattern = str.str();
|
||||||
|
const StringList defaultMatches = SymbolGroupValue::resolveSymbolName(defaultPattern.c_str(), ctx);
|
||||||
if (debugResolveQtSymbol)
|
if (debugResolveQtSymbol)
|
||||||
DebugPrint() << "<resolveQtSymbol return1 " << *defaultIt;
|
DebugPrint() << "resolveQtSymbol: defaultMatches=" << qtVersion
|
||||||
return *defaultIt;
|
<< DebugSequence<StringListConstIt>(defaultMatches.begin(), defaultMatches.end());
|
||||||
|
const StringListConstIt defaultIt = std::find_if(defaultMatches.begin(), defaultMatches.end(), modulePattern);
|
||||||
|
if (defaultIt != defaultMatches.end()) {
|
||||||
|
if (debugResolveQtSymbol)
|
||||||
|
DebugPrint() << "<resolveQtSymbol return1 " << *defaultIt;
|
||||||
|
return *defaultIt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Fail, now try a search with '*qstrdup' in all modules. This might return several matches
|
// Fail, now try a search with '*qstrdup' in all modules. This might return several matches
|
||||||
// like 'QtCored4!qstrdup', 'QGuid4!qstrdup'
|
// like 'QtCored4!qstrdup', 'QGuid4!qstrdup'
|
||||||
@@ -604,10 +609,10 @@ static inline std::string resolveQtSymbol(const char *symbolC,
|
|||||||
|
|
||||||
const QtInfo &QtInfo::get(const SymbolGroupValueContext &ctx)
|
const QtInfo &QtInfo::get(const SymbolGroupValueContext &ctx)
|
||||||
{
|
{
|
||||||
static const char qtCoreDefaultModule[] = "QtCored4";
|
static const char qtCoreDefaultModule[] = "QtCored";
|
||||||
static const char qtGuiDefaultModule[] = "QtGuid4";
|
static const char qtGuiDefaultModule[] = "QtGuid";
|
||||||
static const char qtNetworkDefaultModule[] = "QtNetworkd4";
|
static const char qtNetworkDefaultModule[] = "QtNetworkd";
|
||||||
static const char qtScriptDefaultModule[] = "QtScriptd4";
|
static const char qtScriptDefaultModule[] = "QtScriptd";
|
||||||
static QtInfo rc;
|
static QtInfo rc;
|
||||||
if (!rc.coreModule.empty())
|
if (!rc.coreModule.empty())
|
||||||
return rc;
|
return rc;
|
||||||
@@ -618,14 +623,17 @@ const QtInfo &QtInfo::get(const SymbolGroupValueContext &ctx)
|
|||||||
const std::string qualifiedSymbol = resolveQtSymbol("qstrdup", qtCoreDefaultModule, "Core", ctx);
|
const std::string qualifiedSymbol = resolveQtSymbol("qstrdup", qtCoreDefaultModule, "Core", ctx);
|
||||||
const std::string::size_type exclPos = qualifiedSymbol.find('!'); // Resolved: 'QtCored4!qstrdup'
|
const std::string::size_type exclPos = qualifiedSymbol.find('!'); // Resolved: 'QtCored4!qstrdup'
|
||||||
if (exclPos == std::string::npos) {
|
if (exclPos == std::string::npos) {
|
||||||
rc.coreModule = qtCoreDefaultModule;
|
const char defaultVersion = '4';
|
||||||
rc.guiModule = qtGuiDefaultModule;
|
rc.version = 4;
|
||||||
rc.networkModule = qtNetworkDefaultModule;
|
rc.coreModule = qtCoreDefaultModule + defaultVersion;
|
||||||
rc.scriptModule = qtScriptDefaultModule;
|
rc.guiModule = qtGuiDefaultModule + defaultVersion;
|
||||||
|
rc.networkModule = qtNetworkDefaultModule + defaultVersion;
|
||||||
|
rc.scriptModule = qtScriptDefaultModule + defaultVersion;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Should be 'QtCored4!qstrdup'
|
// Should be 'QtCored4!qstrdup'
|
||||||
rc.coreModule = qualifiedSymbol.substr(0, exclPos);
|
rc.coreModule = qualifiedSymbol.substr(0, exclPos);
|
||||||
|
rc.version = qualifiedSymbol.at(exclPos - 1) - '0';
|
||||||
// Derive other module names 'QtXX<infix>d4'
|
// Derive other module names 'QtXX<infix>d4'
|
||||||
rc.guiModule = rc.coreModule;
|
rc.guiModule = rc.coreModule;
|
||||||
rc.guiModule.replace(0, 6, "QtGui");
|
rc.guiModule.replace(0, 6, "QtGui");
|
||||||
@@ -679,9 +687,11 @@ std::string QtInfo::prependModuleAndNameSpace(const std::string &type,
|
|||||||
|
|
||||||
std::ostream &operator<<(std::ostream &os, const QtInfo &i)
|
std::ostream &operator<<(std::ostream &os, const QtInfo &i)
|
||||||
{
|
{
|
||||||
os << "Qt Info: Modules '" << i.coreModule << "', '" << i.guiModule
|
os << "Qt Info: Version: " << i.version << " Modules '"
|
||||||
|
<< i.coreModule << "', '" << i.guiModule
|
||||||
<< "', Namespace='" << i.nameSpace
|
<< "', Namespace='" << i.nameSpace
|
||||||
<< "', types: " << i.qObjectType << ',' << i.qObjectPrivateType << ',' << i.qWidgetPrivateType;
|
<< "', types: " << i.qObjectType << ','
|
||||||
|
<< i.qObjectPrivateType << ',' << i.qWidgetPrivateType;
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,6 +169,8 @@ std::ostream &operator<<(std::ostream &, const SymbolGroupValue &v);
|
|||||||
|
|
||||||
struct QtInfo
|
struct QtInfo
|
||||||
{
|
{
|
||||||
|
QtInfo() : version(0) {}
|
||||||
|
|
||||||
static const QtInfo &get(const SymbolGroupValueContext &ctx);
|
static const QtInfo &get(const SymbolGroupValueContext &ctx);
|
||||||
|
|
||||||
// Prepend core module and Qt namespace. To be able to work with some
|
// Prepend core module and Qt namespace. To be able to work with some
|
||||||
@@ -188,6 +190,7 @@ struct QtInfo
|
|||||||
const std::string &module,
|
const std::string &module,
|
||||||
const std::string &nameSpace);
|
const std::string &nameSpace);
|
||||||
|
|
||||||
|
int version;
|
||||||
std::string nameSpace;
|
std::string nameSpace;
|
||||||
std::string coreModule;
|
std::string coreModule;
|
||||||
std::string guiModule;
|
std::string guiModule;
|
||||||
|
|||||||
Reference in New Issue
Block a user