mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-01 03:32:58 +00:00
Merge pull request #5009 from aldelaro5/memcheck-fix
Fix memory breakpoint when checking the middle of the data
This commit is contained in:
commit
50faffc9c2
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ public:
|
|||||||
virtual void ToggleBreakpoint(unsigned int /*address*/) {}
|
virtual void ToggleBreakpoint(unsigned int /*address*/) {}
|
||||||
virtual void AddWatch(unsigned int /*address*/) {}
|
virtual void AddWatch(unsigned int /*address*/) {}
|
||||||
virtual void ClearAllMemChecks() {}
|
virtual void ClearAllMemChecks() {}
|
||||||
virtual bool IsMemCheck(unsigned int /*address*/) { return false; }
|
virtual bool IsMemCheck(unsigned int /*address*/, size_t /*size*/) { return false; }
|
||||||
virtual void ToggleMemCheck(unsigned int /*address*/, bool /*read*/, bool /*write*/, bool /*log*/)
|
virtual void ToggleMemCheck(unsigned int /*address*/, bool /*read*/, bool /*write*/, bool /*log*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "Core/Debugger/PPCDebugInterface.h"
|
#include "Core/Debugger/PPCDebugInterface.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/GekkoDisassembler.h"
|
#include "Common/GekkoDisassembler.h"
|
||||||
@ -129,9 +130,9 @@ void PPCDebugInterface::ClearAllMemChecks()
|
|||||||
PowerPC::memchecks.Clear();
|
PowerPC::memchecks.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PPCDebugInterface::IsMemCheck(unsigned int address)
|
bool PPCDebugInterface::IsMemCheck(unsigned int address, size_t size)
|
||||||
{
|
{
|
||||||
return PowerPC::memchecks.GetMemCheck(address) != nullptr;
|
return PowerPC::memchecks.GetMemCheck(address, size) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPCDebugInterface::ToggleMemCheck(unsigned int address, bool read, bool write, bool log)
|
void PPCDebugInterface::ToggleMemCheck(unsigned int address, bool read, bool write, bool log)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/DebugInterface.h"
|
#include "Common/DebugInterface.h"
|
||||||
@ -25,7 +26,7 @@ public:
|
|||||||
void AddWatch(unsigned int address) override;
|
void AddWatch(unsigned int address) override;
|
||||||
void ToggleBreakpoint(unsigned int address) override;
|
void ToggleBreakpoint(unsigned int address) override;
|
||||||
void ClearAllMemChecks() override;
|
void ClearAllMemChecks() override;
|
||||||
bool IsMemCheck(unsigned int address) override;
|
bool IsMemCheck(unsigned int address, size_t size = 1) override;
|
||||||
void ToggleMemCheck(unsigned int address, bool read = true, bool write = true,
|
void ToggleMemCheck(unsigned int address, bool read = true, bool write = true,
|
||||||
bool log = true) override;
|
bool log = true) override;
|
||||||
unsigned int ReadMemory(unsigned int address) override;
|
unsigned int ReadMemory(unsigned int address) override;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "Core/HW/DSPLLE/DSPDebugInterface.h"
|
#include "Core/HW/DSPLLE/DSPDebugInterface.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
@ -116,7 +117,7 @@ void DSPDebugInterface::ToggleBreakpoint(unsigned int address)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DSPDebugInterface::IsMemCheck(unsigned int address)
|
bool DSPDebugInterface::IsMemCheck(unsigned int address, size_t size)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
@ -27,7 +28,7 @@ public:
|
|||||||
void ClearAllBreakpoints() override;
|
void ClearAllBreakpoints() override;
|
||||||
void ToggleBreakpoint(unsigned int address) override;
|
void ToggleBreakpoint(unsigned int address) override;
|
||||||
void ClearAllMemChecks() override;
|
void ClearAllMemChecks() override;
|
||||||
bool IsMemCheck(unsigned int address) override;
|
bool IsMemCheck(unsigned int address, size_t size) override;
|
||||||
void ToggleMemCheck(unsigned int address, bool read = true, bool write = true,
|
void ToggleMemCheck(unsigned int address, bool read = true, bool write = true,
|
||||||
bool log = true) override;
|
bool log = true) override;
|
||||||
unsigned int ReadMemory(unsigned int address) override;
|
unsigned int ReadMemory(unsigned int address) override;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "Core/PowerPC/BreakPoints.h"
|
#include "Core/PowerPC/BreakPoints.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -201,16 +202,11 @@ void MemChecks::Remove(u32 address)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TMemCheck* MemChecks::GetMemCheck(u32 address)
|
TMemCheck* MemChecks::GetMemCheck(u32 address, size_t size)
|
||||||
{
|
{
|
||||||
for (TMemCheck& mc : m_mem_checks)
|
for (TMemCheck& mc : m_mem_checks)
|
||||||
{
|
{
|
||||||
if (mc.is_ranged)
|
if (mc.end_address >= address && address + size - 1 >= mc.start_address)
|
||||||
{
|
|
||||||
if (address >= mc.start_address && address <= mc.end_address)
|
|
||||||
return &mc;
|
|
||||||
}
|
|
||||||
else if (mc.start_address == address)
|
|
||||||
{
|
{
|
||||||
return &mc;
|
return &mc;
|
||||||
}
|
}
|
||||||
@ -239,8 +235,8 @@ bool MemChecks::OverlapsMemcheck(u32 address, u32 length)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TMemCheck::Action(DebugInterface* debug_interface, u32 value, u32 addr, bool write, int size,
|
bool TMemCheck::Action(DebugInterface* debug_interface, u32 value, u32 addr, bool write,
|
||||||
u32 pc)
|
size_t size, u32 pc)
|
||||||
{
|
{
|
||||||
if ((write && is_break_on_write) || (!write && is_break_on_read))
|
if ((write && is_break_on_write) || (!write && is_break_on_read))
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ struct TMemCheck
|
|||||||
u32 num_hits = 0;
|
u32 num_hits = 0;
|
||||||
|
|
||||||
// returns whether to break
|
// returns whether to break
|
||||||
bool Action(DebugInterface* dbg_interface, u32 value, u32 addr, bool write, int size, u32 pc);
|
bool Action(DebugInterface* dbg_interface, u32 value, u32 addr, bool write, size_t size, u32 pc);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TWatch
|
struct TWatch
|
||||||
@ -86,7 +87,7 @@ public:
|
|||||||
void Add(const TMemCheck& memory_check);
|
void Add(const TMemCheck& memory_check);
|
||||||
|
|
||||||
// memory breakpoint
|
// memory breakpoint
|
||||||
TMemCheck* GetMemCheck(u32 address);
|
TMemCheck* GetMemCheck(u32 address, size_t size = 1);
|
||||||
bool OverlapsMemcheck(u32 address, u32 length);
|
bool OverlapsMemcheck(u32 address, u32 length);
|
||||||
void Remove(u32 address);
|
void Remove(u32 address);
|
||||||
|
|
||||||
|
@ -416,11 +416,11 @@ u32 HostRead_Instruction(const u32 address)
|
|||||||
return inst.hex;
|
return inst.hex;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Memcheck(u32 address, u32 var, bool write, int size)
|
static void Memcheck(u32 address, u32 var, bool write, size_t size)
|
||||||
{
|
{
|
||||||
if (PowerPC::memchecks.HasAny())
|
if (PowerPC::memchecks.HasAny())
|
||||||
{
|
{
|
||||||
TMemCheck* mc = PowerPC::memchecks.GetMemCheck(address);
|
TMemCheck* mc = PowerPC::memchecks.GetMemCheck(address, size);
|
||||||
if (mc)
|
if (mc)
|
||||||
{
|
{
|
||||||
if (CPU::IsStepping())
|
if (CPU::IsStepping())
|
||||||
|
@ -418,7 +418,7 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
|
|||||||
draw_text(StrToWxStr(desc), 2);
|
draw_text(StrToWxStr(desc), 2);
|
||||||
|
|
||||||
// Show blue memory check dot
|
// Show blue memory check dot
|
||||||
if (debugger->IsMemCheck(address))
|
if (debugger->IsMemCheck(address, sizeof(u8)))
|
||||||
{
|
{
|
||||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
dc.SetBrush(mc_brush);
|
dc.SetBrush(mc_brush);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user