summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2018-01-30 15:10:18 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-05-03 12:41:07 +0000
commitb5df17c04718ddc995ddf9030754253e8d4a0ca8 (patch)
treeebfc547c6c7dda2fdf08a35c5f0410ee931fc2df
parent9ba708cca62ca704b4048fb49de1431aa19fdcd7 (diff)
Support (null) as address in kallsyms
Apparently some kallsyms report the obfuscated address as (null) instead of all-zero. Handle this scenario instead of giving up parsing the file. Change-Id: I108c20d1845933a429ee5cd26217b707f6aac4cc Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
-rw-r--r--app/perfkallsyms.cpp2
-rw-r--r--tests/auto/kallsyms/tst_kallsyms.cpp10
2 files changed, 10 insertions, 2 deletions
diff --git a/app/perfkallsyms.cpp b/app/perfkallsyms.cpp
index 84b8847..1a64cbd 100644
--- a/app/perfkallsyms.cpp
+++ b/app/perfkallsyms.cpp
@@ -53,7 +53,7 @@ bool PerfKallsyms::parseMapping(const QString &path)
bool ok = false;
entry.address = address.toULongLong(&ok, 16);
- if (!ok) {
+ if (!ok && address != "(null)") {
m_errorString = tr("Invalid address: %1").arg(QString::fromUtf8(address));
valid = false;
break;
diff --git a/tests/auto/kallsyms/tst_kallsyms.cpp b/tests/auto/kallsyms/tst_kallsyms.cpp
index 97770f7..ab89096 100644
--- a/tests/auto/kallsyms/tst_kallsyms.cpp
+++ b/tests/auto/kallsyms/tst_kallsyms.cpp
@@ -67,7 +67,15 @@ private slots:
const auto kallsyms = QByteArrayLiteral("0000000000000000 A irq_stack_union");
QTest::newRow("zeros-only") << kallsyms << 0x0ull
<< 0x0ull << QByteArrayLiteral("irq_stack_union") << QByteArray();
- QTest::newRow("zeros-only") << kallsyms << std::numeric_limits<quint64>::max()
+ QTest::newRow("zeros-only2") << kallsyms << std::numeric_limits<quint64>::max()
+ << 0x0ull
+ << QByteArrayLiteral("irq_stack_union") << QByteArray();
+ }
+ {
+ const auto kallsyms = QByteArrayLiteral(" (null) A irq_stack_union");
+ QTest::newRow("null-only") << kallsyms << 0x0ull
+ << 0x0ull << QByteArrayLiteral("irq_stack_union") << QByteArray();
+ QTest::newRow("null-only2") << kallsyms << std::numeric_limits<quint64>::max()
<< 0x0ull
<< QByteArrayLiteral("irq_stack_union") << QByteArray();
}