mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
This commit is contained in:
parent
99c7f96792
commit
f19e133ef6
6 changed files with 91 additions and 78 deletions
|
|
@ -6,6 +6,8 @@ using Microsoft.VisualStudio;
|
|||
using Microsoft.VisualStudio.Debugger.Interop;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Collections.Specialized;
|
||||
using Cosmos.Debug.Common;
|
||||
|
||||
namespace Cosmos.Debug.VSDebugEngine
|
||||
{
|
||||
|
|
@ -355,6 +357,9 @@ namespace Cosmos.Debug.VSDebugEngine
|
|||
{
|
||||
m_engineCallback = new EngineCallback(this, aAD7Callback);
|
||||
|
||||
var xDebugInfo = new NameValueCollection();
|
||||
NameValueCollectionHelper.LoadFromString(xDebugInfo, aDebugInfo);
|
||||
|
||||
//string commandLine = EngineUtils.BuildCommandLine(exe, args);
|
||||
//ProcessLaunchInfo processLaunchInfo = new ProcessLaunchInfo(exe, commandLine, dir, env, options, launchFlags, hStdInput, hStdOutput, hStdError);
|
||||
// We are being asked to debug a process when we currently aren't debugging anything
|
||||
|
|
@ -365,53 +370,52 @@ namespace Cosmos.Debug.VSDebugEngine
|
|||
// var m_debuggedProcess = Worker.LaunchProcess(m_engineCallback, processLaunchInfo);
|
||||
//}));
|
||||
|
||||
|
||||
AD7EngineCreateEvent.Send(this);
|
||||
var xProcess = new AD7Process(aDebugInfo, m_engineCallback, this, aPort);
|
||||
aProcess = xProcess;
|
||||
mProcess = xProcess;
|
||||
m_ad7ProgramId = xProcess.mID;
|
||||
//AD7ThreadCreateEvent.Send(this, xProcess.Thread);
|
||||
mModule = new AD7Module();
|
||||
mProgNode = new AD7ProgramNode(EngineUtils.GetProcessId(xProcess));
|
||||
AD7EngineCreateEvent.Send(this);
|
||||
var xProcess = new AD7Process(xDebugInfo, m_engineCallback, this, aPort);
|
||||
aProcess = xProcess;
|
||||
mProcess = xProcess;
|
||||
m_ad7ProgramId = xProcess.mID;
|
||||
//AD7ThreadCreateEvent.Send(this, xProcess.Thread);
|
||||
mModule = new AD7Module();
|
||||
mProgNode = new AD7ProgramNode(EngineUtils.GetProcessId(xProcess));
|
||||
|
||||
|
||||
// DebuggedModule^ module = m_moduleList->First->Value;
|
||||
// DebuggedModule^ module = m_moduleList->First->Value;
|
||||
|
||||
//CComBSTR bstrModuleName;
|
||||
//CComBSTR bstrSymbolPath;
|
||||
//bstrModuleName.Attach((BSTR)(System::Runtime::InteropServices::Marshal::StringToBSTR(module->Name).ToInt32()));
|
||||
//CComBSTR bstrModuleName;
|
||||
//CComBSTR bstrSymbolPath;
|
||||
//bstrModuleName.Attach((BSTR)(System::Runtime::InteropServices::Marshal::StringToBSTR(module->Name).ToInt32()));
|
||||
|
||||
//// Load symbols for the application's exe. This is the only symbol file the sample engine will load.
|
||||
//if (m_pSymbolEngine->LoadSymbolsForModule(bstrModuleName, &bstrSymbolPath))
|
||||
//{
|
||||
// module->SymbolsLoaded = true;
|
||||
// module->SymbolPath = gcnew String(bstrSymbolPath);
|
||||
//}
|
||||
//// Load symbols for the application's exe. This is the only symbol file the sample engine will load.
|
||||
//if (m_pSymbolEngine->LoadSymbolsForModule(bstrModuleName, &bstrSymbolPath))
|
||||
//{
|
||||
// module->SymbolsLoaded = true;
|
||||
// module->SymbolPath = gcnew String(bstrSymbolPath);
|
||||
//}
|
||||
|
||||
//m_entrypointModule = module;
|
||||
//DebuggedThread^ thread = CreateThread(m_lastDebugEvent.dwThreadId, m_lastDebugEvent.u.CreateProcessInfo.hThread, (DWORD_PTR)m_lastDebugEvent.u.CreateProcessInfo.lpStartAddress);
|
||||
//m_entrypointModule = module;
|
||||
//DebuggedThread^ thread = CreateThread(m_lastDebugEvent.dwThreadId, m_lastDebugEvent.u.CreateProcessInfo.hThread, (DWORD_PTR)m_lastDebugEvent.u.CreateProcessInfo.lpStartAddress);
|
||||
|
||||
//if (m_debugMethod == Launch)
|
||||
//{
|
||||
// // Because of Com-re-entrancy, the engine must wait to send the fake mod-load and thread create events until after the
|
||||
// // launch is complete. Save these references so the call to ResumeFromLaunch can send the events.
|
||||
// m_entrypointModule = module;
|
||||
// m_entrypointThread = thread;
|
||||
//if (m_debugMethod == Launch)
|
||||
//{
|
||||
// // Because of Com-re-entrancy, the engine must wait to send the fake mod-load and thread create events until after the
|
||||
// // launch is complete. Save these references so the call to ResumeFromLaunch can send the events.
|
||||
// m_entrypointModule = module;
|
||||
// m_entrypointThread = thread;
|
||||
|
||||
// // Do not continue the create process event until after the call to ResumeFromLaunch.
|
||||
// fContinue = false;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // This is an attach.
|
||||
// // Fake up a thread create event for the entrypoint module and the first thread in the process for attach
|
||||
//m_callback->OnModuleLoad(module);
|
||||
// // Do not continue the create process event until after the call to ResumeFromLaunch.
|
||||
// fContinue = false;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // This is an attach.
|
||||
// // Fake up a thread create event for the entrypoint module and the first thread in the process for attach
|
||||
//m_callback->OnModuleLoad(module);
|
||||
|
||||
//m_callback->OnSymbolSearch(module, module->SymbolPath, module->SymbolsLoaded);
|
||||
// m_callback->OnThreadStart(thread);
|
||||
//}
|
||||
return VSConstants.S_OK;
|
||||
//m_callback->OnSymbolSearch(module, module->SymbolPath, module->SymbolsLoaded);
|
||||
// m_callback->OnThreadStart(thread);
|
||||
//}
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -123,12 +123,13 @@ namespace Cosmos.Debug.VSDebugEngine {
|
|||
|
||||
public string mISO;
|
||||
public string mProjectFile;
|
||||
internal AD7Process(string aDebugInfo, EngineCallback aCallback, AD7Engine aEngine, IDebugPort2 aPort) {
|
||||
internal AD7Process(NameValueCollection aDebugInfo, EngineCallback aCallback, AD7Engine aEngine, IDebugPort2 aPort)
|
||||
{
|
||||
mCallback = aCallback;
|
||||
|
||||
// Load passed in values
|
||||
mDebugInfo = new NameValueCollection();
|
||||
NameValueCollectionHelper.LoadFromString(mDebugInfo, aDebugInfo);
|
||||
mDebugInfo = aDebugInfo;
|
||||
|
||||
//
|
||||
mISO = mDebugInfo["ISOFile"];
|
||||
mProjectFile = mDebugInfo["ProjectFile"];
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BuildTarget>VMWare</BuildTarget>
|
||||
<BuildTarget>ISO</BuildTarget>
|
||||
<Framework>MicrosoftNET</Framework>
|
||||
<UseInternalAssembler>False</UseInternalAssembler>
|
||||
<DebugMode>Source</DebugMode>
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BreakpointsKernel\BreakpointsKernel.csproj">
|
||||
<ProjectReference Include="..\Breakpoints\BreakpointsKernel.csproj">
|
||||
<Name>BreakpointsKernel</Name>
|
||||
<Project>{91cbd640-c07d-4556-b4cb-6f8cd88c67c9}</Project>
|
||||
<Private>True</Private>
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ namespace Cosmos.VS.Package {
|
|||
private void comboTarget_SelectedIndexChanged(object sender, EventArgs e) {
|
||||
var xEnumValue = (EnumValue)comboTarget.SelectedItem;
|
||||
var xValue = (TargetHost)xEnumValue.Value;
|
||||
if (xValue != TargetHost.VMWare) {
|
||||
if (xValue != TargetHost.VMWare && xValue != TargetHost.ISO) {
|
||||
MessageBox.Show("This type is temporarily unsupported.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ namespace Cosmos.VS.Package.Templates.Wizards
|
|||
|
||||
public void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RunFinished()
|
||||
|
|
|
|||
|
|
@ -29,46 +29,53 @@ namespace Cosmos.VS.Package
|
|||
LogUtility.LogString("Entering Cosmos.VS.Package.VsProjectConfig.DebugLaunch({0})", aLaunch);
|
||||
try
|
||||
{
|
||||
// http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.vsdebugtargetinfo_members.aspx
|
||||
var xInfo = new VsDebugTargetInfo();
|
||||
xInfo.cbSize = (uint)Marshal.SizeOf(xInfo);
|
||||
if (String.Equals(this.GetConfigurationProperty("BuildTarget", true), "ISO", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
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);
|
||||
|
||||
xInfo.dlo = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess;
|
||||
xInfo.fSendStdoutToOutputWindow = 0; // App keeps its stdout
|
||||
xInfo.grfLaunch = aLaunch; // Just pass through for now.
|
||||
xInfo.bstrRemoteMachine = null; // debug locally
|
||||
xInfo.dlo = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess;
|
||||
xInfo.fSendStdoutToOutputWindow = 0; // App keeps its stdout
|
||||
xInfo.grfLaunch = aLaunch; // Just pass through for now.
|
||||
xInfo.bstrRemoteMachine = null; // debug locally
|
||||
|
||||
// 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
|
||||
// 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
|
||||
|
||||
var xValues = new NameValueCollection();
|
||||
xValues.Add("ISOFile", Path.Combine(Path.GetDirectoryName(ProjectMgr.GetOutputAssembly(this.ConfigName)), Path.GetFileNameWithoutExtension(ProjectMgr.GetOutputAssembly(this.ConfigName)) + ".iso"));
|
||||
xValues.Add("BinFormat", this.GetConfigurationProperty("BinFormat", true));
|
||||
xValues.Add("EnableGDB", this.GetConfigurationProperty("EnableGDB", true));
|
||||
xValues.Add("DebugMode", this.GetConfigurationProperty("DebugMode", true));
|
||||
xValues.Add("TraceAssemblies", this.GetConfigurationProperty("TraceAssemblies", true));
|
||||
xValues.Add("BuildTarget", this.GetConfigurationProperty("BuildTarget", true));
|
||||
xValues.Add("ProjectFile", Path.Combine(ProjectMgr.ProjectFolder, ProjectMgr.ProjectFile));
|
||||
xValues.Add("VMWareFlavor", this.GetConfigurationProperty("VMWareFlavor", true));
|
||||
xValues.Add("StartCosmosGDB", this.GetConfigurationProperty("StartCosmosGDB", true));
|
||||
var xValues = new NameValueCollection();
|
||||
xValues.Add("ISOFile", Path.Combine(Path.GetDirectoryName(ProjectMgr.GetOutputAssembly(this.ConfigName)), Path.GetFileNameWithoutExtension(ProjectMgr.GetOutputAssembly(this.ConfigName)) + ".iso"));
|
||||
xValues.Add("BinFormat", this.GetConfigurationProperty("BinFormat", true));
|
||||
xValues.Add("EnableGDB", this.GetConfigurationProperty("EnableGDB", true));
|
||||
xValues.Add("DebugMode", this.GetConfigurationProperty("DebugMode", true));
|
||||
xValues.Add("TraceAssemblies", this.GetConfigurationProperty("TraceAssemblies", true));
|
||||
xValues.Add("BuildTarget", this.GetConfigurationProperty("BuildTarget", true));
|
||||
xValues.Add("ProjectFile", Path.Combine(ProjectMgr.ProjectFolder, ProjectMgr.ProjectFile));
|
||||
xValues.Add("VMWareFlavor", this.GetConfigurationProperty("VMWareFlavor", true));
|
||||
xValues.Add("StartCosmosGDB", this.GetConfigurationProperty("StartCosmosGDB", true));
|
||||
|
||||
xInfo.bstrExe = NameValueCollectionHelper.DumpToString(xValues);
|
||||
xInfo.bstrExe = NameValueCollectionHelper.DumpToString(xValues);
|
||||
|
||||
LogUtility.LogString("Parameters = '{0}'", xInfo.bstrExe);
|
||||
LogUtility.LogString("Parameters = '{0}'", xInfo.bstrExe);
|
||||
|
||||
// Select the debugger
|
||||
// Managed debugger
|
||||
//xInfo.clsidCustom = VSConstants.CLSID_ComPlusOnlyDebugEngine;
|
||||
// Our debugger - a work in progress
|
||||
xInfo.clsidCustom = new Guid(AD7Engine.ID);
|
||||
xInfo.clsidPortSupplier = new Guid("{708C1ECA-FF48-11D2-904F-00C04FA302A1}");
|
||||
// Sample Debug Engine
|
||||
//xInfo.clsidCustom = new Guid("{D951924A-4999-42a0-9217-1EB5233D1D5A}");
|
||||
// Select the debugger
|
||||
// Managed debugger
|
||||
//xInfo.clsidCustom = VSConstants.CLSID_ComPlusOnlyDebugEngine;
|
||||
// Our debugger - a work in progress
|
||||
xInfo.clsidCustom = new Guid(AD7Engine.ID);
|
||||
xInfo.clsidPortSupplier = new Guid("{708C1ECA-FF48-11D2-904F-00C04FA302A1}");
|
||||
// Sample Debug Engine
|
||||
//xInfo.clsidCustom = new Guid("{D951924A-4999-42a0-9217-1EB5233D1D5A}");
|
||||
|
||||
VsShellUtilities.LaunchDebugger(ProjectMgr.Site, xInfo);
|
||||
LogUtility.LogString("Returning VSConstants.S_OK");
|
||||
return VSConstants.S_OK;
|
||||
VsShellUtilities.LaunchDebugger(ProjectMgr.Site, xInfo);
|
||||
LogUtility.LogString("Returning VSConstants.S_OK");
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue