dolphin/Source/Core/Common/BreakPoints.h

137 lines
2.5 KiB
C
Raw Normal View History

// Copyright 2008 Dolphin Emulator Project
2015-05-17 23:08:10 +00:00
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <string>
#include <vector>
#include "Common/CommonTypes.h"
class DebugInterface;
struct TBreakPoint
{
u32 iAddress;
bool bOn;
bool bTemporary;
};
struct TMemCheck
{
2014-08-30 20:14:56 +00:00
TMemCheck()
{
numHits = 0;
StartAddress = EndAddress = 0;
bRange = OnRead = OnWrite = Log = Break = false;
}
2014-08-30 20:14:56 +00:00
u32 StartAddress;
u32 EndAddress;
bool bRange;
bool OnRead;
bool OnWrite;
bool Log;
bool Break;
u32 numHits;
// returns whether to break
2016-01-21 20:16:51 +00:00
bool Action(DebugInterface* dbg_interface, u32 _iValue, u32 addr,
bool write, int size, u32 pc);
};
struct TWatch
{
std::string name = "";
u32 iAddress;
bool bOn;
};
// Code breakpoints.
class BreakPoints
{
public:
typedef std::vector<TBreakPoint> TBreakPoints;
typedef std::vector<std::string> TBreakPointsStr;
const TBreakPoints& GetBreakPoints() { return m_BreakPoints; }
TBreakPointsStr GetStrings() const;
void AddFromStrings(const TBreakPointsStr& bps);
// is address breakpoint
bool IsAddressBreakPoint(u32 address) const;
bool IsTempBreakPoint(u32 address) const;
// Add BreakPoint
void Add(u32 em_address, bool temp = false);
void Add(const TBreakPoint& bp);
// Remove Breakpoint
void Remove(u32 _iAddress);
void Clear();
void ClearAllTemporary();
private:
TBreakPoints m_BreakPoints;
};
// 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
2016-01-21 20:16:51 +00:00
TMemCheck* GetMemCheck(u32 address);
void Remove(u32 _Address);
2014-09-11 17:00:40 +00:00
void Clear() { m_MemChecks.clear(); }
bool HasAny() const { return !m_MemChecks.empty(); }
};
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);
2014-10-28 11:28:50 +00:00
bool IsAddressWatch(u32 _iAddress) const;
// 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();
private:
TWatches m_Watches;
2014-10-28 11:28:50 +00:00
};