summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-12-05 11:19:24 +0100
committerUlf Hermann <ulf.hermann@qt.io>2022-12-05 11:19:24 +0100
commit81264ab29db302a1e2393f3be664de2c6991726d (patch)
tree0d040bbdf0cbccbf807736bcd8317579bec560a1
parent1d55a6bb8e72a574002ab13eae6e80cab6783302 (diff)
parent0e9d09e73279d0e1d9052810b1aea4fcc7915a72 (diff)
Merge remote-tracking branch 'origin/9.0'
-rw-r--r--CMakeLists.txt1
-rw-r--r--app/perfsymboltable.cpp9
-rw-r--r--app/perfsymboltable.h3
-rw-r--r--tests/auto/finddebugsym/tst_finddebugsym.cpp5
-rw-r--r--tests/auto/perfdata/tst_perfdata.cpp6
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 5db94f7..f2e6298 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 769559b..422814d 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));