mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-10 21:44:28 +00:00
SymbolDB: Use set to map hash with symbols
This commit is contained in:
parent
7e974f1064
commit
8d812db9ad
@ -65,7 +65,7 @@ Symbol* SymbolDB::GetSymbolFromHash(u32 hash)
|
|||||||
{
|
{
|
||||||
XFuncPtrMap::iterator iter = checksumToFunction.find(hash);
|
XFuncPtrMap::iterator iter = checksumToFunction.find(hash);
|
||||||
if (iter != checksumToFunction.end())
|
if (iter != checksumToFunction.end())
|
||||||
return iter->second;
|
return *iter->second.begin();
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,8 @@ std::vector<Symbol*> SymbolDB::GetSymbolsFromHash(u32 hash)
|
|||||||
|
|
||||||
for (const auto& iter : checksumToFunction)
|
for (const auto& iter : checksumToFunction)
|
||||||
if (iter.first == hash)
|
if (iter.first == hash)
|
||||||
symbols.push_back(iter.second);
|
for (const auto& symbol : iter.second)
|
||||||
|
symbols.push_back(symbol);
|
||||||
|
|
||||||
return symbols;
|
return symbols;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -57,7 +58,7 @@ class SymbolDB
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::map<u32, Symbol> XFuncMap;
|
typedef std::map<u32, Symbol> XFuncMap;
|
||||||
typedef std::map<u32, Symbol*> XFuncPtrMap;
|
typedef std::map<u32, std::set<Symbol*>> XFuncPtrMap;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
XFuncMap functions;
|
XFuncMap functions;
|
||||||
|
@ -57,7 +57,7 @@ Symbol* PPCSymbolDB::AddFunction(u32 startAddr)
|
|||||||
// LOG(OSHLE, "Symbol found at %08x", startAddr);
|
// LOG(OSHLE, "Symbol found at %08x", startAddr);
|
||||||
functions[startAddr] = tempFunc;
|
functions[startAddr] = tempFunc;
|
||||||
tempFunc.type = Symbol::Type::Function;
|
tempFunc.type = Symbol::Type::Function;
|
||||||
checksumToFunction[tempFunc.hash] = &(functions[startAddr]);
|
checksumToFunction[tempFunc.hash].insert(&functions[startAddr]);
|
||||||
return &functions[startAddr];
|
return &functions[startAddr];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ void PPCSymbolDB::AddKnownSymbol(u32 startAddr, u32 size, const std::string& nam
|
|||||||
if (tf.type == Symbol::Type::Function)
|
if (tf.type == Symbol::Type::Function)
|
||||||
{
|
{
|
||||||
PPCAnalyst::AnalyzeFunction(startAddr, tf, size);
|
PPCAnalyst::AnalyzeFunction(startAddr, tf, size);
|
||||||
checksumToFunction[tf.hash] = &(functions[startAddr]);
|
checksumToFunction[tf.hash].insert(&functions[startAddr]);
|
||||||
tf.function_name = GetStrippedFunctionName(name);
|
tf.function_name = GetStrippedFunctionName(name);
|
||||||
}
|
}
|
||||||
tf.size = size;
|
tf.size = size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user