Breakpoints in debugger (partial, can only add exec breakpoints)

This commit is contained in:
Souryo 2015-07-19 11:55:53 -04:00
parent 84f735b6a4
commit 841b1f576c
4 changed files with 18 additions and 10 deletions

View File

@ -190,7 +190,7 @@ namespace Mesen.GUI.Debugger
private UInt32 GetLineAddress(int lineIndex)
{
int lineStartIndex = txtCodeMargin.GetFirstCharIndexFromLine(lineIndex);
txtCodeMargin.SelectionStart = lineStartIndex + 3;
txtCodeMargin.SelectionStart = lineStartIndex;
txtCodeMargin.SelectionLength = 4;
return ParseHexAddress(txtCodeMargin.SelectedText);
}
@ -212,6 +212,12 @@ namespace Mesen.GUI.Debugger
txtCode.SelectionLength = 0;
}
public void ToggleBreakpoint()
{
HighlightLine(GetCurrentLine(), Color.FromArgb(158, 84, 94), Color.White);
InteropEmu.DebugAddBreakpoint(BreakpointType.Execute, GetLineAddress(GetCurrentLine()), false);
}
#region Events
private Point _previousLocation;
private void txtCode_MouseMove(object sender, MouseEventArgs e)

View File

@ -79,9 +79,7 @@ namespace Mesen.GUI.Debugger
private void ToggleBreakpoint()
{
this.ctrlDebuggerCode.HighlightLine(this.ctrlDebuggerCode.GetCurrentLine(), Color.FromArgb(158, 84, 94), Color.White);
//this.AddBreakpoint(this.GetLineAddress(lineIndex));
this.ctrlDebuggerCode.ToggleBreakpoint();
}
private void mnuContinue_Click(object sender, EventArgs e)

View File

@ -69,7 +69,7 @@ namespace Mesen.GUI
[DllImport(DLLPath)] public static extern void DebugInitialize();
[DllImport(DLLPath)] public static extern void DebugRelease();
[DllImport(DLLPath)] public static extern void DebugGetState(ref DebugState state);
//[DllImport(DLLPath)] public static extern void DebugSetBreakpoints();
[DllImport(DLLPath)] public static extern void DebugAddBreakpoint(BreakpointType type, UInt32 address, bool isAbsoluteAddr);
[DllImport(DLLPath)] public static extern void DebugStep(UInt32 count);
[DllImport(DLLPath)] public static extern void DebugStepCycles(UInt32 count);
[DllImport(DLLPath)] public static extern void DebugStepOut();
@ -265,6 +265,13 @@ namespace Mesen.GUI
ShowFPS = 0x04,
}
public enum BreakpointType
{
Execute = 0,
Read = 1,
Write = 2
};
public class MD5Helper
{
public static string GetMD5Hash(string filename)

View File

@ -22,11 +22,8 @@ extern "C"
DllExport void __stdcall DebugGetState(DebugState *state) { _debugger->GetState(state); }
DllExport void DebugSetBreakpoints()
{
}
DllExport void DebugAddBreakpoint(uint32_t type, uint32_t address, int isAbsoluteAddr) { _debugger->AddBreakpoint((BreakpointType)type, address, isAbsoluteAddr == 1); }
DllExport void __stdcall DebugRun() { _debugger->Run(); }
DllExport void __stdcall DebugStep(uint32_t count) { _debugger->Step(count); }
DllExport void __stdcall DebugStepCycles(uint32_t count) { _debugger->StepCycles(count); }