mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 21:08:51 +00:00
This commit is contained in:
parent
895e8eb773
commit
7d78cbffef
10 changed files with 114 additions and 34 deletions
|
|
@ -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}"
|
||||
|
|
|
|||
|
|
@ -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<byte, uint>(DbgCmdTrace);
|
||||
mDbgConnector.CmdText += new Action<string>(DbgCmdText);
|
||||
mDbgConnector.CmdStarted += new Action(DbgCmdStarted);
|
||||
mDbgConnector.OnDebugMsg += new Action<string>(DebugMsg);
|
||||
mDbgConnector.ConnectionLost += new Action<Exception>(DbgConnector_ConnectionLost);
|
||||
mDbgConnector.CmdRegisters += new Action<byte[]>(DbgCmdRegisters);
|
||||
mDbgConnector.CmdFrame += new Action<byte[]>(DbgCmdFrame);
|
||||
mDbgConnector.CmdStack += new Action<byte[]>(DbgCmdStack);
|
||||
mDbgConnector.CmdPong += new Action<byte[]>(DbgCmdPong);
|
||||
if (mDbgConnector != null) {
|
||||
aEngine.BPMgr.SetDebugConnector(mDbgConnector);
|
||||
mDbgConnector.CmdTrace += new Action<byte, uint>(DbgCmdTrace);
|
||||
mDbgConnector.CmdText += new Action<string>(DbgCmdText);
|
||||
mDbgConnector.CmdStarted += new Action(DbgCmdStarted);
|
||||
mDbgConnector.OnDebugMsg += new Action<string>(DebugMsg);
|
||||
mDbgConnector.ConnectionLost += new Action<Exception>(DbgConnector_ConnectionLost);
|
||||
mDbgConnector.CmdRegisters += new Action<byte[]>(DbgCmdRegisters);
|
||||
mDbgConnector.CmdFrame += new Action<byte[]>(DbgCmdFrame);
|
||||
mDbgConnector.CmdStack += new Action<byte[]>(DbgCmdStack);
|
||||
mDbgConnector.CmdPong += new Action<byte[]>(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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@
|
|||
<Compile Include="Engine.Impl\OperationThread.cs" />
|
||||
<Compile Include="AD7.Impl\AD7Engine.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\VMwarePlayer.cs" />
|
||||
<Compile Include="Host\VMwareWorkstation.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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
26
source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Manual.cs
Normal file
26
source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Manual.cs
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
33
source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Slave.cs
Normal file
33
source2/Debug/Cosmos.Debug.VSDebugEngine/Host/Slave.cs
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue