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