summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2014-10-28 12:53:22 +1100
committerskidau <skidau@gmail.com>2014-10-28 12:53:22 +1100
commit1630b0c684c837c074e2f5b9dbf5b45554dfc43e (patch)
tree56f0fb651ba36dbbf856a6f5e0b3ef84e62aa505 /Source/Core/Common
parentb13ba0680c5a717d43becd9c50dd739ff64d7c01 (diff)
parentdaf977e84e82d5687bdad7589541319b4288a5dd (diff)
Merge pull request #1291 from skidau/debugger-step-out
Dolphin debugger enhancements
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/BreakPoints.cpp97
-rw-r--r--Source/Core/Common/BreakPoints.h38
-rw-r--r--Source/Core/Common/DebugInterface.h1
3 files changed, 136 insertions, 0 deletions
diff --git a/Source/Core/Common/BreakPoints.cpp b/Source/Core/Common/BreakPoints.cpp
index db0cedf0bb..8772a2287f 100644
--- a/Source/Core/Common/BreakPoints.cpp
+++ b/Source/Core/Common/BreakPoints.cpp
@@ -113,6 +113,19 @@ void BreakPoints::Clear()
m_BreakPoints.clear();
}
+void BreakPoints::ClearAllTemporary()
+{
+ for (const TBreakPoint& bp : m_BreakPoints)
+ {
+ if (bp.bTemporary)
+ {
+ if (jit)
+ jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4, true);
+ Remove(bp.iAddress);
+ }
+ }
+}
+
MemChecks::TMemChecksStr MemChecks::GetStrings() const
{
TMemChecksStr mcs;
@@ -204,3 +217,87 @@ void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, bo
debug_interface->BreakNow();
}
}
+
+
+const bool Watches::IsAddressWatch(u32 _iAddress)
+{
+ for (const TWatch& bp : m_Watches)
+ if (bp.iAddress == _iAddress)
+ return true;
+
+ return false;
+}
+
+Watches::TWatchesStr Watches::GetStrings() const
+{
+ TWatchesStr bps;
+ for (const TWatch& bp : m_Watches)
+ {
+ std::stringstream ss;
+ ss << std::hex << bp.iAddress << " " << bp.name;
+ bps.push_back(ss.str());
+ }
+
+ return bps;
+}
+
+void Watches::AddFromStrings(const TWatchesStr& bpstrs)
+{
+ for (const std::string& bpstr : bpstrs)
+ {
+ TWatch bp;
+ std::stringstream ss;
+ ss << std::hex << bpstr;
+ ss >> bp.iAddress;
+ ss >> std::ws;
+ getline(ss, bp.name);
+ Add(bp);
+ }
+}
+
+void Watches::Add(const TWatch& bp)
+{
+ if (!IsAddressWatch(bp.iAddress))
+ {
+ m_Watches.push_back(bp);
+ }
+}
+
+void Watches::Add(u32 em_address)
+{
+ if (!IsAddressWatch(em_address)) // only add new addresses
+ {
+ TWatch pt; // breakpoint settings
+ pt.bOn = true;
+ pt.iAddress = em_address;
+
+ m_Watches.push_back(pt);
+ }
+}
+
+void Watches::Update(int count, u32 em_address)
+{
+ m_Watches.at(count).iAddress = em_address;
+}
+
+void Watches::UpdateName(int count, const std::string name)
+{
+ m_Watches.at(count).name = name;
+}
+
+void Watches::Remove(u32 em_address)
+{
+ for (auto i = m_Watches.begin(); i != m_Watches.end(); ++i)
+ {
+ if (i->iAddress == em_address)
+ {
+ m_Watches.erase(i);
+ return;
+ }
+ }
+}
+
+void Watches::Clear()
+{
+ m_Watches.clear();
+}
diff --git a/Source/Core/Common/BreakPoints.h b/Source/Core/Common/BreakPoints.h
index 99ea0809ca..7534f41400 100644
--- a/Source/Core/Common/BreakPoints.h
+++ b/Source/Core/Common/BreakPoints.h
@@ -44,6 +44,13 @@ struct TMemCheck
bool write, int size, u32 pc);
};
+struct TWatch
+{
+ std::string name = "";
+ u32 iAddress;
+ bool bOn;
+};
+
// Code breakpoints.
class BreakPoints
{
@@ -67,6 +74,7 @@ public:
// Remove Breakpoint
void Remove(u32 _iAddress);
void Clear();
+ void ClearAllTemporary();
void DeleteByAddress(u32 _Address);
@@ -98,3 +106,33 @@ public:
void Clear() { m_MemChecks.clear(); }
};
+
+class Watches
+{
+public:
+ typedef std::vector<TWatch> TWatches;
+ typedef std::vector<std::string> TWatchesStr;
+
+ const TWatches& GetWatches() { return m_Watches; }
+
+ TWatchesStr GetStrings() const;
+ void AddFromStrings(const TWatchesStr& bps);
+
+ const bool IsAddressWatch(u32 _iAddress);
+
+ // Add BreakPoint
+ void Add(u32 em_address);
+ void Add(const TWatch& bp);
+
+ void Update(int count, u32 em_address);
+ void UpdateName(int count, const std::string name);
+
+ // Remove Breakpoint
+ void Remove(u32 _iAddress);
+ void Clear();
+
+ void DeleteByAddress(u32 _Address);
+
+private:
+ TWatches m_Watches;
+}; \ No newline at end of file
diff --git a/Source/Core/Common/DebugInterface.h b/Source/Core/Common/DebugInterface.h
index 5bee2f7951..a21921d496 100644
--- a/Source/Core/Common/DebugInterface.h
+++ b/Source/Core/Common/DebugInterface.h
@@ -18,6 +18,7 @@ public:
virtual void ClearBreakpoint(unsigned int /*address*/){}
virtual void ClearAllBreakpoints() {}
virtual void ToggleBreakpoint(unsigned int /*address*/){}
+ virtual void AddWatch(unsigned int /*address*/){}
virtual void ClearAllMemChecks() {}
virtual bool IsMemCheck(unsigned int /*address*/) {return false;}
virtual void ToggleMemCheck(unsigned int /*address*/){}