diff --git a/share/qtcreator/debugger/cdbbridge.py b/share/qtcreator/debugger/cdbbridge.py index 4ac053eb559..c16467915a0 100644 --- a/share/qtcreator/debugger/cdbbridge.py +++ b/share/qtcreator/debugger/cdbbridge.py @@ -7,6 +7,7 @@ import sys import cdbext import re import threading +import time from utils import TypeCode sys.path.insert(1, os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))) @@ -421,6 +422,7 @@ class Dumper(DumperBase): return ptr def fetchVariables(self, args): + start_time = time.perf_counter() self.resetStats() (ok, res) = self.tryFetchInterpreterVariables(args) if ok: @@ -458,6 +460,8 @@ class Dumper(DumperBase): self.put(',qtnamespace="%s"' % self.qtNamespaceToReport) self.qtNamespaceToReport = None + runtime = time.perf_counter() - start_time + self.put(',runtime="%s"' % runtime) self.reportResult(''.join(self.output), args) self.output = [] diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index 777bb0e46cb..59e893569e6 100644 --- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp +++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp @@ -210,9 +210,11 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t, const FilePath &sourceDirectory, const FilePath &buildDirectory, bool relativeLibs, - const QSet &artifacts) + const QSet &sharedLibraryArtifacts) { const FilePath currentBuildDir = buildDirectory.resolvePath(t.buildDir); + const QSet sharedLibraryArtifactsPaths + = transform(sharedLibraryArtifacts, &FilePath::parentDir); CMakeBuildTarget ct; ct.title = t.name; @@ -306,7 +308,6 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t, if (f.role == "libraries") tmp = tmp.parentDir(); - std::optional dllName; if (buildDir.osType() == OsTypeWindows && (f.role == "libraries")) { const auto partAsFilePath = FilePath::fromUserInput(part); part = partAsFilePath.fileName(); @@ -314,24 +315,6 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t, // Skip object libraries on Windows. This case can happen with static qml plugins if (part.endsWith(".obj") || part.endsWith(".o")) continue; - - // Only consider dlls, not static libraries - for (const QString &suffix : - {QString(".lib"), QString(".dll.a"), QString(".a")}) { - if (part.endsWith(suffix) && !dllName) - dllName = part.chopped(suffix.length()).append(".dll"); - } - - // MinGW has libQt6Core.a -> Qt6Core.dll - // but libFoo.dll.a was already handled above - const QString mingwPrefix("lib"); - const QString mingwSuffix("a"); - const QString completeSuffix = partAsFilePath.completeSuffix(); - if (part.startsWith(mingwPrefix) && completeSuffix == mingwSuffix) { - dllName = part.chopped(mingwSuffix.length() + 1/*the '.'*/) - .sliced(mingwPrefix.length()) - .append(".dll"); - } } if (!tmp.isEmpty() && tmp.isDir()) { @@ -345,18 +328,15 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t, {"/lib", "/lib64", "/usr/lib", "/usr/lib64", "/usr/local/lib"})) librarySeachPaths.append(tmp); - if (buildDir.osType() == OsTypeWindows && dllName) { - const auto validPath = [&artifacts](const FilePath& path) { - return path.exists() || artifacts.contains(path); - }; - if (validPath(tmp.pathAppended(*dllName))) + if (buildDir.osType() == OsTypeWindows) { + if (sharedLibraryArtifactsPaths.contains(tmp)) librarySeachPaths.append(tmp); // Libraries often have their import libs in ../lib and the // actual dll files in ../bin on windows. Qt is one example of that. if (tmp.fileName() == "lib") { const FilePath path = tmp.parentDir().pathAppended("bin"); - if (path.isDir() && validPath(path.pathAppended(*dllName))) + if (path.isDir()) librarySeachPaths.append(path); } } @@ -375,17 +355,19 @@ static QList generateBuildTargets(const QFuture &cancelF const FilePath &buildDirectory, bool relativeLibs) { - QSet artifacts; + QSet sharedLibraryArtifacts; for (const TargetDetails &t : input.targetDetails) - for (const FilePath &p: t.artifacts) - artifacts.insert(buildDirectory.resolvePath(p)); + if (t.type == "MODULE_LIBRARY" || t.type == "SHARED_LIBRARY") + for (const FilePath &p : t.artifacts) + sharedLibraryArtifacts.insert(buildDirectory.resolvePath(p)); QList result; result.reserve(input.targetDetails.size()); for (const TargetDetails &t : input.targetDetails) { if (cancelFuture.isCanceled()) return {}; - result.append(toBuildTarget(t, sourceDirectory, buildDirectory, relativeLibs, artifacts)); + result.append( + toBuildTarget(t, sourceDirectory, buildDirectory, relativeLibs, sharedLibraryArtifacts)); } return result; } diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 4385f84084f..8e5109eee5c 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -1949,6 +1949,9 @@ void tst_Dumpers::dumper() } while (localsBeginPos != -1); actual.fromString(QString::fromLocal8Bit(contents)); context.nameSpace = actual["result"]["qtnamespace"].data(); + int runtime = actual["result"]["runtime"].data().toFloat() * 1000; + qCDebug(lcDumpers, "CaseInner: %5d", runtime); + m_totalInnerTime += runtime; actual = actual["result"]["data"]; }