diff --git a/src/models/disassemblymodel.cpp b/src/models/disassemblymodel.cpp index 5daec8d4..a1f458d1 100644 --- a/src/models/disassemblymodel.cpp +++ b/src/models/disassemblymodel.cpp @@ -132,8 +132,17 @@ QVariant DisassemblyModel::data(const QModelIndex& index, int role) const auto it = entry.offsetMap.find(data.addr); if (it != entry.offsetMap.end()) { const auto event = index.column() - COLUMN_COUNT; - const auto& locationCost = it.value(); + + if (role == Qt::ToolTipRole) { + auto tooltip = tr("addr: %1
assembly: %2
disassembly: %3") + .arg(QString::number(data.addr, 16), line); + return Util::formatTooltip(tooltip, locationCost, m_results.selfCosts); + } + + if (event < 0) + return {}; + const auto& costLine = locationCost.selfCost[event]; const auto totalCost = m_results.selfCosts.totalCost(event); @@ -141,19 +150,13 @@ QVariant DisassemblyModel::data(const QModelIndex& index, int role) const return costLine; } else if (role == TotalCostRole) { return totalCost; - } else if (role == Qt::ToolTipRole) { - auto tooltip = tr("addr: %1
assembly: %2
disassembly: %3") - .arg(QString::number(data.addr, 16), line); - return Util::formatTooltip(tooltip, locationCost, m_results.selfCosts); - } - - if (!costLine) + } else if (!costLine) return {}; return Util::formatCostRelative(costLine, totalCost, true); } else { - if (role == Qt::ToolTipRole) + if (role == Qt::ToolTipRole) { return tr("%1
No samples at this location.
").arg(line.toHtmlEscaped()); - else + } else return QString(); } } else if (role == DisassemblyModel::HighlightRole) { diff --git a/src/models/disassemblymodel.h b/src/models/disassemblymodel.h index 7c65a546..2cba0ad9 100644 --- a/src/models/disassemblymodel.h +++ b/src/models/disassemblymodel.h @@ -8,7 +8,6 @@ #pragma once -#include #include #include diff --git a/src/models/highlightedtext.cpp b/src/models/highlightedtext.cpp index aabf2439..27766778 100644 --- a/src/models/highlightedtext.cpp +++ b/src/models/highlightedtext.cpp @@ -331,7 +331,7 @@ void HighlightedText::setText(const QStringList& text) updateTabWidth(m_tabWidth); m_cleanedLines = text; - std::for_each(m_cleanedLines.begin(), m_cleanedLines.end(), Util::removeAnsi); + std::transform(m_cleanedLines.begin(), m_cleanedLines.end(), m_cleanedLines.begin(), Util::removeAnsi); } void HighlightedText::setDefinition(const KSyntaxHighlighting::Definition& definition) diff --git a/src/unwindsettingspage.ui b/src/unwindsettingspage.ui index 5c044135..4789d242 100644 --- a/src/unwindsettingspage.ui +++ b/src/unwindsettingspage.ui @@ -6,7 +6,7 @@ 0 0 - 556 + 564 656 @@ -22,6 +22,9 @@ Path to the sysroot. Leave empty to use the local machine. + + KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly + local machine