summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2017-04-13 12:04:46 +0200
committerMilian Wolff <milian.wolff@kdab.com>2017-04-13 13:42:27 +0000
commitb050d18a02969cc978f1555e39f33435952cd3f3 (patch)
treecd4c97c35f6ff2624e5b6f233f0a1afc640d76a2
parent6c7ec604e523b6adf59ee3108e5d013a7160d77f (diff)
Support the old ~/.debug directory format
Only newer perf tools will write the debug file to the location `~/.debug/<buildid>/elf`. Older tools instead will write the debug file directly to a file called `~/.debug/<buildid>`. Change-Id: I4d7e24e5774c2d6888cf74a51ec40275647da8f9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r--app/perfsymboltable.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/app/perfsymboltable.cpp b/app/perfsymboltable.cpp
index c268426..69abe38 100644
--- a/app/perfsymboltable.cpp
+++ b/app/perfsymboltable.cpp
@@ -170,6 +170,19 @@ static bool findInExtraPath(QFileInfo &path, const QString &fileName)
return false;
}
+static bool findBuildIdPath(QFileInfo &path, const QString &fileName)
+{
+ path.setFile(path.absoluteFilePath() + QDir::separator() + fileName);
+ if (path.isFile())
+ return true;
+
+ path.setFile(path.absoluteFilePath() + QDir::separator() + QLatin1String("elf"));
+ if (path.isFile())
+ return true;
+
+ return false;
+}
+
static QStringList splitPath(const QString &path)
{
return path.split(QLatin1Char(':'), QString::SkipEmptyParts);
@@ -192,10 +205,10 @@ void PerfSymbolTable::registerElf(const PerfRecordMmap &mmap, const QByteArray &
// first try to find the debug information via build id, if available
if (!buildId.isEmpty()) {
const QString buildIdPath = QString::fromUtf8(mmap.filename() + '/'
- + buildId.toHex() + "/elf");
+ + buildId.toHex());
foreach (const QString &extraPath, splitPath(debugInfoPath)) {
fullPath.setFile(extraPath);
- if (findInExtraPath(fullPath, buildIdPath)) {
+ if (findBuildIdPath(fullPath, buildIdPath)) {
found = true;
break;
}