Exclude unresolved functions from recursion detection.
authorMilian Wolff <mail@milianw.de>
Sun, 26 Feb 2017 21:05:20 +0000 (22:05 +0100)
committerMilian Wolff <mail@milianw.de>
Sun, 26 Feb 2017 21:05:20 +0000 (22:05 +0100)
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
src/analyze/gui/locationdata.h
src/analyze/gui/parser.cpp

index 55088a5..144b9ed 100644 (file)
@@ -271,7 +271,9 @@ void toGraphicsItems(const QVector<RowData>& 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);
index d9d3ac5..235fc37 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <boost/functional/hash.hpp>
 
+#include <KLocalizedString>
+
 struct LocationData
 {
     using Ptr = std::shared_ptr<LocationData>;
@@ -58,6 +60,11 @@ struct LocationData
 Q_DECLARE_TYPEINFO(LocationData, Q_MOVABLE_TYPE);
 Q_DECLARE_METATYPE(LocationData::Ptr)
 
+inline QString unresolvedFunctionName()
+{
+    return i18n("<unresolved function>");
+}
+
 inline bool operator<(const LocationData::Ptr& lhs, const LocationData& rhs)
 {
     return *lhs < rhs;
index 0be0d68..a8f1f5d 100644 (file)
@@ -43,7 +43,7 @@ struct StringCache
             // TODO: support removal of template arguments
             return stringify(ip.functionIndex);
         } else {
-            return i18n("<unresolved function>");
+            return unresolvedFunctionName();
         }
     }