mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-01 02:29:59 -06:00
SymbolDB: Normalize variable names
Normalizes variable naming so that it adheres to our coding style While we're at it do minor cleanup relating to modified lines
This commit is contained in:
@ -31,25 +31,25 @@ PPCSymbolDB::~PPCSymbolDB() = default;
|
||||
Symbol* PPCSymbolDB::AddFunction(u32 start_addr)
|
||||
{
|
||||
// It's already in the list
|
||||
if (functions.find(start_addr) != functions.end())
|
||||
if (m_functions.find(start_addr) != m_functions.end())
|
||||
return nullptr;
|
||||
|
||||
Symbol symbol;
|
||||
if (!PPCAnalyst::AnalyzeFunction(start_addr, symbol))
|
||||
return nullptr;
|
||||
|
||||
functions[start_addr] = std::move(symbol);
|
||||
Symbol* ptr = &functions[start_addr];
|
||||
m_functions[start_addr] = std::move(symbol);
|
||||
Symbol* ptr = &m_functions[start_addr];
|
||||
ptr->type = Symbol::Type::Function;
|
||||
checksumToFunction[ptr->hash].insert(ptr);
|
||||
m_checksum_to_function[ptr->hash].insert(ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const std::string& name,
|
||||
Symbol::Type type)
|
||||
{
|
||||
auto iter = functions.find(startAddr);
|
||||
if (iter != functions.end())
|
||||
auto iter = m_functions.find(startAddr);
|
||||
if (iter != m_functions.end())
|
||||
{
|
||||
// already got it, let's just update name, checksum & size to be sure.
|
||||
Symbol* tempfunc = &iter->second;
|
||||
@ -75,20 +75,20 @@ void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const std::string& nam
|
||||
name.c_str(), size, tf.size);
|
||||
tf.size = size;
|
||||
}
|
||||
checksumToFunction[tf.hash].insert(&functions[startAddr]);
|
||||
m_checksum_to_function[tf.hash].insert(&m_functions[startAddr]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tf.size = size;
|
||||
}
|
||||
functions[startAddr] = tf;
|
||||
m_functions[startAddr] = tf;
|
||||
}
|
||||
}
|
||||
|
||||
Symbol* PPCSymbolDB::GetSymbolFromAddr(u32 addr)
|
||||
{
|
||||
auto it = functions.lower_bound(addr);
|
||||
if (it == functions.end())
|
||||
auto it = m_functions.lower_bound(addr);
|
||||
if (it == m_functions.end())
|
||||
return nullptr;
|
||||
|
||||
// If the address is exactly the start address of a symbol, we're done.
|
||||
@ -96,7 +96,7 @@ Symbol* PPCSymbolDB::GetSymbolFromAddr(u32 addr)
|
||||
return &it->second;
|
||||
|
||||
// Otherwise, check whether the address is within the bounds of a symbol.
|
||||
if (it != functions.begin())
|
||||
if (it != m_functions.begin())
|
||||
--it;
|
||||
if (addr >= it->second.address && addr < it->second.address + it->second.size)
|
||||
return &it->second;
|
||||
@ -115,21 +115,21 @@ std::string PPCSymbolDB::GetDescription(u32 addr)
|
||||
|
||||
void PPCSymbolDB::FillInCallers()
|
||||
{
|
||||
for (auto& p : functions)
|
||||
for (auto& p : m_functions)
|
||||
{
|
||||
p.second.callers.clear();
|
||||
}
|
||||
|
||||
for (auto& entry : functions)
|
||||
for (auto& entry : m_functions)
|
||||
{
|
||||
Symbol& f = entry.second;
|
||||
for (const SCall& call : f.calls)
|
||||
{
|
||||
const SCall new_call(entry.first, call.callAddress);
|
||||
const SCall new_call(entry.first, call.call_address);
|
||||
const u32 function_address = call.function;
|
||||
|
||||
auto func_iter = functions.find(function_address);
|
||||
if (func_iter != functions.end())
|
||||
auto func_iter = m_functions.find(function_address);
|
||||
if (func_iter != m_functions.end())
|
||||
{
|
||||
Symbol& called_function = func_iter->second;
|
||||
called_function.callers.push_back(new_call);
|
||||
@ -146,8 +146,8 @@ void PPCSymbolDB::FillInCallers()
|
||||
|
||||
void PPCSymbolDB::PrintCalls(u32 funcAddr) const
|
||||
{
|
||||
const auto iter = functions.find(funcAddr);
|
||||
if (iter == functions.end())
|
||||
const auto iter = m_functions.find(funcAddr);
|
||||
if (iter == m_functions.end())
|
||||
{
|
||||
WARN_LOG(SYMBOLS, "Symbol does not exist");
|
||||
return;
|
||||
@ -157,40 +157,40 @@ void PPCSymbolDB::PrintCalls(u32 funcAddr) const
|
||||
DEBUG_LOG(SYMBOLS, "The function %s at %08x calls:", f.name.c_str(), f.address);
|
||||
for (const SCall& call : f.calls)
|
||||
{
|
||||
const auto n = functions.find(call.function);
|
||||
if (n != functions.end())
|
||||
const auto n = m_functions.find(call.function);
|
||||
if (n != m_functions.end())
|
||||
{
|
||||
DEBUG_LOG(SYMBOLS, "* %08x : %s", call.callAddress, n->second.name.c_str());
|
||||
DEBUG_LOG(SYMBOLS, "* %08x : %s", call.call_address, n->second.name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PPCSymbolDB::PrintCallers(u32 funcAddr) const
|
||||
{
|
||||
const auto iter = functions.find(funcAddr);
|
||||
if (iter == functions.end())
|
||||
const auto iter = m_functions.find(funcAddr);
|
||||
if (iter == m_functions.end())
|
||||
return;
|
||||
|
||||
const Symbol& f = iter->second;
|
||||
DEBUG_LOG(SYMBOLS, "The function %s at %08x is called by:", f.name.c_str(), f.address);
|
||||
for (const SCall& caller : f.callers)
|
||||
{
|
||||
const auto n = functions.find(caller.function);
|
||||
if (n != functions.end())
|
||||
const auto n = m_functions.find(caller.function);
|
||||
if (n != m_functions.end())
|
||||
{
|
||||
DEBUG_LOG(SYMBOLS, "* %08x : %s", caller.callAddress, n->second.name.c_str());
|
||||
DEBUG_LOG(SYMBOLS, "* %08x : %s", caller.call_address, n->second.name.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PPCSymbolDB::LogFunctionCall(u32 addr)
|
||||
{
|
||||
auto iter = functions.find(addr);
|
||||
if (iter == functions.end())
|
||||
auto iter = m_functions.find(addr);
|
||||
if (iter == m_functions.end())
|
||||
return;
|
||||
|
||||
Symbol& f = iter->second;
|
||||
f.numCalls++;
|
||||
f.num_calls++;
|
||||
}
|
||||
|
||||
// The use case for handling bad map files is when you have a game with a map file on the disc,
|
||||
@ -426,7 +426,7 @@ bool PPCSymbolDB::SaveSymbolMap(const std::string& filename) const
|
||||
std::vector<const Symbol*> function_symbols;
|
||||
std::vector<const Symbol*> data_symbols;
|
||||
|
||||
for (const auto& function : functions)
|
||||
for (const auto& function : m_functions)
|
||||
{
|
||||
const Symbol& symbol = function.second;
|
||||
if (symbol.type == Symbol::Type::Function)
|
||||
@ -472,7 +472,7 @@ bool PPCSymbolDB::SaveCodeMap(const std::string& filename) const
|
||||
fprintf(f.GetHandle(), ".text\n");
|
||||
|
||||
u32 next_address = 0;
|
||||
for (const auto& function : functions)
|
||||
for (const auto& function : m_functions)
|
||||
{
|
||||
const Symbol& symbol = function.second;
|
||||
|
||||
|
Reference in New Issue
Block a user