Skip to content
Permalink
Browse files

Debugger: Avoid some lock ordering issues.

Ideally get rid of the memory lock...
  • Loading branch information...
unknownbrackets committed May 12, 2018
1 parent 5bfba9b commit b828497fe2a12caff429f0eedcb1799d6dbe9a08
Showing with 5 additions and 0 deletions.
  1. +5 −0 Core/Debugger/DisassemblyManager.cpp
@@ -150,6 +150,7 @@ void DisassemblyManager::analyze(u32 address, u32 size = 1024)
if (!PSP_IsInited())
return;

auto memLock = Memory::Lock();
std::lock_guard<std::recursive_mutex> guard(entriesLock_);
auto it = findDisassemblyEntry(entries, address, false);
if (it != entries.end())
@@ -272,6 +273,7 @@ void DisassemblyManager::getLine(u32 address, bool insertSymbols, DisassemblyLin

u32 DisassemblyManager::getStartAddress(u32 address)
{
auto memLock = Memory::Lock();
std::lock_guard<std::recursive_mutex> guard(entriesLock_);
auto it = findDisassemblyEntry(entries,address,false);
if (it == entries.end())
@@ -289,6 +291,7 @@ u32 DisassemblyManager::getStartAddress(u32 address)

u32 DisassemblyManager::getNthPreviousAddress(u32 address, int n)
{
auto memLock = Memory::Lock();
std::lock_guard<std::recursive_mutex> guard(entriesLock_);
while (Memory::IsValidAddress(address))
{
@@ -318,6 +321,7 @@ u32 DisassemblyManager::getNthPreviousAddress(u32 address, int n)

u32 DisassemblyManager::getNthNextAddress(u32 address, int n)
{
auto memLock = Memory::Lock();
std::lock_guard<std::recursive_mutex> guard(entriesLock_);
while (Memory::IsValidAddress(address))
{
@@ -352,6 +356,7 @@ DisassemblyManager::~DisassemblyManager() {

void DisassemblyManager::clear()
{
auto memLock = Memory::Lock();
std::lock_guard<std::recursive_mutex> guard(entriesLock_);
for (auto it = entries.begin(); it != entries.end(); it++)
{

0 comments on commit b828497

Please sign in to comment.
You can’t perform that action at this time.