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