1
0
Fork 0
forked from suyu/suyu
suyu/src/common/break_points.h

100 lines
2 KiB
C
Raw Normal View History

2014-12-17 06:38:14 +01:00
// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <vector>
#include <string>
2015-05-06 09:06:12 +02:00
#include "common/common_types.h"
class DebugInterface;
struct TBreakPoint
{
u32 iAddress;
bool bOn;
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,
2014-04-02 00:20:08 +02:00
bool write, int size, u32 pc);
};
// Code breakpoints.
class BreakPoints
{
public:
2014-04-02 00:20:08 +02:00
typedef std::vector<TBreakPoint> TBreakPoints;
typedef std::vector<std::string> TBreakPointsStr;
2014-04-02 00:20:08 +02:00
const TBreakPoints& GetBreakPoints() { return m_BreakPoints; }
2014-04-02 00:20:08 +02:00
TBreakPointsStr GetStrings() const;
void AddFromStrings(const TBreakPointsStr& bps);
2014-04-02 00:20:08 +02:00
// is address breakpoint
2015-03-30 21:37:34 +02:00
bool IsAddressBreakPoint(u32 iAddress) const;
bool IsTempBreakPoint(u32 iAddress) const;
2014-04-02 00:20:08 +02:00
// Add BreakPoint
void Add(u32 em_address, bool temp=false);
void Add(const TBreakPoint& bp);
2014-04-02 00:20:08 +02:00
// Remove Breakpoint
void Remove(u32 iAddress);
2014-04-02 00:20:08 +02:00
void Clear();
void DeleteByAddress(u32 Address);
private:
2014-04-02 00:20:08 +02:00
TBreakPoints m_BreakPoints;
u32 m_iBreakOnCount;
};
// Memory breakpoints
class MemChecks
{
public:
2014-04-02 00:20:08 +02:00
typedef std::vector<TMemCheck> TMemChecks;
typedef std::vector<std::string> TMemChecksStr;
2014-04-02 00:20:08 +02:00
TMemChecks m_MemChecks;
2014-04-02 00:20:08 +02:00
const TMemChecks& GetMemChecks() { return m_MemChecks; }
2014-04-02 00:20:08 +02:00
TMemChecksStr GetStrings() const;
void AddFromStrings(const TMemChecksStr& mcs);
void Add(const TMemCheck& rMemoryCheck);
2014-04-02 00:20:08 +02:00
// memory breakpoint
TMemCheck *GetMemCheck(u32 address);
void Remove(u32 _Address);
2014-04-02 00:20:08 +02:00
void Clear() { m_MemChecks.clear(); };
};