Skip to content

Commit

Permalink
Don't try to unbreak non-broken feature data
Browse files Browse the repository at this point in the history
Apparently android's simpleperf doesn't contain the HOSTNAME feature.
Yet the data is still valid - trying to unbreak it would actually
break it for real.

Fixes: KDAB/hotspot#224
Change-Id: I0ed694a79fc731728edee8f6e2e3ba52717e2ea4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
  • Loading branch information
milianw committed Jun 12, 2020
1 parent ba3ed70 commit 02922fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/perfheader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ void PerfHeader::read()
for (uint i = 0; i < featureParts; ++i)
stream >> m_features[i];

if (m_magic == s_magicSwitched && !hasFeature(HOSTNAME)) {
if (m_magic == s_magicSwitched && !hasFeature(HOSTNAME) && !hasFeature(CMDLINE)) {

quint32 *features32 = reinterpret_cast<quint32 *>(&m_features[0]);
for (uint i = 0; i < featureParts; ++i)
qSwap(features32[i * 2], features32[i * 2 + 1]);

if (!hasFeature(HOSTNAME)) {
if (!hasFeature(HOSTNAME) && !hasFeature(CMDLINE)) {
// It borked: blank it all
qWarning() << "bad feature data:" << m_features;
for (uint i = 0; i < featureParts; ++i)
Expand Down

0 comments on commit 02922fc

Please sign in to comment.