Permalink
Browse files

Debugger: Add some missing memory locks.

We can restart memory when loading save states, so we need this even while
we've got startup/shutdown locked.
  • Loading branch information...
unknownbrackets committed May 6, 2018
1 parent b2cc4a0 commit 8598fc99129c0bebcdf0b899108111cd989a18ae
@@ -238,6 +238,8 @@ std::vector<BranchLine> DisassemblyManager::getBranchLines(u32 start, u32 size)
void DisassemblyManager::getLine(u32 address, bool insertSymbols, DisassemblyLineInfo& dest)
{
// This is here really to avoid lock ordering issues.
auto memLock = Memory::Lock();
std::lock_guard<std::recursive_mutex> guard(entriesLock_);
auto it = findDisassemblyEntry(entries,address,false);
if (it == entries.end())
@@ -256,6 +256,7 @@ void WebSocketDisasmState::Base(DebuggerRequest &req) {
// - params: formatted parameters for the instruction.
// - (other info about the disassembled line.)
void WebSocketDisasmState::Disasm(DebuggerRequest &req) {
auto memLock = Memory::Lock();
if (!currentDebugMIPS->isAlive() || !Memory::IsActive()) {
return req.Fail("CPU not started");
}
@@ -338,6 +339,7 @@ void WebSocketDisasmState::Disasm(DebuggerRequest &req) {
// Response (same event name):
// - address: number address of match or null if none was found.
void WebSocketDisasmState::SearchDisasm(DebuggerRequest &req) {
auto memLock = Memory::Lock();
if (!currentDebugMIPS->isAlive() || !Memory::IsActive()) {
return req.Fail("CPU not started");
}
@@ -415,6 +417,7 @@ void WebSocketDisasmState::SearchDisasm(DebuggerRequest &req) {
// Response (same event name):
// - encoding: resulting encoding at this address. Always returns one value, even for macros.
void WebSocketDisasmState::Assemble(DebuggerRequest &req) {
auto memLock = Memory::Lock();
if (!currentDebugMIPS->isAlive() || !Memory::IsActive()) {
return req.Fail("CPU not started");
}
@@ -201,7 +201,6 @@ COLORREF scaleColor(COLORREF color, float factor)
bool CtrlDisAsmView::getDisasmAddressText(u32 address, char* dest, bool abbreviateLabels, bool showData)
{
auto memLock = Memory::Lock();
if (!PSP_IsInited())
return false;
@@ -469,6 +468,7 @@ void CtrlDisAsmView::drawArguments(HDC hdc, const DisassemblyLineInfo &line, int
void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
{
auto memLock = Memory::Lock();
if (!debugger->isAlive()) return;
PAINTSTRUCT ps;
@@ -1180,6 +1180,7 @@ void CtrlDisAsmView::calculatePixelPositions()
void CtrlDisAsmView::search(bool continueSearch)
{
auto memLock = Memory::Lock();
u32 searchAddress;
if (continueSearch == false || searchQuery[0] == 0)
@@ -1260,6 +1261,7 @@ void CtrlDisAsmView::search(bool continueSearch)
std::string CtrlDisAsmView::disassembleRange(u32 start, u32 size)
{
auto memLock = Memory::Lock();
std::string result;
// gather all branch targets without labels
@@ -174,6 +174,8 @@ CtrlMemView *CtrlMemView::getFrom(HWND hwnd)
void CtrlMemView::onPaint(WPARAM wParam, LPARAM lParam)
{
auto memLock = Memory::Lock();
// draw to a bitmap for double buffering
PAINTSTRUCT ps;
HDC actualHdc = BeginPaint(wnd, &ps);
@@ -445,6 +447,7 @@ void CtrlMemView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
case ID_MEMVIEW_COPYVALUE_8:
{
auto memLock = Memory::Lock();
char temp[24];
// it's admittedly not really useful like this
@@ -462,6 +465,7 @@ void CtrlMemView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
case ID_MEMVIEW_COPYVALUE_16:
{
auto memLock = Memory::Lock();
char temp[24];
sprintf(temp,"%04X",Memory::IsValidAddress(curAddress) ? Memory::Read_U16(curAddress) : 0xFFFF);
@@ -471,6 +475,7 @@ void CtrlMemView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
case ID_MEMVIEW_COPYVALUE_32:
{
auto memLock = Memory::Lock();
char temp[24];
sprintf(temp,"%08X",Memory::IsValidAddress(curAddress) ? Memory::Read_U32(curAddress) : 0xFFFFFFFF);

0 comments on commit 8598fc9

Please sign in to comment.