summaryrefslogtreecommitdiff
path: root/src/common/break_points.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2015-09-11 08:04:40 -0400
committerGravatar Lioncash2015-09-11 08:12:08 -0400
commit5dc9950772c6d23a5798a4a0366ac767b489c7ad (patch)
tree791c5bc89014f5df00ef2c827672d3026f9e8cf3 /src/common/break_points.cpp
parentMerge pull request #1141 from lioncash/hdr (diff)
downloadyuzu-5dc9950772c6d23a5798a4a0366ac767b489c7ad.tar.gz
yuzu-5dc9950772c6d23a5798a4a0366ac767b489c7ad.tar.xz
yuzu-5dc9950772c6d23a5798a4a0366ac767b489c7ad.zip
common: Get rid of debug_interface.h
This is technically unused. Also removes TMemChecks because it relies on this. Whenever memory breakpoints are implemented for real, it should be designed to match the codebase debugging mechanisms.
Diffstat (limited to 'src/common/break_points.cpp')
-rw-r--r--src/common/break_points.cpp90
1 files changed, 0 insertions, 90 deletions
diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp
index 023a485a4..e7d0d3e43 100644
--- a/src/common/break_points.cpp
+++ b/src/common/break_points.cpp
@@ -2,7 +2,6 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "common/debug_interface.h"
6#include "common/break_points.h" 5#include "common/break_points.h"
7#include "common/logging/log.h" 6#include "common/logging/log.h"
8 7
@@ -101,92 +100,3 @@ void BreakPoints::Clear()
101 100
102 m_BreakPoints.clear(); 101 m_BreakPoints.clear();
103} 102}
104
105MemChecks::TMemChecksStr MemChecks::GetStrings() const
106{
107 TMemChecksStr mcs;
108 for (auto memcheck : m_MemChecks)
109 {
110 std::stringstream mc;
111 mc << std::hex << memcheck.StartAddress;
112 mc << " " << (memcheck.bRange ? memcheck.EndAddress : memcheck.StartAddress) << " "
113 << (memcheck.bRange ? "n" : "")
114 << (memcheck.OnRead ? "r" : "")
115 << (memcheck.OnWrite ? "w" : "")
116 << (memcheck.Log ? "l" : "")
117 << (memcheck.Break ? "p" : "");
118 mcs.push_back(mc.str());
119 }
120
121 return mcs;
122}
123
124void MemChecks::AddFromStrings(const TMemChecksStr& mcs)
125{
126 for (auto mcs_item : mcs)
127 {
128 TMemCheck mc;
129 std::stringstream mcstr;
130 mcstr << std::hex << mcs_item;
131 mcstr >> mc.StartAddress;
132 mc.bRange = mcs_item.find("n") != mcs_item.npos;
133 mc.OnRead = mcs_item.find("r") != mcs_item.npos;
134 mc.OnWrite = mcs_item.find("w") != mcs_item.npos;
135 mc.Log = mcs_item.find("l") != mcs_item.npos;
136 mc.Break = mcs_item.find("p") != mcs_item.npos;
137 if (mc.bRange)
138 mcstr >> mc.EndAddress;
139 else
140 mc.EndAddress = mc.StartAddress;
141 Add(mc);
142 }
143}
144
145void MemChecks::Add(const TMemCheck& rMemoryCheck)
146{
147 if (GetMemCheck(rMemoryCheck.StartAddress) == 0)
148 m_MemChecks.push_back(rMemoryCheck);
149}
150
151void MemChecks::Remove(u32 Address)
152{
153 auto cond = [&Address](const TMemCheck& mc) { return mc.StartAddress == Address; };
154 auto it = std::find_if(m_MemChecks.begin(), m_MemChecks.end(), cond);
155 if (it != m_MemChecks.end())
156 m_MemChecks.erase(it);
157}
158
159TMemCheck *MemChecks::GetMemCheck(u32 address)
160{
161 for (auto i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i)
162 {
163 if (i->bRange)
164 {
165 if (address >= i->StartAddress && address <= i->EndAddress)
166 return &(*i);
167 }
168 else if (i->StartAddress == address)
169 return &(*i);
170 }
171
172 // none found
173 return 0;
174}
175
176void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr,
177 bool write, int size, u32 pc)
178{
179 if ((write && OnWrite) || (!write && OnRead))
180 {
181 if (Log)
182 {
183 LOG_DEBUG(Debug_Breakpoint, "CHK %08x (%s) %s%i %0*x at %08x (%s)",
184 pc, debug_interface->getDescription(pc).c_str(),
185 write ? "Write" : "Read", size*8, size*2, iValue, addr,
186 debug_interface->getDescription(addr).c_str()
187 );
188 }
189 if (Break)
190 debug_interface->breakNow();
191 }
192}