From 0b7916a4bbb1ff713ef91ee7439da60159bf021e Mon Sep 17 00:00:00 2001 From: Sentinel209_cp <5b554accd9e292fcb886b205d8d4c32c5d52ce2df5Ng6vpx> Date: Tue, 5 Jul 2011 06:11:26 +0000 Subject: [PATCH] --- source/Cosmos.sln | 2 +- .../AD7.Impl/AD7Process.cs | 79 +++++++++++++------ .../Cosmos.VS.WindowsPackage.cs | 9 ++- 3 files changed, 63 insertions(+), 27 deletions(-) diff --git a/source/Cosmos.sln b/source/Cosmos.sln index fd6691226..6b2c7d259 100644 --- a/source/Cosmos.sln +++ b/source/Cosmos.sln @@ -88,7 +88,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Docs", "..\Docs", "{67E7DEF Release.AspNetCompiler.ForceOverwrite = "true" Release.AspNetCompiler.FixedNames = "false" Release.AspNetCompiler.Debug = "False" - VWDPort = "53094" + VWDPort = "11354" EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Compiler.Debug", "..\source2\IL2CPU\Cosmos.IL2CPU.Debug\Cosmos.Compiler.Debug.csproj", "{9998B4EA-385E-4DA2-8905-2BBEB5B2C6E2}" diff --git a/source2/Debug/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs b/source2/Debug/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs index 5e0888b17..238ca8331 100644 --- a/source2/Debug/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs @@ -491,37 +491,68 @@ namespace Cosmos.Debug.VSDebugEngine { public void SendAssembly() { //Get Current BP Label - string xCurrendBPLabel = mAddressLabelMappings[(uint)mCurrentAddress]; + bool xDone = false; + string xFile = string.Empty; + int xLine = 0; + int xCol = 0; + IList xKeys = mSourceMappings.Keys; + IList xValues = mSourceMappings.Values; + List xCurrentBPLabel = new List(); + xCurrentBPLabel.Add(mAddressLabelMappings[(uint)mCurrentAddress]); + int xIdx = xKeys.IndexOf((uint)mCurrentAddress); + xFile = xValues[xIdx].SourceFile; + xLine = xValues[xIdx].Line; + xCol = xValues[xIdx].Column; + while (!xDone) + { + xIdx++; + if (xIdx < xValues.Count) + { + SourceInfo xSI = xValues[xIdx]; + if ((xSI.SourceFile == xFile) && (xSI.Line == xLine) && (xSI.Column == xCol)) + { + xCurrentBPLabel.Add(mAddressLabelMappings[xKeys[xIdx]]); + } + else + { + xDone = true; + } + } + } + // Get ASM lines string xAsmDocumentName = Path.ChangeExtension(mISO, "asm"); - string xFile; + string xAsmFile; string[] xFileLines; + var xData = new StringBuilder(); using (var xTR = new StreamReader(xAsmDocumentName)) { - xFile = xTR.ReadToEnd(); + xAsmFile = xTR.ReadToEnd(); } - xFile = xFile.Replace('\r', ' '); - xFile = xFile.Trim(); - xFileLines = xFile.Split('\n'); - int k = 0, l = 0; - for (int j = 0; j < xFileLines.Length; j++) + xAsmFile = xAsmFile.Replace('\r', ' '); + xAsmFile = xAsmFile.Trim(); + xFileLines = xAsmFile.Split('\n'); + for (int a = 0; a < xCurrentBPLabel.Count; a++) { - if (xFileLines[j].Contains(xCurrendBPLabel)) - { - k = j; - j++; - } - if ((k != 0) && (xFileLines[j].Contains("System"))) - { - l = j - 2; - break; - } - } - var xData = new StringBuilder(); - for (int j = k; j < l; j++) - { - xData.AppendLine(xFileLines[j]); - } + int k = 0, l = 0; + for (int j = 0; j < xFileLines.Length; j++) + { + if (xFileLines[j].Contains(xCurrentBPLabel[a])) + { + k = j; + j++; + } + if ((k != 0) && (xFileLines[j].Contains("System"))) + { + l = j - 2; + break; + } + } + for (int j = k; j < l; j++) + { + xData.AppendLine(xFileLines[j]); + } + } DebugWindows.SendCommand(DwMsgType.AssemblySource, Encoding.ASCII.GetBytes(xData.ToString())); } } diff --git a/source2/VSIP/Cosmos.VS.Windows/Cosmos.VS.WindowsPackage.cs b/source2/VSIP/Cosmos.VS.Windows/Cosmos.VS.WindowsPackage.cs index 143024c4e..268a72e91 100644 --- a/source2/VSIP/Cosmos.VS.Windows/Cosmos.VS.WindowsPackage.cs +++ b/source2/VSIP/Cosmos.VS.Windows/Cosmos.VS.WindowsPackage.cs @@ -143,8 +143,13 @@ namespace Cosmos.Cosmos_VS_Windows void ProcessMessage(object sender, EventArgs e) { - var xCmd = mCommand.Dequeue(); - var xMsg = mMessage.Dequeue(); + byte xCmd = 0x0; + byte[] xMsg = {0x0}; + if ((mCommand.Count > 0) && (mMessage.Count > 0)) + { + xCmd = mCommand.Dequeue(); + xMsg = mMessage.Dequeue(); + } switch (xCmd) { case DwMsgType.Noop: