forked from qt-creator/qt-creator
Debugger: Improve initialization time
* Avoid QFileInfo where not needed * Use a more accurate filter for QDir::entryList() * Remove duplicate paths * Set filters and filter types only once. Reduces startup time by ~3% Change-Id: I8896c08da5281e06672b7bdf6e8305ea394122a3 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -227,7 +227,7 @@ void DebuggerItemManager::autoDetectGdbOrLldbDebuggers()
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QFileInfoList suspects;
|
QList<FileName> suspects;
|
||||||
|
|
||||||
if (HostOsInfo::isMacHost()) {
|
if (HostOsInfo::isMacHost()) {
|
||||||
QProcess lldbInfo;
|
QProcess lldbInfo;
|
||||||
@@ -238,32 +238,35 @@ void DebuggerItemManager::autoDetectGdbOrLldbDebuggers()
|
|||||||
lldbInfo.waitForFinished();
|
lldbInfo.waitForFinished();
|
||||||
} else {
|
} else {
|
||||||
QByteArray lPath = lldbInfo.readAll();
|
QByteArray lPath = lldbInfo.readAll();
|
||||||
suspects.append(QFileInfo(QString::fromLocal8Bit(lPath.data(), lPath.size() -1)));
|
const QFileInfo fi(QString::fromLocal8Bit(lPath.data(), lPath.size() -1));
|
||||||
|
if (fi.exists() && fi.isExecutable() && !fi.isDir())
|
||||||
|
suspects.append(FileName::fromString(fi.absoluteFilePath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList path = Environment::systemEnvironment().path();
|
QStringList path = Environment::systemEnvironment().path();
|
||||||
|
path.removeDuplicates();
|
||||||
|
QDir dir;
|
||||||
|
dir.setNameFilters(filters);
|
||||||
|
dir.setFilter(QDir::Files | QDir::Executable);
|
||||||
foreach (const QString &base, path) {
|
foreach (const QString &base, path) {
|
||||||
QDir dir(base);
|
dir.setPath(base);
|
||||||
dir.setNameFilters(filters);
|
foreach (const QString &entry, dir.entryList())
|
||||||
suspects += dir.entryInfoList();
|
suspects.append(FileName::fromString(dir.absoluteFilePath(entry)));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const QFileInfo &fi, suspects) {
|
foreach (const FileName &command, suspects) {
|
||||||
if (fi.exists() && fi.isExecutable() && !fi.isDir()) {
|
if (findByCommand(command))
|
||||||
FileName command = FileName::fromString(fi.absoluteFilePath());
|
continue;
|
||||||
if (findByCommand(command))
|
DebuggerItem item;
|
||||||
continue;
|
item.createId();
|
||||||
DebuggerItem item;
|
item.setCommand(command);
|
||||||
item.createId();
|
item.reinitializeFromFile();
|
||||||
item.setCommand(command);
|
//: %1: Debugger engine type (GDB, LLDB, CDB...), %2: Path
|
||||||
item.reinitializeFromFile();
|
item.setDisplayName(tr("System %1 at %2")
|
||||||
//: %1: Debugger engine type (GDB, LLDB, CDB...), %2: Path
|
.arg(item.engineTypeName()).arg(command.toUserOutput()));
|
||||||
item.setDisplayName(tr("System %1 at %2")
|
item.setAutoDetected(true);
|
||||||
.arg(item.engineTypeName()).arg(QDir::toNativeSeparators(fi.absoluteFilePath())));
|
addDebugger(item);
|
||||||
item.setAutoDetected(true);
|
|
||||||
addDebugger(item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user