summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-01-17 09:46:41 +0100
committerEike Ziller <eike.ziller@qt.io>2018-01-17 09:46:41 +0100
commitc29884b2695aacf9b94f8b8327ea40399446ab50 (patch)
treeb082ba7aef69b0e85cac45ede7b74b8856dae8e9
parent5dae29116e16f151c6faaf8ba5ae05dd9ba89c33 (diff)
parent9d72ad6ff39d37b4e275497a3b2981d8c8fa2238 (diff)
Merge remote-tracking branch 'origin/master' into 4.6
-rw-r--r--app/perftracingdata.h18
-rw-r--r--app/perfunwind.cpp5
-rw-r--r--app/perfunwind.h2
-rw-r--r--tests/auto/elfmap/tst_elfmap.cpp22
-rw-r--r--tests/auto/perfdata/tst_perfdata.cpp3
5 files changed, 27 insertions, 23 deletions
diff --git a/app/perftracingdata.h b/app/perftracingdata.h
index 4427f8d..3c83daf 100644
--- a/app/perftracingdata.h
+++ b/app/perftracingdata.h
@@ -24,16 +24,16 @@
#include <QHash>
#include <QVector>
-enum FormatFlags
+enum FormatFlags: quint32
{
- FIELD_IS_ARRAY = 1,
- FIELD_IS_POINTER = 2,
- FIELD_IS_SIGNED = 4,
- FIELD_IS_STRING = 8,
- FIELD_IS_DYNAMIC = 16,
- FIELD_IS_LONG = 32,
- FIELD_IS_FLAG = 64,
- FIELD_IS_SYMBOLIC = 128,
+ FIELD_IS_ARRAY = 1 << 0,
+ FIELD_IS_POINTER = 1 << 1,
+ FIELD_IS_SIGNED = 1 << 2,
+ FIELD_IS_STRING = 1 << 3,
+ FIELD_IS_DYNAMIC = 1 << 4,
+ FIELD_IS_LONG = 1 << 5,
+ FIELD_IS_FLAG = 1 << 6,
+ FIELD_IS_SYMBOLIC = 1 << 7,
};
struct FormatField
diff --git a/app/perfunwind.cpp b/app/perfunwind.cpp
index 0830f92..849b220 100644
--- a/app/perfunwind.cpp
+++ b/app/perfunwind.cpp
@@ -565,7 +565,10 @@ void PerfUnwind::analyze(const PerfRecordSample &sample)
const auto &attribute = m_attributes.at(attributesId);
if (attribute.type() == PerfEventAttributes::TYPE_TRACEPOINT) {
type = TracePointSample;
- eventFormatId = attribute.config();
+ if (attribute.config() > std::numeric_limits<qint32>::max())
+ qWarning() << "Excessively large event format ID" << attribute.config();
+ else
+ eventFormatId = static_cast<qint32>(attribute.config());
}
}
diff --git a/app/perfunwind.h b/app/perfunwind.h
index 36b8f22..a18d6a0 100644
--- a/app/perfunwind.h
+++ b/app/perfunwind.h
@@ -92,7 +92,7 @@ public:
UnwindInfo() : frames(0), unwind(nullptr), sample(nullptr), maxFrames(64),
firstGuessedFrame(-1), isInterworking(false) {}
- QHash<quint32, QHash<quint64, Dwarf_Word>> stackValues;
+ QHash<qint32, QHash<quint64, Dwarf_Word>> stackValues;
QVector<qint32> frames;
PerfUnwind *unwind;
const PerfRecordSample *sample;
diff --git a/tests/auto/elfmap/tst_elfmap.cpp b/tests/auto/elfmap/tst_elfmap.cpp
index 58ce323..aac377b 100644
--- a/tests/auto/elfmap/tst_elfmap.cpp
+++ b/tests/auto/elfmap/tst_elfmap.cpp
@@ -169,7 +169,7 @@ private slots:
void benchRegisterElfDisjunct()
{
- QFETCH(int, numElfMaps);
+ QFETCH(uint, numElfMaps);
const quint64 ADDR_STEP = 1024;
const quint64 MAX_ADDR = ADDR_STEP * numElfMaps;
const quint64 LEN = 1024;
@@ -183,16 +183,16 @@ private slots:
void benchRegisterElfDisjunct_data()
{
- QTest::addColumn<int>("numElfMaps");
- QTest::newRow("10") << 10;
- QTest::newRow("100") << 100;
- QTest::newRow("1000") << 1000;
- QTest::newRow("2000") << 2000;
+ QTest::addColumn<uint>("numElfMaps");
+ QTest::newRow("10") << 10u;
+ QTest::newRow("100") << 100u;
+ QTest::newRow("1000") << 1000u;
+ QTest::newRow("2000") << 2000u;
}
void benchRegisterElfOverlapping()
{
- QFETCH(int, numElfMaps);
+ QFETCH(uint, numElfMaps);
const quint64 ADDR_STEP = 1024;
const quint64 MAX_ADDR = ADDR_STEP * numElfMaps;
quint64 len = MAX_ADDR;
@@ -212,7 +212,7 @@ private slots:
void benchRegisterElfExpanding()
{
- QFETCH(int, numElfMaps);
+ QFETCH(uint, numElfMaps);
const quint64 ADDR = 0;
const quint64 LEN_STEP = 1024;
const quint64 MAX_LEN = LEN_STEP * numElfMaps;
@@ -231,7 +231,7 @@ private slots:
void benchFindElfDisjunct()
{
- QFETCH(int, numElfMaps);
+ QFETCH(uint, numElfMaps);
PerfElfMap map;
@@ -258,7 +258,7 @@ private slots:
void benchFindElfOverlapping()
{
- QFETCH(int, numElfMaps);
+ QFETCH(uint, numElfMaps);
PerfElfMap map;
@@ -285,7 +285,7 @@ private slots:
void benchFindElfExpanding()
{
- QFETCH(int, numElfMaps);
+ QFETCH(uint, numElfMaps);
PerfElfMap map;
diff --git a/tests/auto/perfdata/tst_perfdata.cpp b/tests/auto/perfdata/tst_perfdata.cpp
index e9fc85f..bf4b72c 100644
--- a/tests/auto/perfdata/tst_perfdata.cpp
+++ b/tests/auto/perfdata/tst_perfdata.cpp
@@ -164,8 +164,9 @@ void TestPerfData::testTracingData()
const PerfParserTestClient::AttributeEvent attribute
= client.attribute(sample.attributeId);
QCOMPARE(attribute.type, 2u);
+ QVERIFY(attribute.config <= std::numeric_limits<qint32>::max());
const PerfParserTestClient::TracePointFormatEvent format
- = client.tracePointFormat(attribute.config);
+ = client.tracePointFormat(static_cast<qint32>(attribute.config));
QCOMPARE(client.string(format.system), QByteArray("probe_untitled1"));
QCOMPARE(client.string(format.name), QByteArray("main"));
QCOMPARE(format.flags, 0u);