minor groundwork for future jit breakpoint support

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2054 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-02-01 14:23:11 +00:00
parent 411fdca4fd
commit 7299ed4ad6
3 changed files with 15 additions and 22 deletions

View File

@ -15,20 +15,11 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Lame slow breakpoint system
// TODO: a real one
//
// [F|RES]: this class isn't really nice... for a better management we should use a base class for
// breakpoints and memory checks. but probably this will be slower too
//
#include "Common.h" #include "Common.h"
#include "../HW/CPU.h" #include "../HW/CPU.h"
#include "../Host.h" #include "../Host.h"
#include "../PowerPC/SymbolDB.h" #include "../PowerPC/SymbolDB.h"
#include "../PowerPC/Jit64/Jit.h"
#include "Debugger_BreakPoints.h" #include "Debugger_BreakPoints.h"
BreakPoints::TBreakPoints BreakPoints::m_BreakPoints; BreakPoints::TBreakPoints BreakPoints::m_BreakPoints;
@ -55,11 +46,9 @@ void TMemCheck::Action(u32 iValue, u32 addr, bool write, int size, u32 pc)
bool BreakPoints::IsAddressBreakPoint(u32 _iAddress) bool BreakPoints::IsAddressBreakPoint(u32 _iAddress)
{ {
std::vector<TBreakPoint>::iterator iter; std::vector<TBreakPoint>::iterator iter;
for (iter = m_BreakPoints.begin(); iter != m_BreakPoints.end(); ++iter) for (iter = m_BreakPoints.begin(); iter != m_BreakPoints.end(); ++iter)
if ((*iter).iAddress == _iAddress) if ((*iter).iAddress == _iAddress)
return true; return true;
return false; return false;
} }
@ -74,7 +63,7 @@ bool BreakPoints::IsTempBreakPoint(u32 _iAddress)
return false; return false;
} }
void BreakPoints::Add(u32 em_address, bool temp) bool BreakPoints::Add(u32 em_address, bool temp)
{ {
if (!IsAddressBreakPoint(em_address)) // only add new addresses if (!IsAddressBreakPoint(em_address)) // only add new addresses
{ {
@ -84,23 +73,24 @@ void BreakPoints::Add(u32 em_address, bool temp)
pt.iAddress = em_address; pt.iAddress = em_address;
m_BreakPoints.push_back(pt); m_BreakPoints.push_back(pt);
// jit.NotifyBreakpoint(em_address, true); return true;
} else {
return false;
} }
} }
void BreakPoints::Remove(u32 _iAddress) bool BreakPoints::Remove(u32 _iAddress)
{ {
std::vector<TBreakPoint>::iterator iter; std::vector<TBreakPoint>::iterator iter;
for (iter = m_BreakPoints.begin(); iter != m_BreakPoints.end(); ++iter) for (iter = m_BreakPoints.begin(); iter != m_BreakPoints.end(); ++iter)
{ {
if ((*iter).iAddress == _iAddress) if ((*iter).iAddress == _iAddress)
{ {
m_BreakPoints.erase(iter); m_BreakPoints.erase(iter);
// jit.NotifyBreakpoint(em_address, false); return true;
break;
} }
} }
return false;
} }
void BreakPoints::Clear() void BreakPoints::Clear()

View File

@ -65,10 +65,10 @@ public:
static bool IsTempBreakPoint(u32 _iAddress); static bool IsTempBreakPoint(u32 _iAddress);
// AddBreakPoint // AddBreakPoint
static void Add(u32 em_address, bool temp=false); static bool Add(u32 em_address, bool temp=false);
// Remove Breakpoint // Remove Breakpoint
static void Remove(u32 _iAddress); static bool Remove(u32 _iAddress);
static void Clear(); static void Clear();
static void UpdateBreakPointView(); static void UpdateBreakPointView();

View File

@ -23,6 +23,7 @@
#include "../Core.h" #include "../Core.h"
#include "../HW/Memmap.h" #include "../HW/Memmap.h"
#include "../PowerPC/PowerPC.h" #include "../PowerPC/PowerPC.h"
#include "../PowerPC/Jit64/Jit.h"
#include "../PowerPC/SymbolDB.h" #include "../PowerPC/SymbolDB.h"
void PPCDebugInterface::disasm(unsigned int address, char *dest, int max_size) void PPCDebugInterface::disasm(unsigned int address, char *dest, int max_size)
@ -91,12 +92,14 @@ bool PPCDebugInterface::isBreakpoint(unsigned int address)
void PPCDebugInterface::setBreakpoint(unsigned int address) void PPCDebugInterface::setBreakpoint(unsigned int address)
{ {
BreakPoints::Add(address); if (BreakPoints::Add(address))
jit.NotifyBreakpoint(address, true);
} }
void PPCDebugInterface::clearBreakpoint(unsigned int address) void PPCDebugInterface::clearBreakpoint(unsigned int address)
{ {
BreakPoints::Remove(address); if (BreakPoints::Remove(address))
jit.NotifyBreakpoint(address, false);
} }
void PPCDebugInterface::clearAllBreakpoints() {} void PPCDebugInterface::clearAllBreakpoints() {}