From 5c23ab8c2dd3aca246e7754fc8e9023ae71d3bed Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 28 May 2024 11:14:43 +0200 Subject: [PATCH 1/4] Cdbbridge: report dumptime of fetchVariables Change-Id: I866fd5dbf547a4d6ec1ab9806080419735131d19 Reviewed-by: hjk --- share/qtcreator/debugger/cdbbridge.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/qtcreator/debugger/cdbbridge.py b/share/qtcreator/debugger/cdbbridge.py index b5fc683cbae..7fdd057bb11 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())))) @@ -443,6 +444,7 @@ class Dumper(DumperBase): self.put('{name="%s",value="",type="",numchild="0"},' % msg) def fetchVariables(self, args): + start_time = time.perf_counter() self.resetStats() (ok, res) = self.tryFetchInterpreterVariables(args) if ok: @@ -476,6 +478,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 = [] From 1c2fbaa84631196c30cd6801d7e70e6c673a2ba5 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 28 May 2024 11:40:59 +0200 Subject: [PATCH 2/4] Debugger: track variable fetch time in dumper tests for cdb Change-Id: I85073edc2e3660e2bfaff32f53e4a2f98f03c514 Reviewed-by: hjk --- tests/auto/debugger/tst_dumpers.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 55ae944ef69..14c0e3500ab 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -1931,6 +1931,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"]; } From a1727a9d6d718bc312f011a8ab66930a519204e2 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 31 May 2024 13:46:46 +0200 Subject: [PATCH 3/4] Debugger: fix compiling dumper tests Change-Id: Ic06483bfeee376e9cc3e7beb516b9bde9cb5b46d Reviewed-by: hjk --- tests/auto/debugger/tst_dumpers.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 14c0e3500ab..d8ed605f822 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -1171,6 +1171,7 @@ private: bool m_isQnxGdb = false; bool m_useGLibCxxDebug = false; int m_totalDumpTime = 0; + int m_totalInnerTime = 0; }; void tst_Dumpers::initTestCase() @@ -1344,6 +1345,8 @@ void tst_Dumpers::cleanup() void tst_Dumpers::cleanupTestCase() { qCDebug(lcDumpers) << "Dumpers total: " << QTime::fromMSecsSinceStartOfDay(m_totalDumpTime); + qCDebug(lcDumpers, "TotalOuter: %5d", m_totalDumpTime); + qCDebug(lcDumpers, "TotalInner: %5d", m_totalInnerTime); } void tst_Dumpers::dumper() @@ -1890,6 +1893,9 @@ void tst_Dumpers::dumper() actual.fromStringMultiple(QString::fromLocal8Bit(contents)); context.nameSpace = actual["qtnamespace"].data(); + int runtime = actual["runtime"].data().toFloat() * 1000; + qCDebug(lcDumpers, "CaseInner: %5d", runtime); + m_totalInnerTime += runtime; actual = actual["data"]; //qCDebug(lcDumpers) << "FOUND NS: " << context.nameSpace; @@ -1914,6 +1920,9 @@ void tst_Dumpers::dumper() context.nameSpace.clear(); contents.replace("\\\"", "\""); actual.fromString(QString::fromLocal8Bit(contents)); + int runtime = actual["runtime"].data().toFloat() * 1000; + qCDebug(lcDumpers, "CaseInner: %5d", runtime); + m_totalInnerTime += runtime; } else { QByteArray localsAnswerStart("|R|42|"); QByteArray locals("|script|"); From 2ce6255a7d4fd33e54139a9615b3037e83587887 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Fri, 31 May 2024 12:19:02 +0200 Subject: [PATCH 4/4] CMakePM: Do not check the existence of dlls for PATH handling In order to fix QTCREATORBUG-29662 the check of existence of an dll was a prerequisite to add the path to the PATH environment variable. As it turns out this is not an easy thing to do, since the ".lib" file name can be different than the ".dll" file name. Also for MinGW you can have ".dll.a" or ".a" as library filename extensions. You can also have a "lib" as prefix for the library filename. Amends 0d8a542b4f7d8a7b4d27f42ff16d309fba6cbf22 Amends 8713919f31f2aecc7e7c15f1fc9ce7906b8fefa0 Amends ac97ab1abf9bf073088925755a46f08f38721090 Task-number: QTCREATORBUG-29662 Fixes: QTCREATORBUG-30827 Fixes: QTCREATORBUG-30932 Change-Id: I90afad825d43fd4f801c2aac20ed98f013861152 Reviewed-by: Alessandro Portale --- .../fileapidataextractor.cpp | 42 ++++++------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index f1d3cee4ee3..66748345ced 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; }