Implement basic auto demangling
This commit is contained in:
parent
3ab293e820
commit
016ce43787
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Core/PowerPC/CWDemangler.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
|
@ -30,6 +31,17 @@ void Symbol::Rename(const std::string& symbol_name)
|
|||
{
|
||||
this->name = symbol_name;
|
||||
this->function_name = GetStrippedFunctionName(symbol_name);
|
||||
|
||||
// Try demangling the symbol name, saving it in the symbol if valid.
|
||||
auto demangle_result = CWDemangler::demangle(symbol_name, DemangleOptions::DemangleOptions());
|
||||
if (demangle_result)
|
||||
{
|
||||
this->demangled_name = demangle_result.value();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->demangled_name.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void SymbolDB::List()
|
||||
|
|
|
@ -42,7 +42,16 @@ struct Symbol
|
|||
|
||||
void Rename(const std::string& symbol_name);
|
||||
|
||||
const std::string& GetName() const
|
||||
{
|
||||
if (!demangled_name.empty())
|
||||
return demangled_name;
|
||||
else
|
||||
return name;
|
||||
}
|
||||
|
||||
std::string name;
|
||||
std::string demangled_name; // Demangled symbol name
|
||||
std::string function_name; // stripped function name
|
||||
std::string object_name; // name of object/source file symbol belongs to
|
||||
std::vector<SCall> callers; // addresses of functions that call this function
|
||||
|
|
|
@ -377,7 +377,7 @@ void CodeWidget::UpdateSymbols()
|
|||
|
||||
for (const auto& symbol : m_ppc_symbol_db.Symbols())
|
||||
{
|
||||
QString name = QString::fromStdString(symbol.second.name);
|
||||
QString name = QString::fromStdString(symbol.second.GetName());
|
||||
|
||||
// If the symbol has an object name, add it to the entry name.
|
||||
if (!symbol.second.object_name.empty())
|
||||
|
@ -415,15 +415,16 @@ void CodeWidget::UpdateFunctionCalls(const Common::Symbol* symbol)
|
|||
if (call_symbol)
|
||||
{
|
||||
QString name;
|
||||
const std::string& symbol_name = call_symbol->GetName();
|
||||
|
||||
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))
|
||||
|
@ -449,15 +450,16 @@ void CodeWidget::UpdateFunctionCallers(const Common::Symbol* symbol)
|
|||
if (caller_symbol)
|
||||
{
|
||||
QString name;
|
||||
const std::string& symbol_name = caller_symbol->GetName();
|
||||
|
||||
if (!caller_symbol->object_name.empty())
|
||||
{
|
||||
name = QString::fromStdString(fmt::format("< {} ({}, {:08x})", caller_symbol->name,
|
||||
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))
|
||||
|
|
Loading…
Reference in New Issue