diff options
| author | 2015-09-11 09:47:36 -0400 | |
|---|---|---|
| committer | 2015-09-11 09:47:36 -0400 | |
| commit | ef622a07ffc95a1cd3229556244a0fa887cf2e6f (patch) | |
| tree | a070f5ee545eebd76fc685f43ae5e1ce857055bb /src | |
| parent | Merge pull request #1145 from lioncash/cast (diff) | |
| parent | common: Get rid of debug_interface.h (diff) | |
| download | yuzu-ef622a07ffc95a1cd3229556244a0fa887cf2e6f.tar.gz yuzu-ef622a07ffc95a1cd3229556244a0fa887cf2e6f.tar.xz yuzu-ef622a07ffc95a1cd3229556244a0fa887cf2e6f.zip | |
Merge pull request #1144 from lioncash/remove
common: Get rid of debug_interface.h
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/common/break_points.cpp | 90 | ||||
| -rw-r--r-- | src/common/break_points.h | 49 | ||||
| -rw-r--r-- | src/common/debug_interface.h | 36 |
4 files changed, 0 insertions, 176 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 2be6fe996..959084cdf 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -32,7 +32,6 @@ set(HEADERS | |||
| 32 | common_funcs.h | 32 | common_funcs.h |
| 33 | common_paths.h | 33 | common_paths.h |
| 34 | common_types.h | 34 | common_types.h |
| 35 | debug_interface.h | ||
| 36 | emu_window.h | 35 | emu_window.h |
| 37 | file_util.h | 36 | file_util.h |
| 38 | hash.h | 37 | hash.h |
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 | |||
| 105 | MemChecks::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 | |||
| 124 | void 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 | |||
| 145 | void MemChecks::Add(const TMemCheck& rMemoryCheck) | ||
| 146 | { | ||
| 147 | if (GetMemCheck(rMemoryCheck.StartAddress) == 0) | ||
| 148 | m_MemChecks.push_back(rMemoryCheck); | ||
| 149 | } | ||
| 150 | |||
| 151 | void 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 | |||
| 159 | TMemCheck *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 | |||
| 176 | void 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 | } | ||
diff --git a/src/common/break_points.h b/src/common/break_points.h index f0a55e7b1..b0629df37 100644 --- a/src/common/break_points.h +++ b/src/common/break_points.h | |||
| @@ -18,31 +18,6 @@ struct TBreakPoint | |||
| 18 | bool bTemporary; | 18 | bool bTemporary; |
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | struct TMemCheck | ||
| 22 | { | ||
| 23 | TMemCheck(): | ||
| 24 | StartAddress(0), EndAddress(0), | ||
| 25 | bRange(false), OnRead(false), OnWrite(false), | ||
| 26 | Log(false), Break(false), numHits(0) | ||
| 27 | { } | ||
| 28 | |||
| 29 | u32 StartAddress; | ||
| 30 | u32 EndAddress; | ||
| 31 | |||
| 32 | bool bRange; | ||
| 33 | |||
| 34 | bool OnRead; | ||
| 35 | bool OnWrite; | ||
| 36 | |||
| 37 | bool Log; | ||
| 38 | bool Break; | ||
| 39 | |||
| 40 | u32 numHits; | ||
| 41 | |||
| 42 | void Action(DebugInterface *dbg_interface, u32 iValue, u32 addr, | ||
| 43 | bool write, int size, u32 pc); | ||
| 44 | }; | ||
| 45 | |||
| 46 | // Code breakpoints. | 21 | // Code breakpoints. |
| 47 | class BreakPoints | 22 | class BreakPoints |
| 48 | { | 23 | { |
| @@ -73,27 +48,3 @@ private: | |||
| 73 | TBreakPoints m_BreakPoints; | 48 | TBreakPoints m_BreakPoints; |
| 74 | u32 m_iBreakOnCount; | 49 | u32 m_iBreakOnCount; |
| 75 | }; | 50 | }; |
| 76 | |||
| 77 | |||
| 78 | // Memory breakpoints | ||
| 79 | class MemChecks | ||
| 80 | { | ||
| 81 | public: | ||
| 82 | typedef std::vector<TMemCheck> TMemChecks; | ||
| 83 | typedef std::vector<std::string> TMemChecksStr; | ||
| 84 | |||
| 85 | TMemChecks m_MemChecks; | ||
| 86 | |||
| 87 | const TMemChecks& GetMemChecks() { return m_MemChecks; } | ||
| 88 | |||
| 89 | TMemChecksStr GetStrings() const; | ||
| 90 | void AddFromStrings(const TMemChecksStr& mcs); | ||
| 91 | |||
| 92 | void Add(const TMemCheck& rMemoryCheck); | ||
| 93 | |||
| 94 | // memory breakpoint | ||
| 95 | TMemCheck *GetMemCheck(u32 address); | ||
| 96 | void Remove(u32 _Address); | ||
| 97 | |||
| 98 | void Clear() { m_MemChecks.clear(); }; | ||
| 99 | }; | ||
diff --git a/src/common/debug_interface.h b/src/common/debug_interface.h deleted file mode 100644 index 32f55cb59..000000000 --- a/src/common/debug_interface.h +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <cstring> | ||
| 4 | #include <string> | ||
| 5 | |||
| 6 | class DebugInterface | ||
| 7 | { | ||
| 8 | protected: | ||
| 9 | virtual ~DebugInterface() {} | ||
| 10 | |||
| 11 | public: | ||
| 12 | virtual void disasm(unsigned int /*address*/, char *dest, int /*max_size*/) {strcpy(dest, "NODEBUGGER");} | ||
| 13 | virtual void getRawMemoryString(int /*memory*/, unsigned int /*address*/, char *dest, int /*max_size*/) {strcpy(dest, "NODEBUGGER");} | ||
| 14 | virtual int getInstructionSize(int /*instruction*/) {return 1;} | ||
| 15 | virtual bool isAlive() {return true;} | ||
| 16 | virtual bool isBreakpoint(unsigned int /*address*/) {return false;} | ||
| 17 | virtual void setBreakpoint(unsigned int /*address*/){} | ||
| 18 | virtual void clearBreakpoint(unsigned int /*address*/){} | ||
| 19 | virtual void clearAllBreakpoints() {} | ||
| 20 | virtual void toggleBreakpoint(unsigned int /*address*/){} | ||
| 21 | virtual bool isMemCheck(unsigned int /*address*/) {return false;} | ||
| 22 | virtual void toggleMemCheck(unsigned int /*address*/){} | ||
| 23 | virtual unsigned int readMemory(unsigned int /*address*/){return 0;} | ||
| 24 | virtual void writeExtraMemory(int /*memory*/, unsigned int /*value*/, unsigned int /*address*/) {} | ||
| 25 | virtual unsigned int readExtraMemory(int /*memory*/, unsigned int /*address*/){return 0;} | ||
| 26 | virtual unsigned int readInstruction(unsigned int /*address*/){return 0;} | ||
| 27 | virtual unsigned int getPC() {return 0;} | ||
| 28 | virtual void setPC(unsigned int /*address*/) {} | ||
| 29 | virtual void step() {} | ||
| 30 | virtual void runToBreakpoint() {} | ||
| 31 | virtual void breakNow() {} | ||
| 32 | virtual void insertBLR(unsigned int /*address*/, unsigned int /*value*/) {} | ||
| 33 | virtual void showJitResults(unsigned int /*address*/) {}; | ||
| 34 | virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;} | ||
| 35 | virtual std::string getDescription(unsigned int /*address*/) = 0; | ||
| 36 | }; | ||