From 736daaac0e158bc982fe57fa3b343f615e7ae31c Mon Sep 17 00:00:00 2001 From: kudzu_cp <6d05c8c8ef5431987001abfdb2eadc9593ac9498> Date: Thu, 28 Jun 2012 06:13:49 +0000 Subject: [PATCH] --- Setup2/Cosmos.iss | 5 +- .../Cosmos.Build.Common/BuildProperties.cs | 22 +- source2/Build/Cosmos.Build.Common/Enums.cs | 2 +- .../Build/Cosmos.Build.MSBuild/Cosmos.targets | 1 + source2/Build/Cosmos.Build.MSBuild/IL2CPU.cs | 212 +++++++++--------- .../Build/Cosmos.Build.MSBuild/IL2CPUTask.cs | 19 +- .../AD7.Impl/AD7Process.cs | 9 +- source2/Demos/Guess/Guess.Cosmos | 6 +- .../Cosmos.IL2CPU.X86/AppAssemblerNasm.cs | 3 +- source2/VSIP/Cosmos.VS.Package/CosmosPage.cs | 25 ++- .../Projects/Cosmos/CosmosProject.Cosmos | 59 ++--- .../Cosmos.VS.Package/VSProjectFactory.cs | 33 +-- .../VSIP/Cosmos.VS.Package/VsProjectConfig.cs | 6 +- .../Cosmos.VS.Wizards/CosmosProject.Cosmos | 74 +++--- 14 files changed, 219 insertions(+), 257 deletions(-) diff --git a/Setup2/Cosmos.iss b/Setup2/Cosmos.iss index bfa68dac5..9ad943ae2 100644 --- a/Setup2/Cosmos.iss +++ b/Setup2/Cosmos.iss @@ -137,9 +137,11 @@ Name: {code:VSNET2010_PATH}\ProjectTemplates\Cosmos; Flags: uninsalwaysuninstall Name: {app}; Flags: uninsalwaysuninstall [InstallDelete] -Type: files; Name: "{code:VSNET2010_PATH}\PrivateAssemblies\Cosmos.*" Type: filesandordirs; Name: "{app}" +Type: files; Name: "{code:VSNET2010_PATH}\PrivateAssemblies\Cosmos.*" Type: filesandordirs; Name: "{code:VSNET2010_PATH}\ProjectTemplates\Cosmos" +Type: filesandordirs; Name: "{userdocs}\Visual Studio 2010\Templates\ProjectTemplates\Cosmos"; +Type: filesandordirs; Name: "{userdocs}\Visual Studio 2010\Templates\ItemTemplates\Visual C#\Cosmos"; Type: filesandordirs; Name: "{code:GetCSharpExpress2010ProjectTemplatePath}\*Cosmos*.*"; Check: IsCSharpExpress2010Installed('dummy') and (not csharp2010_Installed('dummy')) [Files] @@ -383,6 +385,7 @@ Filename: {code:VSNET2010_PATH}\VSIXInstaller.exe; Parameters: "/quiet ""{app}\B ; Forces VS to merge the resource metadata that describes menus, toolbars, and command groups from all VSPackages available. #if BuildConfiguration == "Devkit" ; /setup without nosetupvstemplates takes a LONG time... so we dont run it every time.. for DevKit users, they will need to run it one time first as user kit - see new note above in X# template + ; Filename: {code:VSNET2010_PATH}\devenv.exe; Parameters: /setup Flags: waituntilterminated Filename: {code:VSNET2010_PATH}\devenv.exe; Parameters: /setup /nosetupvstemplates; Flags: waituntilterminated #else Filename: {code:VSNET2010_PATH}\devenv.exe; Parameters: /setup; Flags: waituntilterminated diff --git a/source2/Build/Cosmos.Build.Common/BuildProperties.cs b/source2/Build/Cosmos.Build.Common/BuildProperties.cs index c2c41bb5e..d5ac79b53 100644 --- a/source2/Build/Cosmos.Build.Common/BuildProperties.cs +++ b/source2/Build/Cosmos.Build.Common/BuildProperties.cs @@ -24,6 +24,20 @@ namespace Cosmos.Build.Common { set { SetProperty("Launch", value); } } + // Debug + public bool DebugEnabled { + get { return GetProperty("DebugEnabled", true); } + set { SetProperty("DebugEnabled", value); } + } + public DebugMode DebugMode { + get { return GetProperty("DebugMode", DebugMode.Source); } + set { SetProperty("DebugMode", value); } + } + public bool IgnoreDebugStubAttribute { + get { return GetProperty("IgnoreDebugStubAttribute", false); } + set { SetProperty("IgnoreDebugStubAttribute", value); } + } + // VMware public VMwareEdition VMwareEdition { get { return GetProperty("VMwareEdition", VMwareEdition.Player); } @@ -48,14 +62,6 @@ namespace Cosmos.Build.Common { set { SetProperty("TraceAssemblies", value); } } - public DebugMode DebugMode { - get { return GetProperty("DebugMode", DebugMode.Source); } - set { SetProperty("DebugMode", value); } - } - public bool IgnoreDebugStubAttribute { - get { return GetProperty("IgnoreDebugStubAttribute", false); } - set { SetProperty("IgnoreDebugStubAttribute", value); } - } public Boolean EnableGDB { get { return GetProperty("EnableGDB", false); } set { SetProperty("EnableGDB", value); } diff --git a/source2/Build/Cosmos.Build.Common/Enums.cs b/source2/Build/Cosmos.Build.Common/Enums.cs index 7883520c6..22b7feaf7 100644 --- a/source2/Build/Cosmos.Build.Common/Enums.cs +++ b/source2/Build/Cosmos.Build.Common/Enums.cs @@ -56,7 +56,7 @@ namespace Cosmos.Build.Common { Warning = 0, Error = 1, Informational = 2, Performance = 3 } public enum TraceAssemblies { All, Cosmos, User }; - public enum DebugMode { None, IL, Source } + public enum DebugMode { IL, Source } public sealed class DescriptionAttribute : Attribute { public static String GetDescription(object value) { diff --git a/source2/Build/Cosmos.Build.MSBuild/Cosmos.targets b/source2/Build/Cosmos.Build.MSBuild/Cosmos.targets index 48f6b1302..dc1698f71 100644 --- a/source2/Build/Cosmos.Build.MSBuild/Cosmos.targets +++ b/source2/Build/Cosmos.Build.MSBuild/Cosmos.targets @@ -30,6 +30,7 @@ q.ToString().ToUpper() == xBuildTarget).First(); + string xProfile = aDebugInfo["Profile"]; + mProfile = (Profile)Enum.Parse(typeof(Profile), xProfile); if (mDebugDownPipe == null) { mDebugDownPipe = new Cosmos.Debug.Common.PipeClient(Cosmos.Debug.Consts.Pipes.DownName); @@ -154,7 +153,7 @@ namespace Cosmos.Debug.VSDebugEngine { OutputText("Preparing VMWare."); mProcessStartInfo.Arguments = mHost.Start(mDebugInfo["ISOFile"], xGDBDebugStub); } else { - throw new Exception("Invalid BuildTarget value: '" + xBuildTarget + "'."); + throw new Exception("Invalid Profile value: '" + xProfile + "'."); } // Set to false for debugging, true otherwise @@ -190,7 +189,7 @@ namespace Cosmos.Debug.VSDebugEngine { mDbgConnector.Connected = DebugConnectorConnected; } if (mDbgConnector == null) { - throw new Exception("BuildTarget value not valid: '" + mProfile.ToString() + "'."); + throw new Exception("Profile value not valid: '" + mProfile.ToString() + "'."); } aEngine.BPMgr.SetDebugConnector(mDbgConnector); diff --git a/source2/Demos/Guess/Guess.Cosmos b/source2/Demos/Guess/Guess.Cosmos index 6d0514c61..5bc3f1783 100644 --- a/source2/Demos/Guess/Guess.Cosmos +++ b/source2/Demos/Guess/Guess.Cosmos @@ -14,7 +14,7 @@ SAK - + VMware true bin\Debug\ MicrosoftNET @@ -30,9 +30,10 @@ + True - + VMware true bin\Debug\ MicrosoftNET @@ -48,6 +49,7 @@ + True diff --git a/source2/IL2CPU/Cosmos.IL2CPU.X86/AppAssemblerNasm.cs b/source2/IL2CPU/Cosmos.IL2CPU.X86/AppAssemblerNasm.cs index fa0fce743..d840fb67b 100644 --- a/source2/IL2CPU/Cosmos.IL2CPU.X86/AppAssemblerNasm.cs +++ b/source2/IL2CPU/Cosmos.IL2CPU.X86/AppAssemblerNasm.cs @@ -426,6 +426,7 @@ namespace Cosmos.IL2CPU.X86 { } public TraceAssemblies TraceAssemblies; + public bool DebugEnabled = false; public DebugMode DebugMode; public bool IgnoreDebugStubAttribute; @@ -441,7 +442,7 @@ namespace Cosmos.IL2CPU.X86 { //TODO: Each IL op should exist in IL, and descendants in IL.X86. // Because of this we have this hack return; - } else if (DebugMode == DebugMode.None) { + } else if (DebugEnabled == false) { return; } else if (DebugMode == DebugMode.Source) { // If the current position equals one of the offsets, then we have diff --git a/source2/VSIP/Cosmos.VS.Package/CosmosPage.cs b/source2/VSIP/Cosmos.VS.Package/CosmosPage.cs index f81686b09..51e98a0ae 100644 --- a/source2/VSIP/Cosmos.VS.Package/CosmosPage.cs +++ b/source2/VSIP/Cosmos.VS.Package/CosmosPage.cs @@ -218,6 +218,8 @@ namespace Cosmos.VS.Package { }; chckEnableDebugStub.CheckedChanged += delegate(object aSender, EventArgs e) { panlDebugSettings.Enabled = chckEnableDebugStub.Checked; + mProps.DebugEnabled = chckEnableDebugStub.Checked; + IsDirty = true; }; comboTraceMode.Items.AddRange(EnumValue.GetEnumValues(typeof(TraceAssemblies), false)); @@ -285,6 +287,20 @@ namespace Cosmos.VS.Package { cmboVMwareEdition.SelectedItem = EnumValue.Find(cmboVMwareEdition.Items, mProps.VMwareEdition); #endregion + #region Debug + mProps.SetProperty("DebugEnabled", GetConfigProperty("DebugEnabled")); + chckEnableDebugStub.Checked = mProps.DebugEnabled; + + mProps.SetProperty("IgnoreDebugStubAttribute", GetConfigProperty("IgnoreDebugStubAttribute")); + checkIgnoreDebugStubAttribute.Checked = mProps.IgnoreDebugStubAttribute; + + mProps.SetProperty("DebugMode", GetConfigProperty("DebugMode")); + comboDebugMode.SelectedItem = EnumValue.Find(comboDebugMode.Items, mProps.DebugMode); + + mProps.SetProperty("TraceMode", GetConfigProperty("TraceMode")); + comboTraceMode.SelectedItem = EnumValue.Find(comboTraceMode.Items, mProps.TraceAssemblies); + #endregion + //TODO: Why are we copying these one by one instead of automatic? mProps.SetProperty("OutputPath", GetConfigProperty("OutputPath")); textOutputPath.Text = mProps.OutputPath; @@ -301,15 +317,6 @@ namespace Cosmos.VS.Package { mProps.SetProperty("StartCosmosGDB", GetConfigProperty("StartCosmosGDB")); checkStartCosmosGDB.Checked = mProps.StartCosmosGDB; - mProps.SetProperty("IgnoreDebugStubAttribute", GetConfigProperty("IgnoreDebugStubAttribute")); - checkIgnoreDebugStubAttribute.Checked = mProps.IgnoreDebugStubAttribute; - - mProps.SetProperty("DebugMode", GetConfigProperty("DebugMode")); - comboDebugMode.SelectedItem = EnumValue.Find(comboDebugMode.Items, mProps.DebugMode); - - mProps.SetProperty("TraceMode", GetConfigProperty("TraceMode")); - comboTraceMode.SelectedItem = EnumValue.Find(comboTraceMode.Items, mProps.TraceAssemblies); - UpdateUI(); } diff --git a/source2/VSIP/Cosmos.VS.Package/Templates/Projects/Cosmos/CosmosProject.Cosmos b/source2/VSIP/Cosmos.VS.Package/Templates/Projects/Cosmos/CosmosProject.Cosmos index 953a0fcf1..5453187a3 100644 --- a/source2/VSIP/Cosmos.VS.Package/Templates/Projects/Cosmos/CosmosProject.Cosmos +++ b/source2/VSIP/Cosmos.VS.Package/Templates/Projects/Cosmos/CosmosProject.Cosmos @@ -1,41 +1,24 @@  - - Debug - 2.0 - $guid1$ - false - $safeprojectname$ - elf - - - true - bin\Debug\ - MicrosoftNET - False - False - Source - User - VMWare - Player - false - - - true - bin\Release\ - MicrosoftNET - False - False - None - User - VMWare - Player - false - - - - - - + + Debug + 2.0 + $guid1$ + false + $safeprojectname$ + elf + + + VMware + true + bin\Debug\ + Source + User + + + + + + - + \ No newline at end of file diff --git a/source2/VSIP/Cosmos.VS.Package/VSProjectFactory.cs b/source2/VSIP/Cosmos.VS.Package/VSProjectFactory.cs index 64c9fb3a6..c4bbdee20 100644 --- a/source2/VSIP/Cosmos.VS.Package/VSProjectFactory.cs +++ b/source2/VSIP/Cosmos.VS.Package/VSProjectFactory.cs @@ -12,32 +12,21 @@ namespace Cosmos.VS.Package { private VSProject package; public VSProjectFactory(VSProject package) - : base(package) - { - LogUtility.LogString("Entering Cosmos.VS.Package.VSProjectFactory.ctor(VSProject)"); - this.package = package; - LogUtility.LogString("Exiting Cosmos.VS.Package.VSProjectFactory.ctor(VSProject)"); + : base(package) { + this.package = package; } protected override ProjectNode CreateProject() { - LogUtility.LogString("Entering Cosmos.VS.Package.VSProjectFactory.CreateProject()"); - try - { - VSProjectNode project = new VSProjectNode(this.package); + try { + var project = new VSProjectNode(this.package); - project.SetSite((IOleServiceProvider)((IServiceProvider)this.package).GetService(typeof(IOleServiceProvider))); - LogUtility.LogString("(Result == null) = {0}", project == null); - return project; - } - catch (Exception E) - { - LogUtility.LogException(E); - throw; - } - finally - { - LogUtility.LogString("Exiting Cosmos.VS.Package.VSProjectFactory.CreateProject()"); - } + project.SetSite((IOleServiceProvider)((IServiceProvider)this.package).GetService(typeof(IOleServiceProvider))); + LogUtility.LogString("(Result == null) = {0}", project == null); + return project; + } catch (Exception E) { + LogUtility.LogException(E); + throw; + } } } } diff --git a/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs b/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs index 149541f2e..c1c67490a 100644 --- a/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs +++ b/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs @@ -27,10 +27,8 @@ namespace Cosmos.VS.Package { // On first call, reset the cache, following calls will use the cached values // Think we will change this to a dummy program when we get our debugger working // This is the program that gest launched after build - string xBuildTarget = GetConfigurationProperty("Profile", true).ToUpper(); - // - var xEnumValues = (Profile[])Enum.GetValues(typeof(Profile)); - var xTarget = xEnumValues.Where(q => q.ToString().ToUpper() == xBuildTarget).First(); + string xProfile = GetConfigurationProperty("Profile", true); + var xTarget = (Profile)Enum.Parse(typeof(Profile), xProfile); string xOutputAsm = ProjectMgr.GetOutputAssembly(ConfigName); string xOutputPath = Path.GetDirectoryName(xOutputAsm); diff --git a/source2/VSIP/Cosmos.VS.Wizards/CosmosProject.Cosmos b/source2/VSIP/Cosmos.VS.Wizards/CosmosProject.Cosmos index 3099f43ba..50917d903 100644 --- a/source2/VSIP/Cosmos.VS.Wizards/CosmosProject.Cosmos +++ b/source2/VSIP/Cosmos.VS.Wizards/CosmosProject.Cosmos @@ -1,47 +1,33 @@  - - Debug - 2.0 - $CosmosProjGuid$ - false - $CosmosProjectName$ - elf - - - true - bin\Debug\ - MicrosoftNET - False - False - Source - User - VMWare - Player - false - - - true - bin\Release\ - MicrosoftNET - False - False - None - User - VMWare - Player - false - - - - $KernelName$ - $KernelGuid$ - - - - - - - + + Debug + 2.0 + $CosmosProjGuid$ + false + $CosmosProjectName$ + elf + + + VMware + true + Source + User + False + false + Player + bin\Debug\ + + + + $KernelName$ + $KernelGuid$ + + + + + + + - + \ No newline at end of file