diff --git a/pcsx2-qt/Debugger/CpuWidget.cpp b/pcsx2-qt/Debugger/CpuWidget.cpp index 12bd590344..8ee097bf41 100644 --- a/pcsx2-qt/Debugger/CpuWidget.cpp +++ b/pcsx2-qt/Debugger/CpuWidget.cpp @@ -550,6 +550,7 @@ void CpuWidget::onFuncListContextMenu(QPoint pos) connect(demangleAction, &QAction::triggered, [this] { m_demangleFunctions = !m_demangleFunctions; + m_ui.disassemblyWidget->setDemangle(m_demangleFunctions); updateFunctionList(); }); diff --git a/pcsx2-qt/Debugger/CpuWidget.h b/pcsx2-qt/Debugger/CpuWidget.h index ef81034c56..771c97544b 100644 --- a/pcsx2-qt/Debugger/CpuWidget.h +++ b/pcsx2-qt/Debugger/CpuWidget.h @@ -73,6 +73,7 @@ public slots: void updateFunctionList(bool whenEmpty = false); void onFuncListContextMenu(QPoint pos); void onFuncListDoubleClick(QListWidgetItem* item); + bool getDemangleFunctions() const { return m_demangleFunctions; } void reloadCPUWidgets() { diff --git a/pcsx2-qt/Debugger/DisassemblyWidget.cpp b/pcsx2-qt/Debugger/DisassemblyWidget.cpp index da83422fa4..e3f7c2f8f3 100644 --- a/pcsx2-qt/Debugger/DisassemblyWidget.cpp +++ b/pcsx2-qt/Debugger/DisassemblyWidget.cpp @@ -21,6 +21,7 @@ #include "DebugTools/DisassemblyManager.h" #include "DebugTools/Breakpoints.h" #include "DebugTools/MipsAssembler.h" +#include "demangler/demangler.h" #include "QtUtils.h" #include "QtHost.h" @@ -699,6 +700,8 @@ inline QString DisassemblyWidget::DisassemblyStringFromAddress(u32 address, QFon const bool isBreakpoint = CBreakPoints::IsAddressBreakPoint(m_cpu->getCpuType(), address) && !CBreakPoints::IsTempBreakPoint(m_cpu->getCpuType(), address); const std::string addressSymbol = m_cpu->GetSymbolMap().GetLabelString(address); + const auto demangler = demangler::CDemangler::createGcc(); + QString lineString("%1 %2 %3 %4 %5 %6"); lineString = lineString.arg(isBreakpoint ? "\u25A0" : " "); // Bp block ( ■ ) @@ -708,7 +711,7 @@ inline QString DisassemblyWidget::DisassemblyStringFromAddress(u32 address, QFon { // We want this text elided QFontMetrics metric(font); - lineString = lineString.arg(metric.elidedText(QString::fromStdString(addressSymbol), Qt::ElideRight, (selected ? 32 : 8) * font.pointSize())); + lineString = lineString.arg(metric.elidedText(QString::fromStdString((m_demangleFunctions ? demangler->demangleToString(addressSymbol) : addressSymbol)), Qt::ElideRight, (selected ? 32 : 8) * font.pointSize())); } lineString = lineString.leftJustified(4, ' ') // Address / symbol diff --git a/pcsx2-qt/Debugger/DisassemblyWidget.h b/pcsx2-qt/Debugger/DisassemblyWidget.h index 0b7a83f73d..a238c84ec0 100644 --- a/pcsx2-qt/Debugger/DisassemblyWidget.h +++ b/pcsx2-qt/Debugger/DisassemblyWidget.h @@ -70,6 +70,7 @@ public slots: void gotoAddress(u32 address); + void setDemangle(bool demangle) { m_demangleFunctions = demangle; }; signals: void gotoInMemory(u32 address); void breakpointsChanged(); @@ -88,6 +89,8 @@ private: std::map m_nopedInstructions; std::map> m_stubbedFunctions; + bool m_demangleFunctions = true; + DisassemblyManager m_disassemblyManager; inline QString DisassemblyStringFromAddress(u32 address, QFont font, u32 pc, bool selected);