diff --git a/source/Cosmos.sln b/source/Cosmos.sln index 3b4ae9371..c4ccf8f99 100644 --- a/source/Cosmos.sln +++ b/source/Cosmos.sln @@ -94,7 +94,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Docs", "..\Docs", "{67E7DEF Release.AspNetCompiler.ForceOverwrite = "true" Release.AspNetCompiler.FixedNames = "false" Release.AspNetCompiler.Debug = "False" - VWDPort = "57005" + VWDPort = "2672" EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Debug.Consts", "..\source2\IL2CPU\Cosmos.IL2CPU.Debug\Cosmos.Debug.Consts.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 466ab9293..efe486571 100644 --- a/source2/Debug/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs @@ -139,12 +139,12 @@ namespace Cosmos.Debug.VSDebugEngine { var xGDBClient = false; Boolean.TryParse(mDebugInfo[BuildProperties.StartCosmosGDBString], out xGDBClient); - mProcessStartInfo = CreateHostProcessInfo("Cosmos.Launch.VMware.exe"); - + string xHostArgs = ""; if (mLaunch == LaunchType.VMware) { + OutputText("Preparing VMWare."); string xFlavor = mDebugInfo[BuildProperties.VMwareEditionString].ToUpper(); string xVmxFile = Path.Combine(PathUtilities.GetBuildDir(), @"VMWare\Workstation\Debug.vmx"); - + // Try alternate if selected one is not installed if (xFlavor == "PLAYER" && !Host.VMwarePlayer.IsInstalled) { xFlavor = "WORKSTATION"; @@ -153,15 +153,19 @@ namespace Cosmos.Debug.VSDebugEngine { } if (xFlavor == "PLAYER" && Host.VMwarePlayer.IsInstalled) { - mHost = new Host.VMwarePlayer(xVmxFile); + mHost = new Host.VMwarePlayer(mDebugInfo, xVmxFile); } else if (xFlavor == "WORKSTATION" && Host.VMwareWorkstation.IsInstalled) { - mHost = new Host.VMwareWorkstation(xVmxFile); + mHost = new Host.VMwareWorkstation(mDebugInfo, xVmxFile); } else { throw new Exception("VMWare Flavor '" + xFlavor + "' not implemented."); } - OutputText("Preparing VMWare."); - mProcessStartInfo.Arguments = mHost.Start(mDebugInfo["ISOFile"], xGDBDebugStub); + } else if (mLaunch == LaunchType.Slave) { + mHost = new Host.Slave(mDebugInfo); + + } else if (mLaunch == LaunchType.Manual) { + mHost = new Host.Manual(mDebugInfo); + } else { throw new Exception("Invalid Launch value: '" + mLaunch + "'."); } @@ -186,25 +190,30 @@ namespace Cosmos.Debug.VSDebugEngine { mDbgConnector = null; if (mLaunch == LaunchType.VMware) { - OutputText("Starting serial debug listener."); + OutputText("Starting pipe debug listener."); mDbgConnector = new Cosmos.Debug.Common.DebugConnectorPipeServer(); mDbgConnector.Connected = DebugConnectorConnected; } - aEngine.BPMgr.SetDebugConnector(mDbgConnector); - mDbgConnector.CmdTrace += new Action(DbgCmdTrace); - mDbgConnector.CmdText += new Action(DbgCmdText); - mDbgConnector.CmdStarted += new Action(DbgCmdStarted); - mDbgConnector.OnDebugMsg += new Action(DebugMsg); - mDbgConnector.ConnectionLost += new Action(DbgConnector_ConnectionLost); - mDbgConnector.CmdRegisters += new Action(DbgCmdRegisters); - mDbgConnector.CmdFrame += new Action(DbgCmdFrame); - mDbgConnector.CmdStack += new Action(DbgCmdStack); - mDbgConnector.CmdPong += new Action(DbgCmdPong); + if (mDbgConnector != null) { + aEngine.BPMgr.SetDebugConnector(mDbgConnector); + mDbgConnector.CmdTrace += new Action(DbgCmdTrace); + mDbgConnector.CmdText += new Action(DbgCmdText); + mDbgConnector.CmdStarted += new Action(DbgCmdStarted); + mDbgConnector.OnDebugMsg += new Action(DebugMsg); + mDbgConnector.ConnectionLost += new Action(DbgConnector_ConnectionLost); + mDbgConnector.CmdRegisters += new Action(DbgCmdRegisters); + mDbgConnector.CmdFrame += new Action(DbgCmdFrame); + mDbgConnector.CmdStack += new Action(DbgCmdStack); + mDbgConnector.CmdPong += new Action(DbgCmdPong); + } System.Threading.Thread.Sleep(250); + + OutputText("Starting launch debug host."); + mProcessStartInfo = CreateHostProcessInfo(mHost.GetHostProcessExe()); + mProcessStartInfo.Arguments = mHost.Start(xGDBDebugStub); System.Diagnostics.Debug.WriteLine(String.Format("Launching process: \"{0}\" {1}", mProcessStartInfo.FileName, mProcessStartInfo.Arguments).Trim()); - OutputText("Starting OS debug host."); mProcess = Process.Start(mProcessStartInfo); mProcess.EnableRaisingEvents = true; @@ -226,7 +235,6 @@ namespace Cosmos.Debug.VSDebugEngine { mCallback.OnThreadStart(mThread); mPort = aPort; - // Launch GDB Client if (xGDBDebugStub && xGDBClient) { LaunchGdbClient(); } diff --git a/source2/Debug/Cosmos.Debug.VSDebugEngine/Cosmos.Debug.VSDebugEngine.csproj b/source2/Debug/Cosmos.Debug.VSDebugEngine/Cosmos.Debug.VSDebugEngine.csproj index 696eb0d1b..6d7c9c14a 100644 --- a/source2/Debug/Cosmos.Debug.VSDebugEngine/Cosmos.Debug.VSDebugEngine.csproj +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/Cosmos.Debug.VSDebugEngine.csproj @@ -129,6 +129,8 @@ + + diff --git a/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Base.cs b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Base.cs index 5113c2505..1ee9ea422 100644 --- a/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Base.cs +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Base.cs @@ -1,11 +1,19 @@ using System; using System.Collections.Generic; +using System.Collections.Specialized; using System.Linq; using System.Text; namespace Cosmos.Debug.VSDebugEngine.Host { public abstract class Base { - public abstract string Start(string aIsoFile, bool aGDB); + protected NameValueCollection mParams; + + public Base(NameValueCollection aParams) { + mParams = aParams; + } + + public abstract string Start(bool aGDB); public abstract void Stop(); + public abstract string GetHostProcessExe(); } } diff --git a/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Manual.cs b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Manual.cs new file mode 100644 index 000000000..bef27dd43 --- /dev/null +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Manual.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using System.Text; + +namespace Cosmos.Debug.VSDebugEngine.Host { + public class Manual : Base { + + public Manual(NameValueCollection aParams) + : base(aParams) { + } + + public override string GetHostProcessExe() { + return "Cosmos.Launch.Manual.exe"; + } + + public override string Start(bool aGDB) { + return ""; + } + + public override void Stop() { + // TODO - Send off + } + } +} diff --git a/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Slave.cs b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Slave.cs new file mode 100644 index 000000000..cc74b94e6 --- /dev/null +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Slave.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using System.Text; +using Cosmos.Build.Common; + +namespace Cosmos.Debug.VSDebugEngine.Host { + public class Slave : Base { + + public Slave(NameValueCollection aParams) + : base(aParams) { + } + + public override string GetHostProcessExe() { + return "Cosmos.Launch.Slave.exe"; + } + + public override string Start(bool aGDB) { + var xPort = mParams[BuildProperties.SlavePortString]; + if (xPort == "None") { + throw new Exception("No slave port is set."); + } + + var xParts = xPort.Split(' '); + return mParams[xParts[1]]; + } + + public override void Stop() { + // TODO - Send off + } + } +} diff --git a/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWare.cs b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWare.cs index dd02d37b8..51e8189ff 100644 --- a/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWare.cs +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWare.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.Specialized; using System.IO; using System.Linq; using System.Text; @@ -11,10 +12,14 @@ namespace Cosmos.Debug.VSDebugEngine.Host { protected string mVmxFile; protected abstract void ConnectToVMWare(VMWareVirtualHost aHost); - public VMware(string aVmxFile) { + public VMware(NameValueCollection aParams, string aVmxFile) : base(aParams) { mVmxFile = aVmxFile; } + public override string GetHostProcessExe() { + return "Cosmos.Launch.VMware.exe"; + } + protected static string GetPathname(string aKey, string aEXE) { using (var xRegKey = Registry.LocalMachine.OpenSubKey(@"Software\VMware, Inc.\" + aKey, false)) { if (xRegKey != null) { @@ -29,7 +34,7 @@ namespace Cosmos.Debug.VSDebugEngine.Host { protected abstract string GetParams(); - public override string Start(string aIsoFile, bool aGDB) { + public override string Start(bool aGDB) { string xPath = Path.Combine(PathUtilities.GetBuildDir(), @"VMWare\Workstation\"); Cleanup(); @@ -54,7 +59,7 @@ namespace Cosmos.Debug.VSDebugEngine.Host { } else if (xName == "ide1:0.fileName") { // Set the ISO file for booting - xValue = "\"" + aIsoFile + "\""; + xValue = "\"" + mParams["ISOFile"] + "\""; } else if (xName == "nvram") { // Point it to an initially non-existent nvram. diff --git a/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWarePlayer.cs b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWarePlayer.cs index 754fc7404..be492e578 100644 --- a/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWarePlayer.cs +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWarePlayer.cs @@ -1,12 +1,14 @@ using System; using System.Collections.Generic; +using System.Collections.Specialized; using System.Linq; using System.Text; using Vestris.VMWareLib; namespace Cosmos.Debug.VSDebugEngine.Host { public class VMwarePlayer : VMware { - public VMwarePlayer(string aVmxFile) : base(aVmxFile) { + public VMwarePlayer(NameValueCollection aParams, string aVmxFile) + : base(aParams, aVmxFile) { } public static bool IsInstalled { diff --git a/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWareWorkstation.cs b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWareWorkstation.cs index 7d2c7cfd1..e2511fdf7 100644 --- a/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWareWorkstation.cs +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/Host/VMWareWorkstation.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.Specialized; using System.Linq; using System.Text; using System.IO; @@ -8,8 +9,8 @@ using Vestris.VMWareLib; namespace Cosmos.Debug.VSDebugEngine.Host { public class VMwareWorkstation : VMware { - public VMwareWorkstation(string aVmxFile) - : base(aVmxFile) { + public VMwareWorkstation(NameValueCollection aParams, string aVmxFile) + : base(aParams, aVmxFile) { } public static bool IsInstalled { diff --git a/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs b/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs index bfb55db7b..d1b19b29d 100644 --- a/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs +++ b/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs @@ -57,9 +57,7 @@ namespace Cosmos.VS.Package { Process.Start(xOutputPath); } - } else if (xLaunch == LaunchType.VMware) { - //TODO - Handle PXE - + } else { // http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.vsdebugtargetinfo_members.aspx var xInfo = new VsDebugTargetInfo(); xInfo.cbSize = (uint)Marshal.SizeOf(xInfo); @@ -84,9 +82,6 @@ namespace Cosmos.VS.Package { xInfo.clsidPortSupplier = new Guid("{708C1ECA-FF48-11D2-904F-00C04FA302A1}"); VsShellUtilities.LaunchDebugger(ProjectMgr.Site, xInfo); - - } else { - throw new Exception("Unknown launch type."); } } catch (Exception ex) { return Marshal.GetHRForException(ex);