Merge branch 'master' into ui_regs_change
This commit is contained in:
commit
a91ddf8c51
7 changed files with 47 additions and 56 deletions
|
@ -5,63 +5,58 @@
|
||||||
|
|
||||||
bool Breakpoint::Matches(uint32_t memoryAddr, AddressInfo &info)
|
bool Breakpoint::Matches(uint32_t memoryAddr, AddressInfo &info)
|
||||||
{
|
{
|
||||||
if(_memoryType <= DebugUtilities::GetLastCpuMemoryType() && !DebugUtilities::IsPpuMemory(info.Type)) {
|
if(memoryType <= DebugUtilities::GetLastCpuMemoryType() && !DebugUtilities::IsPpuMemory(info.Type)) {
|
||||||
if(_startAddr == -1) {
|
if(startAddr == -1) {
|
||||||
return true;
|
return true;
|
||||||
} else if(_endAddr == -1) {
|
} else if(endAddr == -1) {
|
||||||
return (int32_t)memoryAddr == _startAddr;
|
return (int32_t)memoryAddr == startAddr;
|
||||||
} else {
|
} else {
|
||||||
return (int32_t)memoryAddr >= _startAddr && (int32_t)memoryAddr <= _endAddr;
|
return (int32_t)memoryAddr >= startAddr && (int32_t)memoryAddr <= endAddr;
|
||||||
}
|
}
|
||||||
} else if(_memoryType == info.Type) {
|
} else if(memoryType == info.Type) {
|
||||||
if(_startAddr == -1) {
|
if(startAddr == -1) {
|
||||||
return true;
|
return true;
|
||||||
} else if(_endAddr == -1) {
|
} else if(endAddr == -1) {
|
||||||
return info.Address == _startAddr;
|
return info.Address == startAddr;
|
||||||
} else {
|
} else {
|
||||||
return info.Address >= _startAddr && info.Address <= _endAddr;
|
return info.Address >= startAddr && info.Address <= endAddr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Breakpoint::HasBreakpointType(BreakpointType type)
|
bool Breakpoint::HasBreakpointType(BreakpointType bpType)
|
||||||
{
|
{
|
||||||
switch(type) {
|
switch(bpType) {
|
||||||
default:
|
default:
|
||||||
case BreakpointType::Execute: return ((uint8_t)_type & (uint8_t)BreakpointTypeFlags::Execute) != 0;
|
case BreakpointType::Execute: return ((uint8_t)type & (uint8_t)BreakpointTypeFlags::Execute) != 0;
|
||||||
case BreakpointType::Read: return ((uint8_t)_type & (uint8_t)BreakpointTypeFlags::Read) != 0;
|
case BreakpointType::Read: return ((uint8_t)type & (uint8_t)BreakpointTypeFlags::Read) != 0;
|
||||||
case BreakpointType::Write: return ((uint8_t)_type & (uint8_t)BreakpointTypeFlags::Write) != 0;
|
case BreakpointType::Write: return ((uint8_t)type & (uint8_t)BreakpointTypeFlags::Write) != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string Breakpoint::GetCondition()
|
string Breakpoint::GetCondition()
|
||||||
{
|
{
|
||||||
return _condition;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Breakpoint::HasCondition()
|
bool Breakpoint::HasCondition()
|
||||||
{
|
{
|
||||||
return _condition[0] != 0;
|
return condition[0] != 0;
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Breakpoint::GetId()
|
|
||||||
{
|
|
||||||
return _id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CpuType Breakpoint::GetCpuType()
|
CpuType Breakpoint::GetCpuType()
|
||||||
{
|
{
|
||||||
return _cpuType;
|
return cpuType;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Breakpoint::IsEnabled()
|
bool Breakpoint::IsEnabled()
|
||||||
{
|
{
|
||||||
return _enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Breakpoint::IsMarked()
|
bool Breakpoint::IsMarked()
|
||||||
{
|
{
|
||||||
return _markEvent;
|
return markEvent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,23 +12,20 @@ class Breakpoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool Matches(uint32_t memoryAddr, AddressInfo &info);
|
bool Matches(uint32_t memoryAddr, AddressInfo &info);
|
||||||
bool HasBreakpointType(BreakpointType type);
|
bool HasBreakpointType(BreakpointType bpType);
|
||||||
string GetCondition();
|
string GetCondition();
|
||||||
bool HasCondition();
|
bool HasCondition();
|
||||||
|
|
||||||
uint32_t GetId();
|
|
||||||
CpuType GetCpuType();
|
CpuType GetCpuType();
|
||||||
bool IsEnabled();
|
bool IsEnabled();
|
||||||
bool IsMarked();
|
bool IsMarked();
|
||||||
|
|
||||||
private:
|
CpuType cpuType;
|
||||||
uint32_t _id;
|
SnesMemoryType memoryType;
|
||||||
CpuType _cpuType;
|
BreakpointTypeFlags type;
|
||||||
SnesMemoryType _memoryType;
|
int32_t startAddr;
|
||||||
BreakpointTypeFlags _type;
|
int32_t endAddr;
|
||||||
int32_t _startAddr;
|
bool enabled;
|
||||||
int32_t _endAddr;
|
bool markEvent;
|
||||||
bool _enabled;
|
char condition[1000];
|
||||||
bool _markEvent;
|
|
||||||
char _condition[1000];
|
|
||||||
};
|
};
|
|
@ -36,14 +36,15 @@ void BreakpointManager::SetBreakpoints(Breakpoint breakpoints[], uint32_t count)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_breakpoints[i].push_back(bp);
|
int curIndex = _breakpoints[i].size();
|
||||||
|
_breakpoints[i].insert(std::make_pair(curIndex, bp));
|
||||||
|
|
||||||
if(bp.HasCondition()) {
|
if(bp.HasCondition()) {
|
||||||
bool success = true;
|
bool success = true;
|
||||||
ExpressionData data = _bpExpEval->GetRpnList(bp.GetCondition(), success);
|
ExpressionData data = _bpExpEval->GetRpnList(bp.GetCondition(), success);
|
||||||
_rpnList[i].push_back(success ? data : ExpressionData());
|
_rpnList[i].insert(std::make_pair(curIndex, success ? data : ExpressionData()));
|
||||||
} else {
|
} else {
|
||||||
_rpnList[i].push_back(ExpressionData());
|
_rpnList[i].insert(std::make_pair(curIndex, ExpressionData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
_hasBreakpoint = true;
|
_hasBreakpoint = true;
|
||||||
|
@ -82,15 +83,15 @@ int BreakpointManager::InternalCheckBreakpoint(MemoryOperationInfo operationInfo
|
||||||
DebugState state;
|
DebugState state;
|
||||||
_debugger->GetState(state, false);
|
_debugger->GetState(state, false);
|
||||||
EvalResultType resultType;
|
EvalResultType resultType;
|
||||||
vector<Breakpoint> &breakpoints = _breakpoints[(int)type];
|
unordered_map<int, Breakpoint> &breakpoints = _breakpoints[(int)type];
|
||||||
for(size_t i = 0; i < breakpoints.size(); i++) {
|
for (auto it = breakpoints.begin(); it != breakpoints.end(); it++) {
|
||||||
if(breakpoints[i].Matches(operationInfo.Address, address)) {
|
if (it->second.Matches(operationInfo.Address, address)) {
|
||||||
if(!breakpoints[i].HasCondition() || _bpExpEval->Evaluate(_rpnList[(int)type][i], state, resultType, operationInfo)) {
|
if (!it->second.HasCondition() || _bpExpEval->Evaluate(_rpnList[(int)type][it->first], state, resultType, operationInfo)) {
|
||||||
if(breakpoints[i].IsMarked()) {
|
if (it->second.IsMarked()) {
|
||||||
_eventManager->AddEvent(DebugEventType::Breakpoint, operationInfo, breakpoints[i].GetId());
|
_eventManager->AddEvent(DebugEventType::Breakpoint, operationInfo, it->first);
|
||||||
}
|
}
|
||||||
if(breakpoints[i].IsEnabled()) {
|
if (it->second.IsEnabled()) {
|
||||||
return breakpoints[i].GetId();
|
return it->first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ private:
|
||||||
CpuType _cpuType;
|
CpuType _cpuType;
|
||||||
IEventManager *_eventManager;
|
IEventManager *_eventManager;
|
||||||
|
|
||||||
vector<Breakpoint> _breakpoints[BreakpointTypeCount];
|
unordered_map<int, Breakpoint> _breakpoints[BreakpointTypeCount];
|
||||||
vector<ExpressionData> _rpnList[BreakpointTypeCount];
|
unordered_map<int, ExpressionData> _rpnList[BreakpointTypeCount];
|
||||||
bool _hasBreakpoint;
|
bool _hasBreakpoint;
|
||||||
bool _hasBreakpointType[BreakpointTypeCount] = {};
|
bool _hasBreakpointType[BreakpointTypeCount] = {};
|
||||||
|
|
||||||
|
|
|
@ -201,10 +201,9 @@ namespace Mesen.GUI.Debugger
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InteropBreakpoint ToInteropBreakpoint(int breakpointId)
|
public InteropBreakpoint ToInteropBreakpoint()
|
||||||
{
|
{
|
||||||
InteropBreakpoint bp = new InteropBreakpoint() {
|
InteropBreakpoint bp = new InteropBreakpoint() {
|
||||||
Id = breakpointId,
|
|
||||||
CpuType = CpuType,
|
CpuType = CpuType,
|
||||||
MemoryType = MemoryType,
|
MemoryType = MemoryType,
|
||||||
Type = Type,
|
Type = Type,
|
||||||
|
|
|
@ -127,14 +127,14 @@ namespace Mesen.GUI.Debugger
|
||||||
ReadOnlyCollection<Breakpoint> userBreakpoints = BreakpointManager.Breakpoints;
|
ReadOnlyCollection<Breakpoint> userBreakpoints = BreakpointManager.Breakpoints;
|
||||||
for(int i = 0; i < userBreakpoints.Count; i++) {
|
for(int i = 0; i < userBreakpoints.Count; i++) {
|
||||||
if(_activeCpuTypes.Contains(userBreakpoints[i].CpuType)) {
|
if(_activeCpuTypes.Contains(userBreakpoints[i].CpuType)) {
|
||||||
breakpoints.Add(userBreakpoints[i].ToInteropBreakpoint(breakpoints.Count));
|
breakpoints.Add(userBreakpoints[i].ToInteropBreakpoint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Breakpoint> assertBreakpoints = BreakpointManager.Asserts;
|
List<Breakpoint> assertBreakpoints = BreakpointManager.Asserts;
|
||||||
for(int i = 0; i < assertBreakpoints.Count; i++) {
|
for(int i = 0; i < assertBreakpoints.Count; i++) {
|
||||||
if(_activeCpuTypes.Contains(assertBreakpoints[i].CpuType)) {
|
if(_activeCpuTypes.Contains(assertBreakpoints[i].CpuType)) {
|
||||||
breakpoints.Add(assertBreakpoints[i].ToInteropBreakpoint(breakpoints.Count));
|
breakpoints.Add(assertBreakpoints[i].ToInteropBreakpoint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Mesen.GUI.Debugger
|
||||||
{
|
{
|
||||||
public struct InteropBreakpoint
|
public struct InteropBreakpoint
|
||||||
{
|
{
|
||||||
public Int32 Id;
|
|
||||||
public CpuType CpuType;
|
public CpuType CpuType;
|
||||||
public SnesMemoryType MemoryType;
|
public SnesMemoryType MemoryType;
|
||||||
public BreakpointTypeFlags Type;
|
public BreakpointTypeFlags Type;
|
||||||
|
|
Loading…
Add table
Reference in a new issue