/// Default constructor of the package. /// Inside this method you can place any initialization code that does not require /// any Visual Studio service because at this point the package object is created but /// not sited yet inside Visual Studio environment. The place to do all the other /// initialization is the Initialize method. public Cosmos_VS_WindowsPackage() { mCommand = new Queue <byte>(); mMessage = new Queue <byte[]>(); // There are a lot of threading issues in VSIP, and the WPF dispatchers do not work. // So instead we use a stack and a timer to poll it for data. mTimer.AutoReset = true; mTimer.Elapsed += new System.Timers.ElapsedEventHandler(ProcessMessage); mTimer.Start(); mPipeDown = new Cosmos.Debug.Common.PipeServer(Pipes.DownName); mPipeDown.DataPacketReceived += new Action <byte, byte[]>(PipeThread_DataPacketReceived); mPipeDown.Start(); mStateStorer = new StateStorer(); }
/// Default constructor of the package. /// Inside this method you can place any initialization code that does not require /// any Visual Studio service because at this point the package object is created but /// not sited yet inside Visual Studio environment. The place to do all the other /// initialization is the Initialize method. public Cosmos_VS_WindowsPackage() { mCommand = new Queue<ushort>(); mMessage = new Queue<byte[]>(); // There are a lot of threading issues in VSIP, and the WPF dispatchers do not work. // So instead we use a stack and a timer to poll it for data. mTimer.AutoReset = true; mTimer.Elapsed += new System.Timers.ElapsedEventHandler(ProcessMessage); mTimer.Start(); mPipeDown = new Cosmos.Debug.Common.PipeServer(Pipes.DownName); mPipeDown.DataPacketReceived += PipeThread_DataPacketReceived; mPipeDown.Start(); mStateStorer = new StateStorer(); }
internal AD7Process(NameValueCollection aDebugInfo, EngineCallback aCallback, AD7Engine aEngine, IDebugPort2 aPort) { mCallback = aCallback; mDebugInfo = aDebugInfo; mLaunch = (LaunchType)Enum.Parse(typeof(LaunchType), aDebugInfo[BuildPropertyNames.LaunchString]); if (mDebugDownPipe == null) { mDebugDownPipe = new Cosmos.Debug.Common.PipeClient(Pipes.DownName); mDebugUpPipe = new Cosmos.Debug.Common.PipeServer(Pipes.UpName); mDebugUpPipe.DataPacketReceived += mDebugUpPipe_DataPacketReceived; mDebugUpPipe.Start(); } else { mDebugUpPipe.CleanHandlers(); mDebugUpPipe.DataPacketReceived += mDebugUpPipe_DataPacketReceived; } // Must be after mDebugDownPipe is initialized OutputClear(); OutputText("Debugger process initialized."); mISO = mDebugInfo["ISOFile"]; OutputText("Using ISO file " + mISO + "."); mProjectFile = mDebugInfo["ProjectFile"]; // bool xUseGDB = string.Equals(mDebugInfo[BuildPropertyNames.EnableGDBString], "true", StringComparison.InvariantCultureIgnoreCase); OutputText("GDB " + (xUseGDB ? "Enabled" : "Disabled") + "."); // var xGDBClient = false; Boolean.TryParse(mDebugInfo[BuildPropertyNames.StartCosmosGDBString], out xGDBClient); switch (mLaunch) { case LaunchType.VMware: mHost = new Host.VMware(mDebugInfo, xUseGDB); break; case LaunchType.Slave: mHost = new Host.Slave(mDebugInfo, xUseGDB); break; case LaunchType.Bochs: // The project has been created on another machine or Bochs has been uninstalled since the project has // been created. if (!BochsSupport.BochsEnabled) { throw new Exception(ResourceStrings.BochsIsNotInstalled); } string bochsConfigurationFileName = mDebugInfo[BuildProperties.BochsEmulatorConfigurationFileString]; if (string.IsNullOrEmpty(bochsConfigurationFileName)) { bochsConfigurationFileName = BuildProperties.BochsDefaultConfigurationFileName; } if (!Path.IsPathRooted(bochsConfigurationFileName)) { // Assume the configuration file name is relative to project output path. bochsConfigurationFileName = Path.Combine(new FileInfo(mDebugInfo["ProjectFile"]).Directory.FullName, mDebugInfo["OutputPath"], bochsConfigurationFileName); } FileInfo bochsConfigurationFile = new FileInfo(bochsConfigurationFileName); // TODO : What if the configuration file doesn't exist ? This will throw a FileNotFoundException in // the Bochs class constructor. Is this appropriate behavior ? mHost = new Host.Bochs(mDebugInfo, xUseGDB, bochsConfigurationFile); //((Host.Bochs)mHost).FixBochsConfiguration(new KeyValuePair<string, string>[] { new KeyValuePair<string, string>("IsoFileName", mISO) }); break; case LaunchType.IntelEdison: mHost = new Host.IntelEdison(mDebugInfo, false); break; default: throw new Exception("Invalid Launch value: '" + mLaunch + "'."); } mHost.OnShutDown += HostShutdown; string xDbPath = Path.ChangeExtension(mISO, "cdb"); if (!File.Exists(xDbPath)) { throw new Exception("Debug data file " + xDbPath + " not found. Could be a omitted build process of Cosmos project so that not created."); } mDebugInfoDb = new DebugInfo(xDbPath); mDebugInfoDb.LoadLookups(); CreateDebugConnector(); aEngine.BPMgr.SetDebugConnector(mDbgConnector); mEngine = aEngine; mThread = new AD7Thread(aEngine, this); mCallback.OnThreadStart(mThread); mPort = aPort; if (xUseGDB && xGDBClient) { LaunchGdbClient(); } }
internal AD7Process(Dictionary <string, string> aDebugInfo, EngineCallback aCallback, AD7Engine aEngine, IDebugPort2 aPort) { mCallback = aCallback; mDebugInfo = aDebugInfo; mLaunch = (LaunchType)Enum.Parse(typeof(LaunchType), aDebugInfo[BuildPropertyNames.LaunchString]); if (mDebugDownPipe == null) { mDebugDownPipe = new PipeClient(Pipes.DownName); mDebugUpPipe = new PipeServer(Pipes.UpName); mDebugUpPipe.DataPacketReceived += mDebugUpPipe_DataPacketReceived; mDebugUpPipe.Start(); } else { mDebugUpPipe.CleanHandlers(); mDebugUpPipe.DataPacketReceived += mDebugUpPipe_DataPacketReceived; } // Must be after mDebugDownPipe is initialized OutputClear(); OutputText("Debugger process initialized."); mISO = mDebugInfo["ISOFile"]; OutputText("Using ISO file " + mISO + "."); mProjectFile = mDebugInfo["ProjectFile"]; // bool xUseGDB = string.Equals(mDebugInfo[BuildPropertyNames.EnableGDBString], "true", StringComparison.InvariantCultureIgnoreCase); OutputText("GDB " + (xUseGDB ? "Enabled" : "Disabled") + "."); // var xGDBClient = false; Boolean.TryParse(mDebugInfo[BuildPropertyNames.StartCosmosGDBString], out xGDBClient); switch (mLaunch) { case LaunchType.VMware: #region CheckIfHyperVServiceIsRunning using (System.ServiceProcess.ServiceController sc = new System.ServiceProcess.ServiceController("vmms")) { try { if (sc.Status == System.ServiceProcess.ServiceControllerStatus.Running) { AD7Util.MessageBox( "The Hyper-V Virtual Machine Management Service will be stopped. This is needed to allow to run VMware. If you press \"No\" the debug will stop.", "Question"); sc.Stop(); } } catch (InvalidOperationException) { // service not present } } #endregion CheckIfHyperVServiceIsRunning mHost = new VMware(mDebugInfo, xUseGDB); break; #if SERIAL_PORT case LaunchType.Slave: mHost = new Slave(mDebugInfo, xUseGDB); break; #endif case LaunchType.Bochs: // The project has been created on another machine or Bochs has been uninstalled since the project has // been created. if (!BochsSupport.BochsEnabled) { throw new Exception(Resources.BochsIsNotInstalled); } string bochsConfigurationFileName; mDebugInfo.TryGetValue(BuildProperties.BochsEmulatorConfigurationFileString, out bochsConfigurationFileName); if (string.IsNullOrEmpty(bochsConfigurationFileName)) { bochsConfigurationFileName = BuildProperties.BochsDefaultConfigurationFileName; } if (!Path.IsPathRooted(bochsConfigurationFileName)) { // Assume the configuration file name is relative to project output path. bochsConfigurationFileName = Path.Combine(new FileInfo(mDebugInfo["ProjectFile"]).Directory.FullName, mDebugInfo["OutputPath"], bochsConfigurationFileName); } FileInfo bochsConfigurationFile = new FileInfo(bochsConfigurationFileName); // TODO : What if the configuration file doesn't exist ? This will throw a FileNotFoundException in // the Bochs class constructor. Is this appropriate behavior ? mHost = new Bochs(mDebugInfo, xUseGDB, bochsConfigurationFile); //((Host.Bochs)mHost).FixBochsConfiguration(new KeyValuePair<string, string>[] { new KeyValuePair<string, string>("IsoFileName", mISO) }); break; case LaunchType.IntelEdison: mHost = new IntelEdison(mDebugInfo, false); break; case LaunchType.HyperV: mHost = new HyperV(mDebugInfo, false); break; default: throw new Exception("Invalid Launch value: '" + mLaunch + "'."); } mHost.OnShutDown += HostShutdown; string xDbPath = Path.ChangeExtension(mISO, "cdb"); if (!File.Exists(xDbPath)) { throw new Exception("Debug data file " + xDbPath + " not found. Could be a omitted build process of Cosmos project so that not created."); } mDebugInfoDb = new DebugInfo(xDbPath); mDebugInfoDb.LoadLookups(); CreateDebugConnector(); aEngine.BPMgr.SetDebugConnector(mDbgConnector); mEngine = aEngine; mThread = new AD7Thread(aEngine, this); mCallback.OnThreadStart(mThread); mPort = aPort; if (xUseGDB && xGDBClient) { LaunchGdbClient(); } }