diff options
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/CodeWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Debugger/CodeWidget.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp index a04f761cee..edac7e52b9 100644 --- a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp @@ -73,6 +73,9 @@ CodeWidget::CodeWidget(QWidget* parent) connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, &CodeWidget::Update); + connect(&Settings::Instance(), &Settings::ShowDemangledNamesChanged, this, + &CodeWidget::OnShowDemangledNamesChanged); + ConnectWidgets(); m_code_splitter->restoreState( @@ -248,6 +251,16 @@ void CodeWidget::OnSetCodeAddress(u32 address) SetAddress(address, CodeViewWidget::SetAddressUpdate::WithDetailedUpdate); } +void CodeWidget::OnShowDemangledNamesChanged() +{ + UpdateSymbols(); + if (const Common::Symbol* symbol = m_ppc_symbol_db.GetSymbolFromAddr(m_code_view->GetAddress())) + { + UpdateFunctionCalls(symbol); + UpdateFunctionCallers(symbol); + } +} + void CodeWidget::OnPPCSymbolsChanged() { UpdateSymbols(); @@ -424,7 +437,7 @@ void CodeWidget::UpdateSymbols() m_symbols_list->clear(); m_ppc_symbol_db.ForEachSymbol([&](const Common::Symbol& symbol) { - QString name = QString::fromStdString(symbol.name); + QString name = QString::fromStdString(GetSymbolDisplayName(&symbol)); // If the symbol has an object name, add it to the entry name. if (!symbol.object_name.empty()) @@ -488,15 +501,16 @@ void CodeWidget::UpdateFunctionCalls(const Common::Symbol* symbol) if (call_symbol) { QString name; + const std::string& symbol_name = GetSymbolDisplayName(call_symbol); if (!call_symbol->object_name.empty()) { name = QString::fromStdString( - fmt::format("< {} ({}, {:08x})", call_symbol->name, call_symbol->object_name, addr)); + fmt::format("< {} ({}, {:08x})", symbol_name, call_symbol->object_name, addr)); } else { - name = QString::fromStdString(fmt::format("< {} ({:08x})", call_symbol->name, addr)); + name = QString::fromStdString(fmt::format("< {} ({:08x})", symbol_name, addr)); } if (!name.contains(filter, Qt::CaseInsensitive)) @@ -525,15 +539,16 @@ void CodeWidget::UpdateFunctionCallers(const Common::Symbol* symbol) if (caller_symbol) { QString name; + const std::string& symbol_name = GetSymbolDisplayName(caller_symbol); if (!caller_symbol->object_name.empty()) { - name = QString::fromStdString(fmt::format("< {} ({}, {:08x})", caller_symbol->name, - caller_symbol->object_name, addr)); + name = QString::fromStdString( + fmt::format("< {} ({}, {:08x})", symbol_name, caller_symbol->object_name, addr)); } else { - name = QString::fromStdString(fmt::format("< {} ({:08x})", caller_symbol->name, addr)); + name = QString::fromStdString(fmt::format("< {} ({:08x})", symbol_name, addr)); } if (!name.contains(filter, Qt::CaseInsensitive)) @@ -546,6 +561,14 @@ void CodeWidget::UpdateFunctionCallers(const Common::Symbol* symbol) } } +// Gets the name of this symbol based on the option for whether or not to show +// demangled names. +const std::string& CodeWidget::GetSymbolDisplayName(const Common::Symbol* symbol) const +{ + const bool show_demangled_names = Settings::Instance().IsShowDemangledNames(); + return symbol->GetDisplayName(show_demangled_names); +} + void CodeWidget::Step() { auto& cpu = m_system.GetCPU(); |
