2015-05-23 22:55:12 -06:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 17:08:10 -06:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 21:09:55 -06:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
#include <string>
|
2014-02-17 03:18:15 -07:00
|
|
|
#include <vector>
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Common/CommonTypes.h"
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2009-06-28 06:15:31 -06:00
|
|
|
class DebugInterface;
|
|
|
|
|
2008-12-07 21:46:09 -07:00
|
|
|
struct TBreakPoint
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
u32 iAddress;
|
|
|
|
bool bOn;
|
|
|
|
bool bTemporary;
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TMemCheck
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
TMemCheck()
|
|
|
|
{
|
|
|
|
numHits = 0;
|
|
|
|
StartAddress = EndAddress = 0;
|
|
|
|
bRange = OnRead = OnWrite = Log = Break = false;
|
|
|
|
}
|
2014-08-30 14:14:56 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
u32 StartAddress;
|
|
|
|
u32 EndAddress;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
bool bRange;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
bool OnRead;
|
|
|
|
bool OnWrite;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
bool Log;
|
|
|
|
bool Break;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
u32 numHits;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// returns whether to break
|
|
|
|
bool Action(DebugInterface* dbg_interface, u32 _iValue, u32 addr, bool write, int size, u32 pc);
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
2014-10-19 04:45:40 -06:00
|
|
|
struct TWatch
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
std::string name = "";
|
|
|
|
u32 iAddress;
|
|
|
|
bool bOn;
|
2014-10-19 04:45:40 -06:00
|
|
|
};
|
|
|
|
|
2008-12-20 07:00:33 -07:00
|
|
|
// Code breakpoints.
|
|
|
|
class BreakPoints
|
2008-12-07 21:46:09 -07:00
|
|
|
{
|
|
|
|
public:
|
2016-06-24 02:43:46 -06:00
|
|
|
typedef std::vector<TBreakPoint> TBreakPoints;
|
|
|
|
typedef std::vector<std::string> TBreakPointsStr;
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
const TBreakPoints& GetBreakPoints() { return m_BreakPoints; }
|
|
|
|
TBreakPointsStr GetStrings() const;
|
|
|
|
void AddFromStrings(const TBreakPointsStr& bps);
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// is address breakpoint
|
|
|
|
bool IsAddressBreakPoint(u32 address) const;
|
|
|
|
bool IsTempBreakPoint(u32 address) const;
|
2011-02-25 02:35:56 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// Add BreakPoint
|
|
|
|
void Add(u32 em_address, bool temp = false);
|
|
|
|
void Add(const TBreakPoint& bp);
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// Remove Breakpoint
|
|
|
|
void Remove(u32 _iAddress);
|
|
|
|
void Clear();
|
|
|
|
void ClearAllTemporary();
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
private:
|
2016-06-24 02:43:46 -06:00
|
|
|
TBreakPoints m_BreakPoints;
|
2008-12-20 07:00:33 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
// Memory breakpoints
|
|
|
|
class MemChecks
|
|
|
|
{
|
|
|
|
public:
|
2016-06-24 02:43:46 -06:00
|
|
|
typedef std::vector<TMemCheck> TMemChecks;
|
|
|
|
typedef std::vector<std::string> TMemChecksStr;
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
TMemChecks m_MemChecks;
|
2013-03-19 19:51:12 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
const TMemChecks& GetMemChecks() { return m_MemChecks; }
|
|
|
|
TMemChecksStr GetStrings() const;
|
|
|
|
void AddFromStrings(const TMemChecksStr& mcs);
|
2011-02-25 02:35:56 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
void Add(const TMemCheck& _rMemoryCheck);
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// memory breakpoint
|
|
|
|
TMemCheck* GetMemCheck(u32 address);
|
|
|
|
void Remove(u32 _Address);
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
void Clear() { m_MemChecks.clear(); }
|
|
|
|
bool HasAny() const { return !m_MemChecks.empty(); }
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
2014-10-19 04:45:40 -06:00
|
|
|
|
|
|
|
class Watches
|
|
|
|
{
|
|
|
|
public:
|
2016-06-24 02:43:46 -06:00
|
|
|
typedef std::vector<TWatch> TWatches;
|
|
|
|
typedef std::vector<std::string> TWatchesStr;
|
2014-10-19 04:45:40 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
const TWatches& GetWatches() { return m_Watches; }
|
|
|
|
TWatchesStr GetStrings() const;
|
|
|
|
void AddFromStrings(const TWatchesStr& bps);
|
2014-10-19 04:45:40 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
bool IsAddressWatch(u32 _iAddress) const;
|
2014-10-19 04:45:40 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// Add BreakPoint
|
|
|
|
void Add(u32 em_address);
|
|
|
|
void Add(const TWatch& bp);
|
2014-10-19 04:45:40 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
void Update(int count, u32 em_address);
|
|
|
|
void UpdateName(int count, const std::string name);
|
2014-10-19 04:45:40 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
// Remove Breakpoint
|
|
|
|
void Remove(u32 _iAddress);
|
|
|
|
void Clear();
|
2014-10-19 04:45:40 -06:00
|
|
|
|
|
|
|
private:
|
2016-06-24 02:43:46 -06:00
|
|
|
TWatches m_Watches;
|
2014-10-28 05:28:50 -06:00
|
|
|
};
|