Debugger[CDB]: Prompt to set up the Symbol server.

Prompt to set up the public symbol server unless
it is already configured or the environment
variable exists. Change the dialog to be
based on the PathChooser to be able to suggest
a non-existent directory.
Acked-by: Alessandro Portale <alessandro.portale@nokia.com>
This commit is contained in:
Friedemann Kleint
2010-05-14 11:06:33 +02:00
parent e5401e941c
commit 709cb2946b
6 changed files with 201 additions and 7 deletions

View File

@@ -50,6 +50,11 @@ CdbOptions::CdbOptions() :
{
}
QString CdbOptions::settingsGroup()
{
return QLatin1String(settingsGroupC);
}
void CdbOptions::clear()
{
enabled = false;
@@ -99,5 +104,37 @@ unsigned CdbOptions::compare(const CdbOptions &rhs) const
return rc;
}
static const char symbolServerPrefixC[] = "symsrv*symsrv.dll*";
static const char symbolServerPostfixC[] = "*http://msdl.microsoft.com/download/symbols";
QString CdbOptions::symbolServerPath(const QString &cacheDir)
{
QString s = QLatin1String(symbolServerPrefixC);
s += QDir::toNativeSeparators(cacheDir);
s += QLatin1String(symbolServerPostfixC);
return s;
}
bool CdbOptions::isSymbolServerPath(const QString &path, QString *cacheDir /* = 0 */)
{
// Split apart symbol server post/prefixes
if (!path.startsWith(QLatin1String(symbolServerPrefixC)) || !path.endsWith(QLatin1String(symbolServerPostfixC)))
return false;
if (cacheDir) {
const unsigned prefixLength = qstrlen(symbolServerPrefixC);
*cacheDir = path.mid(prefixLength, path.size() - prefixLength - qstrlen(symbolServerPostfixC));
}
return true;
}
int CdbOptions::indexOfSymbolServerPath(const QStringList &paths, QString *cacheDir /* = 0 */)
{
const int count = paths.size();
for (int i = 0; i < count; i++)
if (CdbOptions::isSymbolServerPath(paths.at(i), cacheDir))
return i;
return -1;
}
} // namespace Internal
} // namespace Debugger