summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2015-04-27 19:42:13 +1000
committerskidau <skidau@gmail.com>2015-04-27 19:42:13 +1000
commit472e28144561cd2a48bf9ec6b6ac8fdbfbc37501 (patch)
tree06f5cbeb7eb235cab2a0e2964ee9c28c141667a6 /Source/Core/Common
parentb457c61b3e5709c8ee85ac4606c6e6fed2821f93 (diff)
parent132e1068ce7b2cc39d52facff9a33d0f3a582ae8 (diff)
Merge pull request #2316 from comex/fix-watch
Fix watchpoints ("memory breakpoints") with JIT
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/BreakPoints.cpp13
-rw-r--r--Source/Core/Common/BreakPoints.h5
-rw-r--r--Source/Core/Common/DebugInterface.h1
3 files changed, 14 insertions, 5 deletions
diff --git a/Source/Core/Common/BreakPoints.cpp b/Source/Core/Common/BreakPoints.cpp
index 74dcb45030..277b956e61 100644
--- a/Source/Core/Common/BreakPoints.cpp
+++ b/Source/Core/Common/BreakPoints.cpp
@@ -165,8 +165,13 @@ void MemChecks::AddFromStrings(const TMemChecksStr& mcstrs)
void MemChecks::Add(const TMemCheck& _rMemoryCheck)
{
+ bool had_any = HasAny();
if (GetMemCheck(_rMemoryCheck.StartAddress) == nullptr)
m_MemChecks.push_back(_rMemoryCheck);
+ // If this is the first one, clear the JIT cache so it can switch to
+ // watchpoint-compatible code.
+ if (!had_any)
+ jit->ClearCache();
}
void MemChecks::Remove(u32 _Address)
@@ -179,6 +184,8 @@ void MemChecks::Remove(u32 _Address)
return;
}
}
+ if (!HasAny())
+ jit->ClearCache();
}
TMemCheck *MemChecks::GetMemCheck(u32 address)
@@ -200,7 +207,7 @@ TMemCheck *MemChecks::GetMemCheck(u32 address)
return nullptr;
}
-void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, bool write, int size, u32 pc)
+bool TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, bool write, int size, u32 pc)
{
if ((write && OnWrite) || (!write && OnRead))
{
@@ -213,9 +220,9 @@ void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, bo
);
}
- if (Break)
- debug_interface->BreakNow();
+ return true;
}
+ return false;
}
diff --git a/Source/Core/Common/BreakPoints.h b/Source/Core/Common/BreakPoints.h
index 631284bc03..91dd74ae20 100644
--- a/Source/Core/Common/BreakPoints.h
+++ b/Source/Core/Common/BreakPoints.h
@@ -40,7 +40,8 @@ struct TMemCheck
u32 numHits;
- void Action(DebugInterface *dbg_interface, u32 _iValue, u32 addr,
+ // returns whether to break
+ bool Action(DebugInterface *dbg_interface, u32 _iValue, u32 addr,
bool write, int size, u32 pc);
};
@@ -105,6 +106,8 @@ public:
void Remove(u32 _Address);
void Clear() { m_MemChecks.clear(); }
+
+ bool HasAny() const { return !m_MemChecks.empty(); }
};
class Watches
diff --git a/Source/Core/Common/DebugInterface.h b/Source/Core/Common/DebugInterface.h
index a21921d496..9e30870eff 100644
--- a/Source/Core/Common/DebugInterface.h
+++ b/Source/Core/Common/DebugInterface.h
@@ -30,7 +30,6 @@ public:
virtual void SetPC(unsigned int /*address*/) {}
virtual void Step() {}
virtual void RunToBreakpoint() {}
- virtual void BreakNow() {}
virtual void InsertBLR(unsigned int /*address*/, unsigned int /*value*/) {}
virtual int GetColor(unsigned int /*address*/){return 0xFFFFFFFF;}
virtual std::string GetDescription(unsigned int /*address*/) = 0;