Debugger: Event Viewer - Display marked breakpoints on event viewer

This commit is contained in:
Sour 2019-10-18 20:09:08 -04:00
parent a4f4b526ef
commit daf3bcce82
5 changed files with 17 additions and 8 deletions

View file

@ -5,12 +5,14 @@
#include "Breakpoint.h"
#include "DebugUtilities.h"
#include "ExpressionEvaluator.h"
#include "EventManager.h"
BreakpointManager::BreakpointManager(Debugger *debugger, CpuType cpuType)
{
_debugger = debugger;
_cpuType = cpuType;
_hasBreakpoint = false;
_eventManager = debugger->GetEventManager().get();
}
void BreakpointManager::SetBreakpoints(Breakpoint breakpoints[], uint32_t count)
@ -84,7 +86,12 @@ int BreakpointManager::InternalCheckBreakpoint(MemoryOperationInfo operationInfo
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)) {
return breakpoints[i].GetId();
if(breakpoints[i].IsMarked()) {
_eventManager->AddEvent(DebugEventType::Breakpoint, operationInfo, breakpoints[i].GetId());
}
if(breakpoints[i].IsEnabled()) {
return breakpoints[i].GetId();
}
}
}
}

View file

@ -6,6 +6,7 @@
class ExpressionEvaluator;
class Debugger;
class EventManager;
struct ExpressionData;
enum class MemoryOperationType;
@ -16,6 +17,7 @@ private:
Debugger *_debugger;
CpuType _cpuType;
EventManager *_eventManager;
vector<Breakpoint> _breakpoints[BreakpointTypeCount];
vector<ExpressionData> _rpnList[BreakpointTypeCount];

View file

@ -46,7 +46,7 @@ namespace Mesen.GUI.Config
public XmlColor IrqColor = ColorTranslator.FromHtml("#FFADAC");
public XmlColor NmiColor = ColorTranslator.FromHtml("#FFADAC");
public XmlColor BreakpointColor = ColorTranslator.FromHtml("#FFADAC");
public XmlColor BreakpointColor = ColorTranslator.FromHtml("#AFFFAF");
public XmlColor PpuRegisterReadColor = ColorTranslator.FromHtml("#007597");
public XmlColor PpuRegisterWriteColor = ColorTranslator.FromHtml("#C92929");
public XmlColor ApuRegisterReadColor = ColorTranslator.FromHtml("#F9FEAC");

View file

@ -412,7 +412,6 @@ namespace Mesen.GUI.Debugger
//
this.chkShowMarkedBreakpoints.AutoSize = true;
this.tableLayoutPanel1.SetColumnSpan(this.chkShowMarkedBreakpoints, 2);
this.chkShowMarkedBreakpoints.Enabled = false;
this.chkShowMarkedBreakpoints.Location = new System.Drawing.Point(3, 118);
this.chkShowMarkedBreakpoints.Name = "chkShowMarkedBreakpoints";
this.chkShowMarkedBreakpoints.Size = new System.Drawing.Size(121, 17);

View file

@ -13,6 +13,7 @@ using Mesen.GUI.Forms;
using Mesen.GUI.Config;
using System.Drawing.Imaging;
using Mesen.GUI.Debugger.Labels;
using System.Collections.ObjectModel;
namespace Mesen.GUI.Debugger
{
@ -274,16 +275,16 @@ namespace Mesen.GUI.Debugger
break;
case DebugEventType.Breakpoint:
//TODO
/*ReadOnlyCollection<Breakpoint> breakpoints = BreakpointManager.Breakpoints;
if(debugEvent.BreakpointId >= 0 && debugEvent.BreakpointId < breakpoints.Count) {
Breakpoint bp = breakpoints[debugEvent.BreakpointId];
ReadOnlyCollection<Breakpoint> breakpoints = BreakpointManager.Breakpoints;
if(evt.BreakpointId >= 0 && evt.BreakpointId < breakpoints.Count) {
Breakpoint bp = breakpoints[evt.BreakpointId];
values["CPU Type"] = ResourceHelper.GetEnumText(bp.CpuType);
values["BP Type"] = bp.ToReadableType();
values["BP Addresses"] = bp.GetAddressString(true);
if(bp.Condition.Length > 0) {
values["BP Condition"] = bp.Condition;
}
}*/
}
break;
}