From e66dd700e1193fabcc251682dbcbcccdc87e5e76 Mon Sep 17 00:00:00 2001 From: Souryo Date: Sat, 19 Aug 2017 22:00:12 -0400 Subject: [PATCH] Debugger: Added auto-load cdl option --- Core/Debugger.cpp | 44 +++++++++++++------ Core/Debugger.h | 2 + Core/Disassembler.cpp | 18 +++++--- Core/Disassembler.h | 1 + GUI.NET/Config/DebugInfo.cs | 1 + GUI.NET/Debugger/frmDebugger.Designer.cs | 55 ++++++++++++++---------- GUI.NET/Debugger/frmDebugger.cs | 34 +++++++++++++-- InteropDLL/DebugWrapper.cpp | 2 +- 8 files changed, 111 insertions(+), 46 deletions(-) diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp index 14e6e25b..2b7b028d 100644 --- a/Core/Debugger.cpp +++ b/Core/Debugger.cpp @@ -81,7 +81,9 @@ Debugger::Debugger(shared_ptr console, shared_ptr cpu, shared_ptr< _frozenAddresses.insert(_frozenAddresses.end(), 0x10000, 0); - LoadCdlFile(FolderUtilities::CombinePath(FolderUtilities::GetDebuggerFolder(), FolderUtilities::GetFilename(_romName, false) + ".cdl")); + if(!LoadCdlFile(FolderUtilities::CombinePath(FolderUtilities::GetDebuggerFolder(), FolderUtilities::GetFilename(_romName, false) + ".cdl"))) { + _disassembler->Reset(); + } Debugger::Instance = this; } @@ -145,24 +147,38 @@ void Debugger::BreakIfDebugging() bool Debugger::LoadCdlFile(string cdlFilepath) { if(_codeDataLogger->LoadCdlFile(cdlFilepath)) { - for(int i = 0, len = _mapper->GetMemorySize(DebugMemoryType::PrgRom); i < len; i++) { - if(_codeDataLogger->IsCode(i)) { - AddressTypeInfo info = { i, AddressType::PrgRom }; - i = _disassembler->BuildCache(info, 0, _codeDataLogger->IsSubEntryPoint(i)) - 1; - } - } - - for(int i = 0, len = _mapper->GetMemorySize(DebugMemoryType::PrgRom); i < len; i++) { - if(_codeDataLogger->IsSubEntryPoint(i)) { - _functionEntryPoints.emplace(i); - } - } - + UpdateCdlCache(); return true; } return false; } +void Debugger::ResetCdl() +{ + _codeDataLogger->Reset(); + UpdateCdlCache(); +} + +void Debugger::UpdateCdlCache() +{ + Console::Pause(); + _disassembler->Reset(); + for(int i = 0, len = _mapper->GetMemorySize(DebugMemoryType::PrgRom); i < len; i++) { + if(_codeDataLogger->IsCode(i)) { + AddressTypeInfo info = { i, AddressType::PrgRom }; + i = _disassembler->BuildCache(info, 0, _codeDataLogger->IsSubEntryPoint(i)) - 1; + } + } + + _functionEntryPoints.clear(); + for(int i = 0, len = _mapper->GetMemorySize(DebugMemoryType::PrgRom); i < len; i++) { + if(_codeDataLogger->IsSubEntryPoint(i)) { + _functionEntryPoints.emplace(i); + } + } + Console::Resume(); +} + bool Debugger::IsMarkedAsCode(uint16_t relativeAddress) { AddressTypeInfo info; diff --git a/Core/Debugger.h b/Core/Debugger.h index 1fe313d8..3bfc3466 100644 --- a/Core/Debugger.h +++ b/Core/Debugger.h @@ -155,6 +155,8 @@ public: void Run(); bool LoadCdlFile(string cdlFilepath); + void ResetCdl(); + void UpdateCdlCache(); bool IsMarkedAsCode(uint16_t relativeAddress); shared_ptr GetCodeDataLogger(); diff --git a/Core/Disassembler.cpp b/Core/Disassembler.cpp index 5ceec4ea..d8df1c86 100644 --- a/Core/Disassembler.cpp +++ b/Core/Disassembler.cpp @@ -16,11 +16,6 @@ Disassembler::Disassembler(MemoryManager* memoryManager, BaseMapper* mapper, Deb _memoryManager = memoryManager; _mapper = mapper; - _disassembleCache.insert(_disassembleCache.end(), mapper->GetMemorySize(DebugMemoryType::PrgRom), shared_ptr(nullptr)); - _disassembleWorkRamCache.insert(_disassembleWorkRamCache.end(), mapper->GetMemorySize(DebugMemoryType::WorkRam), shared_ptr(nullptr)); - _disassembleSaveRamCache.insert(_disassembleSaveRamCache.end(), mapper->GetMemorySize(DebugMemoryType::SaveRam), shared_ptr(nullptr)); - _disassembleMemoryCache.insert(_disassembleMemoryCache.end(), 0x800, shared_ptr(nullptr)); - BuildOpCodeTables(false); } @@ -28,6 +23,19 @@ Disassembler::~Disassembler() { } +void Disassembler::Reset() +{ + _disassembleCache.clear(); + _disassembleWorkRamCache.clear(); + _disassembleSaveRamCache.clear(); + _disassembleMemoryCache.clear(); + + _disassembleCache.insert(_disassembleCache.end(), _mapper->GetMemorySize(DebugMemoryType::PrgRom), shared_ptr(nullptr)); + _disassembleWorkRamCache.insert(_disassembleWorkRamCache.end(), _mapper->GetMemorySize(DebugMemoryType::WorkRam), shared_ptr(nullptr)); + _disassembleSaveRamCache.insert(_disassembleSaveRamCache.end(), _mapper->GetMemorySize(DebugMemoryType::SaveRam), shared_ptr(nullptr)); + _disassembleMemoryCache.insert(_disassembleMemoryCache.end(), 0x800, shared_ptr(nullptr)); +} + void Disassembler::BuildOpCodeTables(bool useLowerCase) { string opName[256] = { diff --git a/Core/Disassembler.h b/Core/Disassembler.h index 22284640..c287a345 100644 --- a/Core/Disassembler.h +++ b/Core/Disassembler.h @@ -34,6 +34,7 @@ public: ~Disassembler(); void BuildOpCodeTables(bool useLowerCase); + void Reset(); uint32_t BuildCache(AddressTypeInfo &info, uint16_t memoryAddr, bool isSubEntryPoint); void InvalidateCache(AddressTypeInfo &info); diff --git a/GUI.NET/Config/DebugInfo.cs b/GUI.NET/Config/DebugInfo.cs index 938dd08c..623a2a70 100644 --- a/GUI.NET/Config/DebugInfo.cs +++ b/GUI.NET/Config/DebugInfo.cs @@ -143,6 +143,7 @@ namespace Mesen.GUI.Config public string FindOccurrencesLastSearch = string.Empty; public bool AutoLoadDbgFiles = false; + public bool AutoLoadCdlFiles = false; public bool DisableDefaultLabels = false; public bool RefreshWatchWhileRunning = false; diff --git a/GUI.NET/Debugger/frmDebugger.Designer.cs b/GUI.NET/Debugger/frmDebugger.Designer.cs index dc5d6074..069b96f4 100644 --- a/GUI.NET/Debugger/frmDebugger.Designer.cs +++ b/GUI.NET/Debugger/frmDebugger.Designer.cs @@ -152,6 +152,7 @@ namespace Mesen.GUI.Debugger this.lblCyclesElapsed = new System.Windows.Forms.ToolStripStatusLabel(); this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping(); this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping(); + this.mnuAutoLoadCdlFiles = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -196,7 +197,7 @@ namespace Mesen.GUI.Debugger this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanel10); this.splitContainer.Panel2MinSize = 100; this.splitContainer.Size = new System.Drawing.Size(1172, 573); - this.splitContainer.SplitterDistance = 435; + this.splitContainer.SplitterDistance = 432; this.splitContainer.SplitterWidth = 7; this.splitContainer.TabIndex = 1; this.splitContainer.TabStop = false; @@ -219,8 +220,8 @@ namespace Mesen.GUI.Debugger // this.ctrlSplitContainerTop.Panel2.Controls.Add(this.tlpFunctionLabelLists); this.ctrlSplitContainerTop.Panel2MinSize = 150; - this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1172, 435); - this.ctrlSplitContainerTop.SplitterDistance = 914; + this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1172, 432); + this.ctrlSplitContainerTop.SplitterDistance = 911; this.ctrlSplitContainerTop.SplitterWidth = 7; this.ctrlSplitContainerTop.TabIndex = 3; this.ctrlSplitContainerTop.PanelCollapsed += new System.EventHandler(this.ctrlSplitContainerTop_PanelCollapsed); @@ -241,7 +242,7 @@ namespace Mesen.GUI.Debugger this.tlpTop.Name = "tlpTop"; this.tlpTop.RowCount = 1; this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tlpTop.Size = new System.Drawing.Size(914, 435); + this.tlpTop.Size = new System.Drawing.Size(911, 432); this.tlpTop.TabIndex = 2; // // ctrlDebuggerCode @@ -250,7 +251,7 @@ namespace Mesen.GUI.Debugger this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3); this.ctrlDebuggerCode.Name = "ctrlDebuggerCode"; - this.ctrlDebuggerCode.Size = new System.Drawing.Size(450, 429); + this.ctrlDebuggerCode.Size = new System.Drawing.Size(447, 426); this.ctrlDebuggerCode.TabIndex = 2; this.ctrlDebuggerCode.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode); this.ctrlDebuggerCode.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement); @@ -259,10 +260,10 @@ namespace Mesen.GUI.Debugger // ctrlConsoleStatus // this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Fill; - this.ctrlConsoleStatus.Location = new System.Drawing.Point(456, 0); + this.ctrlConsoleStatus.Location = new System.Drawing.Point(453, 0); this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0); this.ctrlConsoleStatus.Name = "ctrlConsoleStatus"; - this.ctrlConsoleStatus.Size = new System.Drawing.Size(458, 435); + this.ctrlConsoleStatus.Size = new System.Drawing.Size(458, 432); this.ctrlConsoleStatus.TabIndex = 3; this.ctrlConsoleStatus.OnGotoLocation += new System.EventHandler(this.ctrlConsoleStatus_OnGotoLocation); // @@ -270,9 +271,9 @@ namespace Mesen.GUI.Debugger // this.ctrlDebuggerCodeSplit.Code = null; this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill; - this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(459, 3); + this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(456, 3); this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit"; - this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 429); + this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 426); this.ctrlDebuggerCodeSplit.TabIndex = 4; this.ctrlDebuggerCodeSplit.Visible = false; this.ctrlDebuggerCodeSplit.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode); @@ -292,16 +293,16 @@ namespace Mesen.GUI.Debugger this.tlpFunctionLabelLists.RowCount = 2; this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tlpFunctionLabelLists.Size = new System.Drawing.Size(251, 435); + this.tlpFunctionLabelLists.Size = new System.Drawing.Size(254, 432); this.tlpFunctionLabelLists.TabIndex = 5; // // grpLabels // this.grpLabels.Controls.Add(this.ctrlLabelList); this.grpLabels.Dock = System.Windows.Forms.DockStyle.Fill; - this.grpLabels.Location = new System.Drawing.Point(3, 220); + this.grpLabels.Location = new System.Drawing.Point(3, 219); this.grpLabels.Name = "grpLabels"; - this.grpLabels.Size = new System.Drawing.Size(245, 212); + this.grpLabels.Size = new System.Drawing.Size(248, 210); this.grpLabels.TabIndex = 6; this.grpLabels.TabStop = false; this.grpLabels.Text = "Labels"; @@ -311,7 +312,7 @@ namespace Mesen.GUI.Debugger this.ctrlLabelList.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlLabelList.Location = new System.Drawing.Point(3, 16); this.ctrlLabelList.Name = "ctrlLabelList"; - this.ctrlLabelList.Size = new System.Drawing.Size(239, 193); + this.ctrlLabelList.Size = new System.Drawing.Size(242, 191); this.ctrlLabelList.TabIndex = 0; this.ctrlLabelList.OnFindOccurrence += new System.EventHandler(this.ctrlLabelList_OnFindOccurrence); this.ctrlLabelList.OnLabelSelected += new System.EventHandler(this.ctrlLabelList_OnLabelSelected); @@ -322,7 +323,7 @@ namespace Mesen.GUI.Debugger this.grpFunctions.Dock = System.Windows.Forms.DockStyle.Fill; this.grpFunctions.Location = new System.Drawing.Point(3, 3); this.grpFunctions.Name = "grpFunctions"; - this.grpFunctions.Size = new System.Drawing.Size(245, 211); + this.grpFunctions.Size = new System.Drawing.Size(248, 210); this.grpFunctions.TabIndex = 5; this.grpFunctions.TabStop = false; this.grpFunctions.Text = "Functions"; @@ -332,7 +333,7 @@ namespace Mesen.GUI.Debugger this.ctrlFunctionList.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlFunctionList.Location = new System.Drawing.Point(3, 16); this.ctrlFunctionList.Name = "ctrlFunctionList"; - this.ctrlFunctionList.Size = new System.Drawing.Size(239, 192); + this.ctrlFunctionList.Size = new System.Drawing.Size(242, 191); this.ctrlFunctionList.TabIndex = 0; this.ctrlFunctionList.OnFindOccurrence += new System.EventHandler(this.ctrlFunctionList_OnFindOccurrence); this.ctrlFunctionList.OnFunctionSelected += new System.EventHandler(this.ctrlFunctionList_OnFunctionSelected); @@ -353,7 +354,7 @@ namespace Mesen.GUI.Debugger this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel10.Size = new System.Drawing.Size(1172, 131); + this.tableLayoutPanel10.Size = new System.Drawing.Size(1172, 134); this.tableLayoutPanel10.TabIndex = 0; // // grpWatch @@ -363,7 +364,7 @@ namespace Mesen.GUI.Debugger this.grpWatch.Dock = System.Windows.Forms.DockStyle.Fill; this.grpWatch.Location = new System.Drawing.Point(3, 3); this.grpWatch.Name = "grpWatch"; - this.grpWatch.Size = new System.Drawing.Size(384, 125); + this.grpWatch.Size = new System.Drawing.Size(384, 128); this.grpWatch.TabIndex = 2; this.grpWatch.TabStop = false; this.grpWatch.Text = "Watch"; @@ -383,7 +384,7 @@ namespace Mesen.GUI.Debugger this.ctrlWatch.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlWatch.Location = new System.Drawing.Point(3, 16); this.ctrlWatch.Name = "ctrlWatch"; - this.ctrlWatch.Size = new System.Drawing.Size(378, 106); + this.ctrlWatch.Size = new System.Drawing.Size(378, 109); this.ctrlWatch.TabIndex = 0; // // grpBreakpoints @@ -392,7 +393,7 @@ namespace Mesen.GUI.Debugger this.grpBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill; this.grpBreakpoints.Location = new System.Drawing.Point(393, 3); this.grpBreakpoints.Name = "grpBreakpoints"; - this.grpBreakpoints.Size = new System.Drawing.Size(384, 125); + this.grpBreakpoints.Size = new System.Drawing.Size(384, 128); this.grpBreakpoints.TabIndex = 3; this.grpBreakpoints.TabStop = false; this.grpBreakpoints.Text = "Breakpoints"; @@ -402,7 +403,7 @@ namespace Mesen.GUI.Debugger this.ctrlBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlBreakpoints.Location = new System.Drawing.Point(3, 16); this.ctrlBreakpoints.Name = "ctrlBreakpoints"; - this.ctrlBreakpoints.Size = new System.Drawing.Size(378, 106); + this.ctrlBreakpoints.Size = new System.Drawing.Size(378, 109); this.ctrlBreakpoints.TabIndex = 0; this.ctrlBreakpoints.BreakpointNavigation += new System.EventHandler(this.ctrlBreakpoints_BreakpointNavigation); // @@ -412,7 +413,7 @@ namespace Mesen.GUI.Debugger this.grpCallstack.Dock = System.Windows.Forms.DockStyle.Fill; this.grpCallstack.Location = new System.Drawing.Point(783, 3); this.grpCallstack.Name = "grpCallstack"; - this.grpCallstack.Size = new System.Drawing.Size(386, 125); + this.grpCallstack.Size = new System.Drawing.Size(386, 128); this.grpCallstack.TabIndex = 4; this.grpCallstack.TabStop = false; this.grpCallstack.Text = "Call Stack"; @@ -422,7 +423,7 @@ namespace Mesen.GUI.Debugger this.ctrlCallstack.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlCallstack.Location = new System.Drawing.Point(3, 16); this.ctrlCallstack.Name = "ctrlCallstack"; - this.ctrlCallstack.Size = new System.Drawing.Size(380, 106); + this.ctrlCallstack.Size = new System.Drawing.Size(380, 109); this.ctrlCallstack.TabIndex = 0; this.ctrlCallstack.FunctionSelected += new System.EventHandler(this.ctrlCallstack_FunctionSelected); // @@ -492,6 +493,7 @@ namespace Mesen.GUI.Debugger this.mnuResetWorkspace, this.toolStripMenuItem10, this.mnuAutoLoadDbgFiles, + this.mnuAutoLoadCdlFiles, this.mnuDisableDefaultLabels}); this.mnuWorkspace.Name = "mnuWorkspace"; this.mnuWorkspace.Size = new System.Drawing.Size(162, 22); @@ -1286,6 +1288,14 @@ namespace Mesen.GUI.Debugger this.ctrlCpuMemoryMapping.Text = "ctrlMemoryMapping1"; this.ctrlCpuMemoryMapping.Visible = false; // + // mnuAutoLoadCdlFiles + // + this.mnuAutoLoadCdlFiles.CheckOnClick = true; + this.mnuAutoLoadCdlFiles.Name = "mnuAutoLoadCdlFiles"; + this.mnuAutoLoadCdlFiles.Size = new System.Drawing.Size(207, 22); + this.mnuAutoLoadCdlFiles.Text = "Auto-load CDL files"; + this.mnuAutoLoadCdlFiles.Click += new System.EventHandler(this.mnuAutoLoadCdlFiles_Click); + // // frmDebugger // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1450,5 +1460,6 @@ namespace Mesen.GUI.Debugger private System.Windows.Forms.ToolStripMenuItem mnuExportLabels; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem16; private System.Windows.Forms.ToolStripMenuItem mnuSaveAsIps; + private System.Windows.Forms.ToolStripMenuItem mnuAutoLoadCdlFiles; } } \ No newline at end of file diff --git a/GUI.NET/Debugger/frmDebugger.cs b/GUI.NET/Debugger/frmDebugger.cs index a0a76741..fde7a15e 100644 --- a/GUI.NET/Debugger/frmDebugger.cs +++ b/GUI.NET/Debugger/frmDebugger.cs @@ -47,7 +47,8 @@ namespace Mesen.GUI.Debugger ctrlProfiler.OnFunctionSelected += ctrlProfiler_OnFunctionSelected; this.UpdateWorkspace(); - this.AutoLoadDbgFile(true); + this.AutoLoadCdlFiles(); + this.AutoLoadDbgFiles(true); this.mnuSplitView.Checked = ConfigManager.Config.DebugInfo.SplitView; this.mnuPpuPartialDraw.Checked = ConfigManager.Config.DebugInfo.PpuPartialDraw; @@ -57,6 +58,7 @@ namespace Mesen.GUI.Debugger this.mnuShowOnlyDisassembledCode.Checked = ConfigManager.Config.DebugInfo.ShowOnlyDisassembledCode; this.mnuHighlightUnexecutedCode.Checked = ConfigManager.Config.DebugInfo.HighlightUnexecutedCode; this.mnuAutoLoadDbgFiles.Checked = ConfigManager.Config.DebugInfo.AutoLoadDbgFiles; + this.mnuAutoLoadCdlFiles.Checked = ConfigManager.Config.DebugInfo.AutoLoadCdlFiles; this.mnuBreakOnReset.Checked = ConfigManager.Config.DebugInfo.BreakOnReset; this.mnuBreakOnOpen.Checked = ConfigManager.Config.DebugInfo.BreakOnOpen; this.mnuBreakOnUnofficialOpcodes.Checked = ConfigManager.Config.DebugInfo.BreakOnUnofficialOpcodes; @@ -146,7 +148,21 @@ namespace Mesen.GUI.Debugger } } - private void AutoLoadDbgFile(bool silent) + private void AutoLoadCdlFiles() + { + if(ConfigManager.Config.DebugInfo.AutoLoadCdlFiles) { + //This loads CDL files that are next to the rom - useful when developing with a compiler that can produce a CDL file + RomInfo info = InteropEmu.GetRomInfo(); + string cdlPath = Path.Combine(info.RomFile.Folder, info.GetRomName() + ".cdl"); + if(File.Exists(cdlPath)) { + if(InteropEmu.DebugLoadCdlFile(cdlPath)) { + UpdateDebugger(); + } + } + } + } + + private void AutoLoadDbgFiles(bool silent) { if(ConfigManager.Config.DebugInfo.AutoLoadDbgFiles) { RomInfo info = InteropEmu.GetRomInfo(); @@ -232,7 +248,8 @@ namespace Mesen.GUI.Debugger mnuEditHeader.Enabled = mnuSaveRom.Enabled = InteropEmu.GetRomInfo().Format == RomFormat.iNes; this.UpdateWorkspace(); - this.AutoLoadDbgFile(true); + this.AutoLoadCdlFiles(); + this.AutoLoadDbgFiles(true); UpdateDebugger(); BreakpointManager.SetBreakpoints(); @@ -588,6 +605,7 @@ namespace Mesen.GUI.Debugger private void mnuResetCdlLog_Click(object sender, EventArgs e) { InteropEmu.DebugResetCdlLog(); + UpdateDebugger(); } private void ctrlBreakpoints_BreakpointNavigation(object sender, EventArgs e) @@ -778,8 +796,16 @@ namespace Mesen.GUI.Debugger if(_debuggerInitialized) { ConfigManager.Config.DebugInfo.AutoLoadDbgFiles = mnuAutoLoadDbgFiles.Checked; ConfigManager.ApplyChanges(); + AutoLoadDbgFiles(false); + } + } - AutoLoadDbgFile(false); + private void mnuAutoLoadCdlFiles_Click(object sender, EventArgs e) + { + if(_debuggerInitialized) { + ConfigManager.Config.DebugInfo.AutoLoadCdlFiles = mnuAutoLoadCdlFiles.Checked; + ConfigManager.ApplyChanges(); + AutoLoadCdlFiles(); } } diff --git a/InteropDLL/DebugWrapper.cpp b/InteropDLL/DebugWrapper.cpp index eb572637..d118d93c 100644 --- a/InteropDLL/DebugWrapper.cpp +++ b/InteropDLL/DebugWrapper.cpp @@ -73,7 +73,7 @@ extern "C" DllExport bool __stdcall DebugLoadCdlFile(char* cdlFilepath) { return GetDebugger()->LoadCdlFile(cdlFilepath); } DllExport bool __stdcall DebugSaveCdlFile(char* cdlFilepath) { return GetDebugger()->GetCodeDataLogger()->SaveCdlFile(cdlFilepath); } DllExport void __stdcall DebugGetCdlRatios(CdlRatios* cdlRatios) { *cdlRatios = GetDebugger()->GetCodeDataLogger()->GetRatios(); } - DllExport void __stdcall DebugResetCdlLog() { GetDebugger()->GetCodeDataLogger()->Reset(); } + DllExport void __stdcall DebugResetCdlLog() { GetDebugger()->ResetCdl(); } DllExport int32_t __stdcall DebugEvaluateExpression(char* expression, EvalResultType *resultType) { return GetDebugger()->EvaluateExpression(expression, *resultType); }