From 2062edcd10ce19efd5705a647d79daddd18b2915 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Sun, 26 Feb 2017 22:05:20 +0100 Subject: [PATCH] Exclude unresolved functions from recursion detection. Previously, when we encountered a stack with two consecutive frames with missing debug information, we thought it would indicate recursion and then collapsed all frames beneath. Now, we exclude frames with missing debug information and don't collapse the stacks anymore. --- src/analyze/gui/flamegraph.cpp | 4 +++- src/analyze/gui/locationdata.h | 7 +++++++ src/analyze/gui/parser.cpp | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/analyze/gui/flamegraph.cpp b/src/analyze/gui/flamegraph.cpp index 55088a5..144b9ed 100644 --- a/src/analyze/gui/flamegraph.cpp +++ b/src/analyze/gui/flamegraph.cpp @@ -271,7 +271,9 @@ void toGraphicsItems(const QVector& data, FrameGraphicsItem* parent, in const double costThreshold, bool collapseRecursion) { foreach (const auto& row, data) { - if (collapseRecursion && row.location->function == parent->function()) { + if (collapseRecursion && row.location->function != unresolvedFunctionName() + && row.location->function == parent->function()) + { continue; } auto item = findItemByFunction(parent->childItems(), row.location->function); diff --git a/src/analyze/gui/locationdata.h b/src/analyze/gui/locationdata.h index d9d3ac5..235fc37 100644 --- a/src/analyze/gui/locationdata.h +++ b/src/analyze/gui/locationdata.h @@ -26,6 +26,8 @@ #include +#include + struct LocationData { using Ptr = std::shared_ptr; @@ -58,6 +60,11 @@ struct LocationData Q_DECLARE_TYPEINFO(LocationData, Q_MOVABLE_TYPE); Q_DECLARE_METATYPE(LocationData::Ptr) +inline QString unresolvedFunctionName() +{ + return i18n(""); +} + inline bool operator<(const LocationData::Ptr& lhs, const LocationData& rhs) { return *lhs < rhs; diff --git a/src/analyze/gui/parser.cpp b/src/analyze/gui/parser.cpp index 0be0d68..a8f1f5d 100644 --- a/src/analyze/gui/parser.cpp +++ b/src/analyze/gui/parser.cpp @@ -43,7 +43,7 @@ struct StringCache // TODO: support removal of template arguments return stringify(ip.functionIndex); } else { - return i18n(""); + return unresolvedFunctionName(); } } -- 2.7.4