From 95d1dcc521108dc8dd713e043f1c7dcc864c27f1 Mon Sep 17 00:00:00 2001 From: Ty Lamontagne Date: Sun, 15 Oct 2023 11:56:52 -0400 Subject: [PATCH] Debugger: Fallback to unmangled symbol when it cannot be demangled --- pcsx2-qt/Debugger/DisassemblyWidget.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/pcsx2-qt/Debugger/DisassemblyWidget.cpp b/pcsx2-qt/Debugger/DisassemblyWidget.cpp index c95ec704f5..69c19bb5dd 100644 --- a/pcsx2-qt/Debugger/DisassemblyWidget.cpp +++ b/pcsx2-qt/Debugger/DisassemblyWidget.cpp @@ -380,9 +380,9 @@ void DisassemblyWidget::paintEvent(QPaintEvent* event) // Breakpoint marker bool enabled; - if(CBreakPoints::IsAddressBreakPoint(m_cpu->getCpuType(), rowAddress, &enabled) && !CBreakPoints::IsTempBreakPoint(m_cpu->getCpuType(), rowAddress)) + if (CBreakPoints::IsAddressBreakPoint(m_cpu->getCpuType(), rowAddress, &enabled) && !CBreakPoints::IsTempBreakPoint(m_cpu->getCpuType(), rowAddress)) { - if(enabled) + if (enabled) { painter.setPen(Qt::green); painter.drawText(2, i * m_rowHeight, w, m_rowHeight, Qt::AlignLeft, "\u25A0"); @@ -725,7 +725,21 @@ inline QString DisassemblyWidget::DisassemblyStringFromAddress(u32 address, QFon { // We want this text elided QFontMetrics metric(font); - lineString = lineString.arg(metric.elidedText(QString::fromStdString((m_demangleFunctions ? demangler->demangleToString(addressSymbol) : addressSymbol)), Qt::ElideRight, (selected ? 32 : 8) * font.pointSize())); + QString symbolString; + if (m_demangleFunctions) + { + symbolString = QString::fromStdString(demangler->demangleToString(addressSymbol)); + if (symbolString.isEmpty()) + { + symbolString = QString::fromStdString(addressSymbol); + } + } + else + { + symbolString = QString::fromStdString(addressSymbol); + } + + lineString = lineString.arg(metric.elidedText(symbolString, Qt::ElideRight, (selected ? 32 : 8) * font.pointSize())); } lineString = lineString.leftJustified(4, ' ') // Address / symbol