Files
dolphin/Source/Core/Common/SymbolDB.cpp
T

57 lines
1.1 KiB
C++
Raw Normal View History

// Copyright 2009 Dolphin Emulator Project
2015-05-18 01:08:10 +02:00
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <cstring>
#include <map>
#include <string>
#include <utility>
2014-09-07 20:06:58 -05:00
#include "Common/CommonTypes.h"
#include "Common/SymbolDB.h"
#include "Common/Logging/Log.h"
void SymbolDB::List()
{
2014-03-03 06:25:15 +01:00
for (const auto& func : functions)
{
DEBUG_LOG(OSHLE, "%s @ %08x: %i bytes (hash %08x) : %i calls",
2014-03-03 06:25:15 +01:00
func.second.name.c_str(), func.second.address,
func.second.size, func.second.hash,
func.second.numCalls);
}
INFO_LOG(OSHLE, "%zu functions known in this program above.", 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++;
}
}
2014-03-12 15:33:41 -04:00
Symbol* SymbolDB::GetSymbolFromName(const std::string& name)
{
for (auto& func : functions)
{
2014-03-12 15:33:41 -04:00
if (func.second.name == name)
return &func.second;
}
2014-03-12 15:33:41 -04:00
2014-03-09 21:14:26 +01:00
return nullptr;
}
void SymbolDB::AddCompleteSymbol(const Symbol &symbol)
{
functions.emplace(symbol.address, symbol);
}