This commit is contained in:
kudzu_cp 2012-07-01 19:56:14 +00:00
parent 895e8eb773
commit 7d78cbffef
10 changed files with 114 additions and 34 deletions

View file

@ -94,7 +94,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Docs", "..\Docs", "{67E7DEF
Release.AspNetCompiler.ForceOverwrite = "true" Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false" Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False" Release.AspNetCompiler.Debug = "False"
VWDPort = "57005" VWDPort = "2672"
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Debug.Consts", "..\source2\IL2CPU\Cosmos.IL2CPU.Debug\Cosmos.Debug.Consts.csproj", "{9998B4EA-385E-4DA2-8905-2BBEB5B2C6E2}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Debug.Consts", "..\source2\IL2CPU\Cosmos.IL2CPU.Debug\Cosmos.Debug.Consts.csproj", "{9998B4EA-385E-4DA2-8905-2BBEB5B2C6E2}"

View file

@ -139,9 +139,9 @@ namespace Cosmos.Debug.VSDebugEngine {
var xGDBClient = false; var xGDBClient = false;
Boolean.TryParse(mDebugInfo[BuildProperties.StartCosmosGDBString], out xGDBClient); Boolean.TryParse(mDebugInfo[BuildProperties.StartCosmosGDBString], out xGDBClient);
mProcessStartInfo = CreateHostProcessInfo("Cosmos.Launch.VMware.exe"); string xHostArgs = "";
if (mLaunch == LaunchType.VMware) { if (mLaunch == LaunchType.VMware) {
OutputText("Preparing VMWare.");
string xFlavor = mDebugInfo[BuildProperties.VMwareEditionString].ToUpper(); string xFlavor = mDebugInfo[BuildProperties.VMwareEditionString].ToUpper();
string xVmxFile = Path.Combine(PathUtilities.GetBuildDir(), @"VMWare\Workstation\Debug.vmx"); string xVmxFile = Path.Combine(PathUtilities.GetBuildDir(), @"VMWare\Workstation\Debug.vmx");
@ -153,15 +153,19 @@ namespace Cosmos.Debug.VSDebugEngine {
} }
if (xFlavor == "PLAYER" && Host.VMwarePlayer.IsInstalled) { if (xFlavor == "PLAYER" && Host.VMwarePlayer.IsInstalled) {
mHost = new Host.VMwarePlayer(xVmxFile); mHost = new Host.VMwarePlayer(mDebugInfo, xVmxFile);
} else if (xFlavor == "WORKSTATION" && Host.VMwareWorkstation.IsInstalled) { } else if (xFlavor == "WORKSTATION" && Host.VMwareWorkstation.IsInstalled) {
mHost = new Host.VMwareWorkstation(xVmxFile); mHost = new Host.VMwareWorkstation(mDebugInfo, xVmxFile);
} else { } else {
throw new Exception("VMWare Flavor '" + xFlavor + "' not implemented."); throw new Exception("VMWare Flavor '" + xFlavor + "' not implemented.");
} }
OutputText("Preparing VMWare."); } else if (mLaunch == LaunchType.Slave) {
mProcessStartInfo.Arguments = mHost.Start(mDebugInfo["ISOFile"], xGDBDebugStub); mHost = new Host.Slave(mDebugInfo);
} else if (mLaunch == LaunchType.Manual) {
mHost = new Host.Manual(mDebugInfo);
} else { } else {
throw new Exception("Invalid Launch value: '" + mLaunch + "'."); throw new Exception("Invalid Launch value: '" + mLaunch + "'.");
} }
@ -186,11 +190,12 @@ namespace Cosmos.Debug.VSDebugEngine {
mDbgConnector = null; mDbgConnector = null;
if (mLaunch == LaunchType.VMware) { if (mLaunch == LaunchType.VMware) {
OutputText("Starting serial debug listener."); OutputText("Starting pipe debug listener.");
mDbgConnector = new Cosmos.Debug.Common.DebugConnectorPipeServer(); mDbgConnector = new Cosmos.Debug.Common.DebugConnectorPipeServer();
mDbgConnector.Connected = DebugConnectorConnected; mDbgConnector.Connected = DebugConnectorConnected;
} }
if (mDbgConnector != null) {
aEngine.BPMgr.SetDebugConnector(mDbgConnector); aEngine.BPMgr.SetDebugConnector(mDbgConnector);
mDbgConnector.CmdTrace += new Action<byte, uint>(DbgCmdTrace); mDbgConnector.CmdTrace += new Action<byte, uint>(DbgCmdTrace);
mDbgConnector.CmdText += new Action<string>(DbgCmdText); mDbgConnector.CmdText += new Action<string>(DbgCmdText);
@ -201,10 +206,14 @@ namespace Cosmos.Debug.VSDebugEngine {
mDbgConnector.CmdFrame += new Action<byte[]>(DbgCmdFrame); mDbgConnector.CmdFrame += new Action<byte[]>(DbgCmdFrame);
mDbgConnector.CmdStack += new Action<byte[]>(DbgCmdStack); mDbgConnector.CmdStack += new Action<byte[]>(DbgCmdStack);
mDbgConnector.CmdPong += new Action<byte[]>(DbgCmdPong); mDbgConnector.CmdPong += new Action<byte[]>(DbgCmdPong);
}
System.Threading.Thread.Sleep(250); 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()); 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 = Process.Start(mProcessStartInfo);
mProcess.EnableRaisingEvents = true; mProcess.EnableRaisingEvents = true;
@ -226,7 +235,6 @@ namespace Cosmos.Debug.VSDebugEngine {
mCallback.OnThreadStart(mThread); mCallback.OnThreadStart(mThread);
mPort = aPort; mPort = aPort;
// Launch GDB Client
if (xGDBDebugStub && xGDBClient) { if (xGDBDebugStub && xGDBClient) {
LaunchGdbClient(); LaunchGdbClient();
} }

View file

@ -129,6 +129,8 @@
<Compile Include="Engine.Impl\OperationThread.cs" /> <Compile Include="Engine.Impl\OperationThread.cs" />
<Compile Include="AD7.Impl\AD7Engine.cs" /> <Compile Include="AD7.Impl\AD7Engine.cs" />
<Compile Include="Engine.Impl\EngineCallback.cs" /> <Compile Include="Engine.Impl\EngineCallback.cs" />
<Compile Include="Host\Manual.cs" />
<Compile Include="Host\Slave.cs" />
<Compile Include="Host\VMware.cs" /> <Compile Include="Host\VMware.cs" />
<Compile Include="Host\VMwarePlayer.cs" /> <Compile Include="Host\VMwarePlayer.cs" />
<Compile Include="Host\VMwareWorkstation.cs" /> <Compile Include="Host\VMwareWorkstation.cs" />

View file

@ -1,11 +1,19 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace Cosmos.Debug.VSDebugEngine.Host { namespace Cosmos.Debug.VSDebugEngine.Host {
public abstract class Base { 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 void Stop();
public abstract string GetHostProcessExe();
} }
} }

View file

@ -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
}
}
}

View file

@ -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
}
}
}

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -11,10 +12,14 @@ namespace Cosmos.Debug.VSDebugEngine.Host {
protected string mVmxFile; protected string mVmxFile;
protected abstract void ConnectToVMWare(VMWareVirtualHost aHost); protected abstract void ConnectToVMWare(VMWareVirtualHost aHost);
public VMware(string aVmxFile) { public VMware(NameValueCollection aParams, string aVmxFile) : base(aParams) {
mVmxFile = aVmxFile; mVmxFile = aVmxFile;
} }
public override string GetHostProcessExe() {
return "Cosmos.Launch.VMware.exe";
}
protected static string GetPathname(string aKey, string aEXE) { protected static string GetPathname(string aKey, string aEXE) {
using (var xRegKey = Registry.LocalMachine.OpenSubKey(@"Software\VMware, Inc.\" + aKey, false)) { using (var xRegKey = Registry.LocalMachine.OpenSubKey(@"Software\VMware, Inc.\" + aKey, false)) {
if (xRegKey != null) { if (xRegKey != null) {
@ -29,7 +34,7 @@ namespace Cosmos.Debug.VSDebugEngine.Host {
protected abstract string GetParams(); 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\"); string xPath = Path.Combine(PathUtilities.GetBuildDir(), @"VMWare\Workstation\");
Cleanup(); Cleanup();
@ -54,7 +59,7 @@ namespace Cosmos.Debug.VSDebugEngine.Host {
} else if (xName == "ide1:0.fileName") { } else if (xName == "ide1:0.fileName") {
// Set the ISO file for booting // Set the ISO file for booting
xValue = "\"" + aIsoFile + "\""; xValue = "\"" + mParams["ISOFile"] + "\"";
} else if (xName == "nvram") { } else if (xName == "nvram") {
// Point it to an initially non-existent nvram. // Point it to an initially non-existent nvram.

View file

@ -1,12 +1,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Vestris.VMWareLib; using Vestris.VMWareLib;
namespace Cosmos.Debug.VSDebugEngine.Host { namespace Cosmos.Debug.VSDebugEngine.Host {
public class VMwarePlayer : VMware { public class VMwarePlayer : VMware {
public VMwarePlayer(string aVmxFile) : base(aVmxFile) { public VMwarePlayer(NameValueCollection aParams, string aVmxFile)
: base(aParams, aVmxFile) {
} }
public static bool IsInstalled { public static bool IsInstalled {

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
@ -8,8 +9,8 @@ using Vestris.VMWareLib;
namespace Cosmos.Debug.VSDebugEngine.Host { namespace Cosmos.Debug.VSDebugEngine.Host {
public class VMwareWorkstation : VMware { public class VMwareWorkstation : VMware {
public VMwareWorkstation(string aVmxFile) public VMwareWorkstation(NameValueCollection aParams, string aVmxFile)
: base(aVmxFile) { : base(aParams, aVmxFile) {
} }
public static bool IsInstalled { public static bool IsInstalled {

View file

@ -57,9 +57,7 @@ namespace Cosmos.VS.Package {
Process.Start(xOutputPath); Process.Start(xOutputPath);
} }
} else if (xLaunch == LaunchType.VMware) { } else {
//TODO - Handle PXE
// http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.vsdebugtargetinfo_members.aspx // http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.vsdebugtargetinfo_members.aspx
var xInfo = new VsDebugTargetInfo(); var xInfo = new VsDebugTargetInfo();
xInfo.cbSize = (uint)Marshal.SizeOf(xInfo); xInfo.cbSize = (uint)Marshal.SizeOf(xInfo);
@ -84,9 +82,6 @@ namespace Cosmos.VS.Package {
xInfo.clsidPortSupplier = new Guid("{708C1ECA-FF48-11D2-904F-00C04FA302A1}"); xInfo.clsidPortSupplier = new Guid("{708C1ECA-FF48-11D2-904F-00C04FA302A1}");
VsShellUtilities.LaunchDebugger(ProjectMgr.Site, xInfo); VsShellUtilities.LaunchDebugger(ProjectMgr.Site, xInfo);
} else {
throw new Exception("Unknown launch type.");
} }
} catch (Exception ex) { } catch (Exception ex) {
return Marshal.GetHRForException(ex); return Marshal.GetHRForException(ex);