diff options
| author | Jules Blok <jules.blok@gmail.com> | 2015-06-10 00:00:12 +0200 |
|---|---|---|
| committer | Jules Blok <jules.blok@gmail.com> | 2015-06-10 00:00:12 +0200 |
| commit | 7dfced21a2e5aac7195e0e1ad76468e30306766b (patch) | |
| tree | bd671b639d3d911460b767caabad8fc8a759a6bf /Source/Core/Common/SymbolDB.cpp | |
| parent | c25be031fc1031d795157d8344b87b7841145197 (diff) | |
| parent | 7b0a65e295c784f9d573f2ef52d4e2a7b9bb2889 (diff) | |
Merge branch 'master' into stable
Diffstat (limited to 'Source/Core/Common/SymbolDB.cpp')
| -rw-r--r-- | Source/Core/Common/SymbolDB.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Source/Core/Common/SymbolDB.cpp b/Source/Core/Common/SymbolDB.cpp new file mode 100644 index 0000000000..9e7b553b13 --- /dev/null +++ b/Source/Core/Common/SymbolDB.cpp @@ -0,0 +1,57 @@ +// Copyright 2009 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include <cstring> +#include <map> +#include <string> +#include <utility> + +#include "Common/CommonTypes.h" +#include "Common/SymbolDB.h" +#include "Common/Logging/Log.h" + +void SymbolDB::List() +{ + for (const auto& func : functions) + { + DEBUG_LOG(OSHLE, "%s @ %08x: %i bytes (hash %08x) : %i calls", + func.second.name.c_str(), func.second.address, + func.second.size, func.second.hash, + func.second.numCalls); + } + INFO_LOG(OSHLE, "%lu functions known in this program above.", + (unsigned long)functions.size()); +} + +void SymbolDB::Clear(const char *prefix) +{ + // TODO: honor prefix + functions.clear(); + checksumToFunction.clear(); +} + +void SymbolDB::Index() +{ + int i = 0; + for (auto& func : functions) + { + func.second.index = i++; + } +} + +Symbol* SymbolDB::GetSymbolFromName(const std::string& name) +{ + for (auto& func : functions) + { + if (func.second.name == name) + return &func.second; + } + + return nullptr; +} + +void SymbolDB::AddCompleteSymbol(const Symbol &symbol) +{ + functions.insert(std::pair<u32, Symbol>(symbol.address, symbol)); +} |
