PPCSymbolDB: Add missing locking
9395238 added locking in some PPCSymbolDB functions that access member
variables, but far from all. To ensure thread safety, this commit adds
the missing locking.
This commit is contained in:
1 parent
803e6b017b
commit
fef77a5f20
3 files changed
+30
-2
No files matched your search
@@ -37,6 +37,8 @@ PPCSymbolDB::~PPCSymbolDB() = default;
|
||||
// Adds the function to the list, unless it's already there
|
||||
Common::Symbol* PPCSymbolDB::AddFunction(const Core::CPUThreadGuard& guard, u32 start_addr)
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
// It's already in the list
|
||||
if (m_functions.contains(start_addr))
|
||||
return nullptr;
|
||||
@@ -56,6 +58,7 @@ void PPCSymbolDB::AddKnownSymbol(const Core::CPUThreadGuard& guard, u32 startAdd
|
||||
const std::string& name, const std::string& object_name,
|
||||
Common::Symbol::Type type)
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
AddKnownSymbol(guard, startAddr, size, name, object_name, type, &m_functions,
|
||||
&m_checksum_to_function);
|
||||
}
|
||||
@@ -105,6 +108,7 @@ void PPCSymbolDB::AddKnownSymbol(const Core::CPUThreadGuard& guard, u32 startAdd
|
||||
|
||||
void PPCSymbolDB::AddKnownNote(u32 start_addr, u32 size, const std::string& name)
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
AddKnownNote(start_addr, size, name, &m_notes);
|
||||
}
|
||||
|
||||
@@ -132,6 +136,7 @@ void PPCSymbolDB::AddKnownNote(u32 start_addr, u32 size, const std::string& name
|
||||
|
||||
void PPCSymbolDB::DetermineNoteLayers()
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
DetermineNoteLayers(&m_notes);
|
||||
}
|
||||
|
||||
@@ -211,11 +216,13 @@ Common::Note* PPCSymbolDB::GetNoteFromAddr(u32 addr)
|
||||
|
||||
void PPCSymbolDB::DeleteFunction(u32 start_address)
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
m_functions.erase(start_address);
|
||||
}
|
||||
|
||||
void PPCSymbolDB::DeleteNote(u32 start_address)
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
m_notes.erase(start_address);
|
||||
}
|
||||
|
||||
@@ -261,6 +268,8 @@ void PPCSymbolDB::FillInCallers()
|
||||
|
||||
void PPCSymbolDB::PrintCalls(u32 funcAddr) const
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
const auto iter = m_functions.find(funcAddr);
|
||||
if (iter == m_functions.end())
|
||||
{
|
||||
@@ -282,6 +291,8 @@ void PPCSymbolDB::PrintCalls(u32 funcAddr) const
|
||||
|
||||
void PPCSymbolDB::PrintCallers(u32 funcAddr) const
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
const auto iter = m_functions.find(funcAddr);
|
||||
if (iter == m_functions.end())
|
||||
return;
|
||||
@@ -300,6 +311,8 @@ void PPCSymbolDB::PrintCallers(u32 funcAddr) const
|
||||
|
||||
void PPCSymbolDB::LogFunctionCall(u32 addr)
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
auto iter = m_functions.find(addr);
|
||||
if (iter == m_functions.end())
|
||||
return;
|
||||
@@ -627,6 +640,8 @@ bool PPCSymbolDB::SaveSymbolMap(const std::string& filename) const
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
// Write .text section
|
||||
auto function_symbols =
|
||||
m_functions |
|
||||
@@ -677,7 +692,7 @@ bool PPCSymbolDB::SaveSymbolMap(const std::string& filename) const
|
||||
return true;
|
||||
}
|
||||
|
||||
// Save code map (won't work if Core is running)
|
||||
// Save code map
|
||||
//
|
||||
// Notes:
|
||||
// - Dolphin doesn't load back code maps
|
||||
@@ -692,6 +707,8 @@ bool PPCSymbolDB::SaveCodeMap(const Core::CPUThreadGuard& guard, const std::stri
|
||||
// Write ".text" at the top
|
||||
f.WriteString(".text\n");
|
||||
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
const auto& ppc_debug_interface = guard.GetSystem().GetPowerPC().GetDebugInterface();
|
||||
|
||||
u32 next_address = 0;
|
||||
|
||||
Reference in new issue
Block a user