yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Merge pull request #1144 from lioncash/remove

common: Get rid of debug_interface.h
This commit is contained in:
bunnei 2015-09-11 09:47:36 -04:00
commit ef622a07ff
4 changed files with 0 additions and 176 deletions

View File

@ -32,7 +32,6 @@ set(HEADERS
common_funcs.h
common_paths.h
common_types.h
debug_interface.h
emu_window.h
file_util.h
hash.h

View File

@ -2,7 +2,6 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/debug_interface.h"
#include "common/break_points.h"
#include "common/logging/log.h"
@ -101,92 +100,3 @@ void BreakPoints::Clear()
m_BreakPoints.clear();
}
MemChecks::TMemChecksStr MemChecks::GetStrings() const
{
TMemChecksStr mcs;
for (auto memcheck : m_MemChecks)
{
std::stringstream mc;
mc << std::hex << memcheck.StartAddress;
mc << " " << (memcheck.bRange ? memcheck.EndAddress : memcheck.StartAddress) << " "
<< (memcheck.bRange ? "n" : "")
<< (memcheck.OnRead ? "r" : "")
<< (memcheck.OnWrite ? "w" : "")
<< (memcheck.Log ? "l" : "")
<< (memcheck.Break ? "p" : "");
mcs.push_back(mc.str());
}
return mcs;
}
void MemChecks::AddFromStrings(const TMemChecksStr& mcs)
{
for (auto mcs_item : mcs)
{
TMemCheck mc;
std::stringstream mcstr;
mcstr << std::hex << mcs_item;
mcstr >> mc.StartAddress;
mc.bRange = mcs_item.find("n") != mcs_item.npos;
mc.OnRead = mcs_item.find("r") != mcs_item.npos;
mc.OnWrite = mcs_item.find("w") != mcs_item.npos;
mc.Log = mcs_item.find("l") != mcs_item.npos;
mc.Break = mcs_item.find("p") != mcs_item.npos;
if (mc.bRange)
mcstr >> mc.EndAddress;
else
mc.EndAddress = mc.StartAddress;
Add(mc);
}
}
void MemChecks::Add(const TMemCheck& rMemoryCheck)
{
if (GetMemCheck(rMemoryCheck.StartAddress) == 0)
m_MemChecks.push_back(rMemoryCheck);
}
void MemChecks::Remove(u32 Address)
{
auto cond = [&Address](const TMemCheck& mc) { return mc.StartAddress == Address; };
auto it = std::find_if(m_MemChecks.begin(), m_MemChecks.end(), cond);
if (it != m_MemChecks.end())
m_MemChecks.erase(it);
}
TMemCheck *MemChecks::GetMemCheck(u32 address)
{
for (auto i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i)
{
if (i->bRange)
{
if (address >= i->StartAddress && address <= i->EndAddress)
return &(*i);
}
else if (i->StartAddress == address)
return &(*i);
}
// none found
return 0;
}
void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr,
bool write, int size, u32 pc)
{
if ((write && OnWrite) || (!write && OnRead))
{
if (Log)
{
LOG_DEBUG(Debug_Breakpoint, "CHK %08x (%s) %s%i %0*x at %08x (%s)",
pc, debug_interface->getDescription(pc).c_str(),
write ? "Write" : "Read", size*8, size*2, iValue, addr,
debug_interface->getDescription(addr).c_str()
);
}
if (Break)
debug_interface->breakNow();
}
}

View File

@ -18,31 +18,6 @@ struct TBreakPoint
bool bTemporary;
};
struct TMemCheck
{
TMemCheck():
StartAddress(0), EndAddress(0),
bRange(false), OnRead(false), OnWrite(false),
Log(false), Break(false), numHits(0)
{ }
u32 StartAddress;
u32 EndAddress;
bool bRange;
bool OnRead;
bool OnWrite;
bool Log;
bool Break;
u32 numHits;
void Action(DebugInterface *dbg_interface, u32 iValue, u32 addr,
bool write, int size, u32 pc);
};
// Code breakpoints.
class BreakPoints
{
@ -73,27 +48,3 @@ private:
TBreakPoints m_BreakPoints;
u32 m_iBreakOnCount;
};
// Memory breakpoints
class MemChecks
{
public:
typedef std::vector<TMemCheck> TMemChecks;
typedef std::vector<std::string> TMemChecksStr;
TMemChecks m_MemChecks;
const TMemChecks& GetMemChecks() { return m_MemChecks; }
TMemChecksStr GetStrings() const;
void AddFromStrings(const TMemChecksStr& mcs);
void Add(const TMemCheck& rMemoryCheck);
// memory breakpoint
TMemCheck *GetMemCheck(u32 address);
void Remove(u32 _Address);
void Clear() { m_MemChecks.clear(); };
};

View File

@ -1,36 +0,0 @@
#pragma once
#include <cstring>
#include <string>
class DebugInterface
{
protected:
virtual ~DebugInterface() {}
public:
virtual void disasm(unsigned int /*address*/, char *dest, int /*max_size*/) {strcpy(dest, "NODEBUGGER");}
virtual void getRawMemoryString(int /*memory*/, unsigned int /*address*/, char *dest, int /*max_size*/) {strcpy(dest, "NODEBUGGER");}
virtual int getInstructionSize(int /*instruction*/) {return 1;}
virtual bool isAlive() {return true;}
virtual bool isBreakpoint(unsigned int /*address*/) {return false;}
virtual void setBreakpoint(unsigned int /*address*/){}
virtual void clearBreakpoint(unsigned int /*address*/){}
virtual void clearAllBreakpoints() {}
virtual void toggleBreakpoint(unsigned int /*address*/){}
virtual bool isMemCheck(unsigned int /*address*/) {return false;}
virtual void toggleMemCheck(unsigned int /*address*/){}
virtual unsigned int readMemory(unsigned int /*address*/){return 0;}
virtual void writeExtraMemory(int /*memory*/, unsigned int /*value*/, unsigned int /*address*/) {}
virtual unsigned int readExtraMemory(int /*memory*/, unsigned int /*address*/){return 0;}
virtual unsigned int readInstruction(unsigned int /*address*/){return 0;}
virtual unsigned int getPC() {return 0;}
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 void showJitResults(unsigned int /*address*/) {};
virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;}
virtual std::string getDescription(unsigned int /*address*/) = 0;
};