diff options
author | The Qt Project <gerrit-noreply@qt-project.org> | 2022-12-05 12:11:02 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2022-12-05 12:11:02 +0000 |
commit | a4b06facbdeb370c4fcf721eca266fca19e4fe59 (patch) | |
tree | 24e30ce4b12020e269665cbbf51fedc950a7cfc4 | |
parent | e43d0f5d2635c941801abea923ce8764f360c63d (diff) | |
parent | 81264ab29db302a1e2393f3be664de2c6991726d (diff) |
Merge "Merge remote-tracking branch 'origin/9.0'"
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | app/perfsymboltable.cpp | 9 | ||||
-rw-r--r-- | app/perfsymboltable.h | 3 | ||||
-rw-r--r-- | tests/auto/finddebugsym/tst_finddebugsym.cpp | 5 | ||||
-rw-r--r-- | tests/auto/perfdata/tst_perfdata.cpp | 6 |
5 files changed, 14 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0684030..c7f3ad6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,5 +26,6 @@ include(CheckSymbolExists) set(CMAKE_REQUIRED_LIBRARIES elfutils::dw elfutils::elf) check_symbol_exists(dwfl_get_debuginfod_client "libdwfl.h" HAVE_DWFL_GET_DEBUGINFOD_CLIENT) +add_definitions(-DQT_USE_QSTRINGBUILDER) add_subdirectory(app) add_subdirectory(tests) diff --git a/app/perfsymboltable.cpp b/app/perfsymboltable.cpp index 0073fa2..203c0c4 100644 --- a/app/perfsymboltable.cpp +++ b/app/perfsymboltable.cpp @@ -344,8 +344,9 @@ Dwfl_Module *PerfSymbolTable::module(quint64 addr, const PerfElfMap::ElfInfo &el return reportElf(elf); } -static QFileInfo findDebugInfoFile(const QString &root, const QString &file, - const QString &debugLinkString) +QFileInfo PerfSymbolTable::findDebugInfoFile( + const QString &root, const QString &file, + const QString &debugLinkString) { auto dir = QFileInfo(root).dir(); const auto folder = QFileInfo(file).path(); @@ -367,12 +368,12 @@ static QFileInfo findDebugInfoFile(const QString &root, const QString &file, // try again in /usr/lib/debug folder // some distros use for example /usr/lib/debug/lib (ubuntu) and some use /usr/lib/debug/usr/lib (fedora) - const auto usr = QDir::separator() + QLatin1String("usr") + QDir::separator(); + const auto usr = QString(QDir::separator() + QLatin1String("usr") + QDir::separator()); auto folderWithoutUsr = folder; folderWithoutUsr.replace(usr, QDir::separator()); // make sure both (/usr/ and /) are searched - for (const auto& path : {folderWithoutUsr, usr + folderWithoutUsr}) { + for (const auto& path : {folderWithoutUsr, QString(usr + folderWithoutUsr)}) { debugLinkFile.setFile(dir.path() + QDir::separator() + QLatin1String("usr") + QDir::separator() + QLatin1String("lib") + QDir::separator() + QLatin1String("debug") + QDir::separator() + path + QDir::separator() + debugLinkString); diff --git a/app/perfsymboltable.h b/app/perfsymboltable.h index bb78258..ea09c28 100644 --- a/app/perfsymboltable.h +++ b/app/perfsymboltable.h @@ -44,6 +44,9 @@ public: PerfSymbolTable(qint32 pid, Dwfl_Callbacks *callbacks, PerfUnwind *parent); ~PerfSymbolTable(); + static QFileInfo findDebugInfoFile( + const QString& root, const QString& file, const QString& debugLinkString); + struct PerfMapSymbol { PerfMapSymbol(quint64 start = 0, quint64 length = 0, const QByteArray &name = QByteArray()) : start(start), length(length), name(name) {} diff --git a/tests/auto/finddebugsym/tst_finddebugsym.cpp b/tests/auto/finddebugsym/tst_finddebugsym.cpp index c298749..fb45852 100644 --- a/tests/auto/finddebugsym/tst_finddebugsym.cpp +++ b/tests/auto/finddebugsym/tst_finddebugsym.cpp @@ -29,8 +29,6 @@ #include "perfsymboltable.h" -QFileInfo findDebugInfoFile(const QString& root, const QString& file, const QString& debugLinkString); - class TestFindDebugSymbols : public QObject { Q_OBJECT @@ -86,7 +84,8 @@ private slots: QFETCH(QString, file); QFETCH(QString, debugLinkString); - auto debugFile = findDebugInfoFile(tempDir.path() + QDir::separator(), root, file); + auto debugFile = PerfSymbolTable::findDebugInfoFile( + tempDir.path() + QDir::separator(), root, file); QCOMPARE(debugFile.absoluteFilePath(), QFileInfo(tempDir.path() + debugLinkString).absoluteFilePath()); } diff --git a/tests/auto/perfdata/tst_perfdata.cpp b/tests/auto/perfdata/tst_perfdata.cpp index cec1ea7..caa20e3 100644 --- a/tests/auto/perfdata/tst_perfdata.cpp +++ b/tests/auto/perfdata/tst_perfdata.cpp @@ -282,9 +282,9 @@ void TestPerfData::testFiles() const auto perfDataFile = QFINDTESTDATA(dataFile); QVERIFY(!perfDataFile.isEmpty() && QFile::exists(perfDataFile)); - const auto expectedOutputFileCompressed = perfDataFile + ".expected.txt.zlib"; - const auto expectedOutputFileUncompressed = perfDataFile + ".expected.txt"; - const auto actualOutputFile = perfDataFile + ".actual.txt"; + const auto expectedOutputFileCompressed = QString(perfDataFile + ".expected.txt.zlib"); + const auto expectedOutputFileUncompressed = QString(perfDataFile + ".expected.txt"); + const auto actualOutputFile = QString(perfDataFile + ".actual.txt"); QBuffer output; QVERIFY(output.open(QIODevice::WriteOnly)); |