yuzu/src/common/break_points.h

103 lines
2.0 KiB
C
Raw Normal View History

// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#ifndef _DEBUGGER_BREAKPOINTS_H
#define _DEBUGGER_BREAKPOINTS_H
#include <vector>
#include <string>
#include "common/common.h"
class DebugInterface;
struct TBreakPoint
{
2014-04-01 22:20:08 +00:00
u32 iAddress;
bool bOn;
bool bTemporary;
};
struct TMemCheck
{
2014-04-01 22:20:08 +00:00
TMemCheck() {
numHits = 0;
StartAddress = EndAddress = 0;
bRange = OnRead = OnWrite = Log = Break = false;
}
u32 StartAddress;
u32 EndAddress;
2014-04-01 22:20:08 +00:00
bool bRange;
2014-04-01 22:20:08 +00:00
bool OnRead;
bool OnWrite;
2014-04-01 22:20:08 +00:00
bool Log;
bool Break;
2014-04-01 22:20:08 +00:00
u32 numHits;
2014-04-01 22:20:08 +00:00
void Action(DebugInterface *dbg_interface, u32 _iValue, u32 addr,
bool write, int size, u32 pc);
};
// Code breakpoints.
class BreakPoints
{
public:
2014-04-01 22:20:08 +00:00
typedef std::vector<TBreakPoint> TBreakPoints;
typedef std::vector<std::string> TBreakPointsStr;
2014-04-01 22:20:08 +00:00
const TBreakPoints& GetBreakPoints() { return m_BreakPoints; }
2014-04-01 22:20:08 +00:00
TBreakPointsStr GetStrings() const;
void AddFromStrings(const TBreakPointsStr& bps);
2014-04-01 22:20:08 +00:00
// is address breakpoint
bool IsAddressBreakPoint(u32 _iAddress);
bool IsTempBreakPoint(u32 _iAddress);
2014-04-01 22:20:08 +00:00
// Add BreakPoint
void Add(u32 em_address, bool temp=false);
void Add(const TBreakPoint& bp);
2014-04-01 22:20:08 +00:00
// Remove Breakpoint
void Remove(u32 _iAddress);
void Clear();
void DeleteByAddress(u32 _Address);
private:
2014-04-01 22:20:08 +00:00
TBreakPoints m_BreakPoints;
u32 m_iBreakOnCount;
};
// Memory breakpoints
class MemChecks
{
public:
2014-04-01 22:20:08 +00:00
typedef std::vector<TMemCheck> TMemChecks;
typedef std::vector<std::string> TMemChecksStr;
2014-04-01 22:20:08 +00:00
TMemChecks m_MemChecks;
2014-04-01 22:20:08 +00:00
const TMemChecks& GetMemChecks() { return m_MemChecks; }
2014-04-01 22:20:08 +00:00
TMemChecksStr GetStrings() const;
void AddFromStrings(const TMemChecksStr& mcs);
2014-04-01 22:20:08 +00:00
void Add(const TMemCheck& _rMemoryCheck);
2014-04-01 22:20:08 +00:00
// memory breakpoint
TMemCheck *GetMemCheck(u32 address);
void Remove(u32 _Address);
2014-04-01 22:20:08 +00:00
void Clear() { m_MemChecks.clear(); };
};
#endif