Debugger: Move cdbsymbolpathlisteditor to shared for new CDB engine.

This commit is contained in:
Friedemann Kleint
2010-11-09 12:40:36 +01:00
parent 5f75e5979e
commit 55ab8742e2
6 changed files with 55 additions and 32 deletions

View File

@@ -29,6 +29,7 @@
#include "cdboptions.h"
#include "coreengine.h"
#include "cdbsymbolpathlisteditor.h"
#include <QtCore/QSettings>
#include <QtCore/QDir>
@@ -117,36 +118,14 @@ 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;
return CdbSymbolPathListEditor::symbolServerPath(cacheDir);
}
bool CdbOptions::isSymbolServerPath(const QString &path, QString *cacheDir /* = 0 */)
int CdbOptions::indexOfSymbolServerPath(const QStringList &symbolPaths, QString *cacheDir)
{
// 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;
return CdbSymbolPathListEditor::indexOfSymbolServerPath(symbolPaths, cacheDir);
}
} // namespace Internal