mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 12:58:39 +00:00
Better VMWare cleanup, moved ping button.
This commit is contained in:
parent
a981f8cf35
commit
01871e59cf
6 changed files with 52 additions and 19 deletions
|
|
@ -50,14 +50,42 @@ namespace Cosmos.Debug.VSDebugEngine {
|
|||
// Pipe to receive messages from Cosmos.VS.Windows
|
||||
static private Cosmos.Debug.Common.PipeServer mDebugUpPipe = null;
|
||||
|
||||
protected void DeleteFiles(string aPath, string aPattern) {
|
||||
var xFiles = Directory.GetFiles(aPath, aPattern);
|
||||
foreach (var xFile in xFiles) {
|
||||
File.Delete(xFile);
|
||||
}
|
||||
}
|
||||
|
||||
protected void LaunchVMWare(bool aGDB) {
|
||||
string xPath = Path.Combine(PathUtilities.GetBuildDir(), @"VMWare\Workstation") + @"\";
|
||||
string xDebugVmx = "Debug.vmx";
|
||||
|
||||
// VMWare doesn't like to boot a read only VMX.
|
||||
// We also need to make changes based on project / debug settings.
|
||||
// Finally we do not want to create VCS checkins based on local user changes.
|
||||
// Because of this we use Cosmos.vmx as a template and output a Debug.vmx on
|
||||
// every run.
|
||||
using (var xSrc = new StreamReader(xPath + "Cosmos.vmx")) {
|
||||
try {
|
||||
// This copy process also leaves the VMX writeable. VMWare doesnt like them read only.
|
||||
using (var xDest = new StreamWriter(xPath + xDebugVmx)) {
|
||||
// Delete old Debug.vmx and other files that might be left over from previous run
|
||||
// Especially important with newer versions of VMWare player which defaults to suspend
|
||||
// when the close button is used.
|
||||
File.Delete(Path.Combine(xPath, xDebugVmx));
|
||||
File.Delete(Path.Combine(xPath, Path.ChangeExtension(xDebugVmx, ".nvram")));
|
||||
// Delete the auto snapshots that latest vmware players create as default
|
||||
// It creates them with suffixes though, so we need to wild card find them
|
||||
DeleteFiles(xPath, "*.vmxf");
|
||||
DeleteFiles(xPath, "*.vmss");
|
||||
DeleteFiles(xPath, "*.vmsd");
|
||||
DeleteFiles(xPath, "*.vmem");
|
||||
// Delete log files so that logged data is only from last boot
|
||||
File.Delete(Path.Combine(xPath, "vmware.log"));
|
||||
File.Delete(Path.Combine(xPath, "vmware-0.log"));
|
||||
File.Delete(Path.Combine(xPath, "vmware-1.log"));
|
||||
File.Delete(Path.Combine(xPath, "vmware-2.log"));
|
||||
// Write out Debug.vmx
|
||||
using (var xDest = new StreamWriter(Path.Combine(xPath, xDebugVmx))) {
|
||||
string xLine;
|
||||
while ((xLine = xSrc.ReadLine()) != null) {
|
||||
var xParts = xLine.Split('=');
|
||||
|
|
@ -70,6 +98,8 @@ namespace Cosmos.Debug.VSDebugEngine {
|
|||
xValue = null;
|
||||
} else if (xName == "ide1:0.fileName") {
|
||||
xValue = "\"" + mDebugInfo["ISOFile"] + "\"";
|
||||
} else if (xName == "nvram") {
|
||||
xValue = "\"Debug.nvram\"";
|
||||
}
|
||||
|
||||
if (xValue != null) {
|
||||
|
|
@ -86,8 +116,9 @@ namespace Cosmos.Debug.VSDebugEngine {
|
|||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
if (e.Message.Contains(xDebugVmx))
|
||||
if (e.Message.Contains(xDebugVmx)) {
|
||||
throw new Exception("The Vmware image " + xDebugVmx + " is still in use! Please exit current Vmware session with Cosmos and try again!", e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@
|
|||
<Button Content="Copy" Name="butnCopy" BorderBrush="Black" Margin="2" />
|
||||
<Rectangle Width="15" />
|
||||
<Button Content="Step" Name="butnStep" BorderBrush="Black" Margin="2" />
|
||||
<Rectangle Width="15" />
|
||||
<Button Content="Ping VSIP" Name="butnPingVSIP" BorderBrush="Black" Margin="2" />
|
||||
<Button Content="Ping DS" Name="butnPingDS" BorderBrush="Black" Margin="2" />
|
||||
</ToolBar>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<TextBlock Name="tblkSource">
|
||||
|
|
|
|||
|
|
@ -64,8 +64,6 @@ namespace Cosmos.VS.Windows {
|
|||
butnFilter.Click += new RoutedEventHandler(butnFilter_Click);
|
||||
butnCopy.Click += new RoutedEventHandler(mitmCopy_Click);
|
||||
butnStep.Click += new RoutedEventHandler(butnStep_Click);
|
||||
butnPingVSIP.Click += new RoutedEventHandler(butnPingVSIP_Click);
|
||||
butnPingDS.Click += new RoutedEventHandler(butnPingDS_Click);
|
||||
|
||||
Update(null, mData);
|
||||
}
|
||||
|
|
@ -73,18 +71,11 @@ namespace Cosmos.VS.Windows {
|
|||
void butnStep_Click(object sender, RoutedEventArgs e) {
|
||||
}
|
||||
|
||||
void butnPingDS_Click(object sender, RoutedEventArgs e) {
|
||||
}
|
||||
|
||||
void butnFilter_Click(object sender, RoutedEventArgs e) {
|
||||
mFilter = !mFilter;
|
||||
Display(mFilter);
|
||||
}
|
||||
|
||||
void butnPingVSIP_Click(object sender, RoutedEventArgs e) {
|
||||
Global.mPipeUp.SendCommand(Cosmos.Debug.Consts.DwCmd.PingVSIP, null);
|
||||
}
|
||||
|
||||
void mitmCopy_Click(object sender, RoutedEventArgs e) {
|
||||
Clipboard.SetText(mCode.ToString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
// Guids.cs
|
||||
// MUST match guids.h - There is no such file???? I think its referencing old VS2005 style, but vsct is used now instead
|
||||
// MUST match guids.h - There is no such file???? I think its referencing old VS2005 style, but vsct is used now instead.
|
||||
using System;
|
||||
|
||||
namespace Cosmos.VS.Windows {
|
||||
static class GuidList {
|
||||
public const string guidCosmos_VS_WindowsPkgString = "a82b45e9-2a89-43bd-925d-c7f0edd212aa";
|
||||
// What is guidToolWindowPersistanceString used for?
|
||||
public const string guidToolWindowPersistanceString = "f019fb29-c2c2-4d27-9abf-739533c939be";
|
||||
public const string guidAsmToolbarCmdSetString = "A875EA24-689A-4EAB-B9C2-DAC3EACB9501";
|
||||
public const string guidCosmosMenuString = "3247C3E4-34B8-4DB0-8748-AD62495A5222";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@
|
|||
xmlns:local="clr-namespace:Cosmos.VS.Windows"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
<DockPanel LastChildFill="False">
|
||||
<ToolBar Height="35" Name="toolBar1" DockPanel.Dock="Top" HorizontalAlignment="Left">
|
||||
<Button Content="Ping VSIP" Name="butnPingVSIP" BorderBrush="Black" Margin="2" />
|
||||
<Button Content="Ping DS" Name="butnPingDS" BorderBrush="Black" Margin="2" />
|
||||
</ToolBar>
|
||||
</DockPanel>
|
||||
</local:DebuggerUC>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,16 @@ namespace Cosmos.VS.Windows {
|
|||
public partial class InternalUC : DebuggerUC {
|
||||
public InternalUC() {
|
||||
InitializeComponent();
|
||||
|
||||
butnPingVSIP.Click += new RoutedEventHandler(butnPingVSIP_Click);
|
||||
butnPingDS.Click += new RoutedEventHandler(butnPingDS_Click);
|
||||
}
|
||||
|
||||
void butnPingDS_Click(object sender, RoutedEventArgs e) {
|
||||
}
|
||||
|
||||
void butnPingVSIP_Click(object sender, RoutedEventArgs e) {
|
||||
Global.mPipeUp.SendCommand(Cosmos.Debug.Consts.DwCmd.PingVSIP, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue