mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +00:00
Code cleanup.
This commit is contained in:
parent
b17ce14982
commit
960cf85617
16 changed files with 146 additions and 196 deletions
|
|
@ -27,12 +27,12 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl {
|
|||
int IDebugBreakpointResolution2.GetResolutionInfo(enum_BPRESI_FIELDS dwFields, BP_RESOLUTION_INFO[] pBPResolutionInfo) {
|
||||
if ((dwFields & enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION) != enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION) {
|
||||
// The sample engine only supports code breakpoints.
|
||||
BP_RESOLUTION_LOCATION location = new BP_RESOLUTION_LOCATION();
|
||||
var location = new BP_RESOLUTION_LOCATION();
|
||||
location.bpType = (uint)enum_BP_TYPE.BPT_CODE;
|
||||
|
||||
// The debugger will not QI the IDebugCodeContex2 interface returned here. We must pass the pointer
|
||||
// to IDebugCodeContex2 and not IUnknown.
|
||||
AD7MemoryAddress codeContext = new AD7MemoryAddress(m_engine, m_address);
|
||||
var codeContext = new AD7MemoryAddress(m_engine, m_address);
|
||||
codeContext.SetDocumentContext(m_documentContext);
|
||||
location.unionmember1 = Marshal.GetComInterfaceForObject(codeContext, typeof(IDebugCodeContext2));
|
||||
pBPResolutionInfo[0].bpResLocation = location;
|
||||
|
|
@ -40,7 +40,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl {
|
|||
}
|
||||
|
||||
if (dwFields.HasFlag(enum_BPRESI_FIELDS.BPRESI_PROGRAM)) {
|
||||
pBPResolutionInfo[0].pProgram = (IDebugProgram2)m_engine;
|
||||
pBPResolutionInfo[0].pProgram = m_engine;
|
||||
pBPResolutionInfo[0].dwFields |= enum_BPRESI_FIELDS.BPRESI_PROGRAM;
|
||||
}
|
||||
|
||||
|
|
@ -67,5 +67,4 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,23 +42,14 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
// This object facilitates calling from this thread into the worker thread of the engine. This is necessary because the Win32 debugging
|
||||
// api requires thread affinity to several operations.
|
||||
// This object manages breakpoints in the sample engine.
|
||||
protected BreakpointManager mBPMgr;
|
||||
public BreakpointManager BPMgr
|
||||
{
|
||||
get { return mBPMgr; }
|
||||
}
|
||||
public BreakpointManager BPMgr { get; }
|
||||
|
||||
public AD7Engine()
|
||||
{
|
||||
mBPMgr = new BreakpointManager(this);
|
||||
BPMgr = new BreakpointManager(this);
|
||||
}
|
||||
|
||||
// Used to send events to the debugger. Some examples of these events are thread create, exception thrown, module load.
|
||||
EngineCallback mEngineCallback;
|
||||
internal EngineCallback Callback
|
||||
{
|
||||
get { return mEngineCallback; }
|
||||
}
|
||||
internal EngineCallback Callback { get; private set; }
|
||||
|
||||
#region Startup Methods
|
||||
// During startup these methods are called in this order:
|
||||
|
|
@ -81,7 +72,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
oProcess = null;
|
||||
try
|
||||
{
|
||||
mEngineCallback = new EngineCallback(this, aAD7Callback);
|
||||
Callback = new EngineCallback(this, aAD7Callback);
|
||||
|
||||
var xDebugInfo = new Dictionary<string, string>();
|
||||
DictionaryHelper.LoadFromString(xDebugInfo, aDebugInfo);
|
||||
|
|
@ -91,7 +82,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
//var processLaunchInfo = new ProcessLaunchInfo(exe, xCmdLine, dir, env, options, launchFlags, hStdInput, hStdOutput, hStdError);
|
||||
|
||||
AD7EngineCreateEvent.Send(this);
|
||||
oProcess = mProcess = new AD7Process(xDebugInfo, mEngineCallback, this, aPort);
|
||||
oProcess = mProcess = new AD7Process(xDebugInfo, Callback, this, aPort);
|
||||
// We only support one process, so just use its ID for the program ID
|
||||
mProgramID = mProcess.ID;
|
||||
//AD7ThreadCreateEvent.Send(this, xProcess.Thread);
|
||||
|
|
@ -121,7 +112,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
if (aCeltPrograms != 1)
|
||||
{
|
||||
System.Diagnostics.Debug.Fail("Cosmos Debugger only supports one debug target at a time.");
|
||||
throw new ArgumentException();
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
try
|
||||
|
|
@ -153,16 +144,15 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
{
|
||||
// Send a program node to the SDM. This will cause the SDM to turn around and call IDebugEngine2.Attach
|
||||
// which will complete the hookup with AD7
|
||||
var xProcess = aProcess as AD7Process;
|
||||
if (xProcess == null)
|
||||
if (!(aProcess is AD7Process xProcess))
|
||||
{
|
||||
return VSConstants.E_INVALIDARG;
|
||||
}
|
||||
IDebugPort2 xPort;
|
||||
EngineUtils.RequireOk(aProcess.GetPort(out xPort));
|
||||
|
||||
EngineUtils.RequireOk(aProcess.GetPort(out var xPort));
|
||||
|
||||
var xDefPort = (IDebugDefaultPort2)xPort;
|
||||
IDebugPortNotify2 xNotify;
|
||||
EngineUtils.RequireOk(xDefPort.GetPortNotify(out xNotify));
|
||||
EngineUtils.RequireOk(xDefPort.GetPortNotify(out var xNotify));
|
||||
|
||||
// This triggers Attach
|
||||
EngineUtils.RequireOk(xNotify.AddProgramNode(mProgNode));
|
||||
|
|
@ -208,7 +198,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
{
|
||||
if (aEvent is AD7ProgramDestroyEvent)
|
||||
{
|
||||
mEngineCallback = null;
|
||||
Callback = null;
|
||||
mProgramID = Guid.Empty;
|
||||
mThread = null;
|
||||
mProgNode = null;
|
||||
|
|
@ -268,7 +258,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
{
|
||||
mProcess.Terminate();
|
||||
|
||||
mEngineCallback.OnProcessExit(0);
|
||||
Callback.OnProcessExit(0);
|
||||
mProgram = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
@ -278,7 +268,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
return VSConstants.S_OK;
|
||||
}
|
||||
|
||||
public int Continue(IDebugThread2 aThread)
|
||||
public int Continue(IDebugThread2 pThread)
|
||||
{
|
||||
// We don't appear to use or support this currently.
|
||||
|
||||
|
|
@ -286,7 +276,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
// but have stepping state remain. An example is when a tracepoint is executed,
|
||||
// and the debugger does not want to actually enter break mode.
|
||||
|
||||
var xThread = (AD7Thread)aThread;
|
||||
var xThread = (AD7Thread)pThread;
|
||||
//if (AfterBreak) {
|
||||
//Callback.OnBreak(xThread);
|
||||
//}
|
||||
|
|
@ -327,22 +317,22 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
return VSConstants.S_OK;
|
||||
}
|
||||
|
||||
public int GetEngineInfo(out string engineName, out Guid engineGuid)
|
||||
public int GetEngineInfo(out string pbstrEngine, out Guid pguidEngine)
|
||||
{
|
||||
// Gets the name and identifier of the debug engine (DE) running this program.
|
||||
|
||||
engineName = "Cosmos Debug Engine";
|
||||
engineGuid = EngineID;
|
||||
pbstrEngine = "Cosmos Debug Engine";
|
||||
pguidEngine = EngineID;
|
||||
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
|
||||
public int GetProgramId(out Guid aGuidProgramId)
|
||||
public int GetProgramId(out Guid pguidProgramId)
|
||||
{
|
||||
// Gets a GUID for this program. A debug engine (DE) must return the program identifier originally passed to the IDebugProgramNodeAttach2::OnAttach
|
||||
// or IDebugEngine2::Attach methods. This allows identification of the program across debugger components.
|
||||
|
||||
aGuidProgramId = mProgramID;
|
||||
pguidProgramId = mProgramID;
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
|
||||
|
|
@ -350,7 +340,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
{
|
||||
// This method is deprecated. Use the IDebugProcess3::Step method instead.
|
||||
|
||||
mProcess.Step((enum_STEPKIND)sk);
|
||||
mProcess.Step(sk);
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
|
||||
|
|
@ -368,19 +358,19 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
|
||||
// Gets the name of the program.
|
||||
// The name returned by this method is always a friendly, user-displayable name that describes the program.
|
||||
public int GetName(out string programName)
|
||||
public int GetName(out string pbstrName)
|
||||
{
|
||||
// The Sample engine uses default transport and doesn't need to customize the name of the program,
|
||||
// so return NULL.
|
||||
programName = null;
|
||||
pbstrName = null;
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
|
||||
// This method gets the Edit and Continue (ENC) update for this program. A custom debug engine always returns E_NOTIMPL
|
||||
public int GetENCUpdate(out object update)
|
||||
public int GetENCUpdate(out object ppUpdate)
|
||||
{
|
||||
// The sample engine does not participate in managed edit & continue.
|
||||
update = null;
|
||||
ppUpdate = null;
|
||||
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
|
|
@ -445,17 +435,14 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
|
||||
// The debugger calls CauseBreak when the user clicks on the pause button in VS. The debugger should respond by entering
|
||||
// breakmode.
|
||||
public int CauseBreak()
|
||||
{
|
||||
return this.mProcess.CauseBreak();
|
||||
}
|
||||
public int CauseBreak() => mProcess.CauseBreak();
|
||||
|
||||
// EnumCodePaths is used for the step-into specific feature -- right click on the current statment and decide which
|
||||
// function to step into. This is not something that the SampleEngine supports.
|
||||
public int EnumCodePaths(string hint, IDebugCodeContext2 start, IDebugStackFrame2 frame, int fSource, out IEnumCodePaths2 pathEnum, out IDebugCodeContext2 safetyContext)
|
||||
public int EnumCodePaths(string pszHint, IDebugCodeContext2 pStart, IDebugStackFrame2 pFrame, int fSource, out IEnumCodePaths2 ppEnum, out IDebugCodeContext2 ppSafety)
|
||||
{
|
||||
pathEnum = null;
|
||||
safetyContext = null;
|
||||
ppEnum = null;
|
||||
ppSafety = null;
|
||||
return VSConstants.E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
|
@ -472,9 +459,9 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
|
||||
// The debugger calls this when it needs to obtain the IDebugDisassemblyStream2 for a particular code-context.
|
||||
// The sample engine does not support dissassembly so it returns E_NOTIMPL
|
||||
public int GetDisassemblyStream(enum_DISASSEMBLY_STREAM_SCOPE dwScope, IDebugCodeContext2 codeContext, out IDebugDisassemblyStream2 disassemblyStream)
|
||||
public int GetDisassemblyStream(enum_DISASSEMBLY_STREAM_SCOPE dwScope, IDebugCodeContext2 pCodeContext, out IDebugDisassemblyStream2 ppDisassemblyStream)
|
||||
{
|
||||
disassemblyStream = null;
|
||||
ppDisassemblyStream = null;
|
||||
return VSConstants.E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
|
@ -583,11 +570,11 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
return VSConstants.E_NOTIMPL;
|
||||
}
|
||||
|
||||
public int GetProcess(out IDebugProcess2 process)
|
||||
public int GetProcess(out IDebugProcess2 ppProcess)
|
||||
{
|
||||
System.Diagnostics.Debug.Fail("This function is not called by the debugger");
|
||||
|
||||
process = null;
|
||||
ppProcess = null;
|
||||
return VSConstants.E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,67 +27,64 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
}
|
||||
|
||||
// Adds a specified value to the current context's address to create a new context.
|
||||
public int Add(ulong dwCount, out IDebugMemoryContext2 newAddress)
|
||||
public int Add(ulong dwCount, out IDebugMemoryContext2 ppMemCxt)
|
||||
{
|
||||
newAddress = new AD7MemoryAddress(m_engine, (uint)dwCount + m_address);
|
||||
ppMemCxt = new AD7MemoryAddress(m_engine, (uint)dwCount + m_address);
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
|
||||
// Compares the memory context to each context in the given array in the manner indicated by compare flags,
|
||||
// returning an index of the first context that matches.
|
||||
public int Compare(enum_CONTEXT_COMPARE uContextCompare, IDebugMemoryContext2[] compareToItems, uint compareToLength, out uint foundIndex)
|
||||
public int Compare(enum_CONTEXT_COMPARE Compare, IDebugMemoryContext2[] rgpMemoryContextSet, uint dwMemoryContextSetLen, out uint pdwMemoryContext)
|
||||
{
|
||||
foundIndex = uint.MaxValue;
|
||||
pdwMemoryContext = UInt32.MaxValue;
|
||||
|
||||
try
|
||||
{
|
||||
enum_CONTEXT_COMPARE contextCompare = (enum_CONTEXT_COMPARE)uContextCompare;
|
||||
|
||||
for (uint c = 0; c < compareToLength; c++)
|
||||
for (uint c = 0; c < dwMemoryContextSetLen; c++)
|
||||
{
|
||||
AD7MemoryAddress compareTo = compareToItems[c] as AD7MemoryAddress;
|
||||
if (compareTo == null)
|
||||
if (!(rgpMemoryContextSet[c] is AD7MemoryAddress compareTo))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!AD7Engine.ReferenceEquals(this.m_engine, compareTo.m_engine))
|
||||
if (!ReferenceEquals(m_engine, compareTo.m_engine))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool result;
|
||||
|
||||
switch (contextCompare)
|
||||
switch (Compare)
|
||||
{
|
||||
case enum_CONTEXT_COMPARE.CONTEXT_EQUAL:
|
||||
result = (this.m_address == compareTo.m_address);
|
||||
result = (m_address == compareTo.m_address);
|
||||
break;
|
||||
|
||||
case enum_CONTEXT_COMPARE.CONTEXT_LESS_THAN:
|
||||
result = (this.m_address < compareTo.m_address);
|
||||
result = (m_address < compareTo.m_address);
|
||||
break;
|
||||
|
||||
case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN:
|
||||
result = (this.m_address > compareTo.m_address);
|
||||
result = (m_address > compareTo.m_address);
|
||||
break;
|
||||
|
||||
case enum_CONTEXT_COMPARE.CONTEXT_LESS_THAN_OR_EQUAL:
|
||||
result = (this.m_address <= compareTo.m_address);
|
||||
result = (m_address <= compareTo.m_address);
|
||||
break;
|
||||
|
||||
case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN_OR_EQUAL:
|
||||
result = (this.m_address >= compareTo.m_address);
|
||||
result = (m_address >= compareTo.m_address);
|
||||
break;
|
||||
|
||||
// The sample debug engine doesn't understand scopes or functions
|
||||
case enum_CONTEXT_COMPARE.CONTEXT_SAME_SCOPE:
|
||||
case enum_CONTEXT_COMPARE.CONTEXT_SAME_FUNCTION:
|
||||
result = (this.m_address == compareTo.m_address);
|
||||
result = (m_address == compareTo.m_address);
|
||||
break;
|
||||
|
||||
case enum_CONTEXT_COMPARE.CONTEXT_SAME_MODULE:
|
||||
result = (this.m_address == compareTo.m_address);
|
||||
result = (m_address == compareTo.m_address);
|
||||
if (result == false)
|
||||
{
|
||||
//DebuggedModule module = m_engine.DebuggedProcess.ResolveAddress(m_address);
|
||||
|
|
@ -111,7 +108,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
|
||||
if (result)
|
||||
{
|
||||
foundIndex = c;
|
||||
pdwMemoryContext = c;
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,16 +5,17 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Microsoft.Internal.VisualStudio.PlatformUI;
|
||||
using Microsoft.VisualStudio;
|
||||
using Microsoft.VisualStudio.Debugger.Interop;
|
||||
|
||||
using Cosmos.Build.Common;
|
||||
using Cosmos.Debug.Common;
|
||||
using Cosmos.Debug.DebugConnectors;
|
||||
using Cosmos.Debug.Hosts;
|
||||
using IL2CPU.Debug.Symbols;
|
||||
using Cosmos.VS.DebugEngine.Engine.Impl;
|
||||
using Cosmos.VS.DebugEngine.Utilities;
|
||||
|
||||
using IL2CPU.Debug.Symbols;
|
||||
using Label = IL2CPU.Debug.Symbols.Label;
|
||||
|
||||
namespace Cosmos.VS.DebugEngine.AD7.Impl
|
||||
|
|
@ -280,9 +281,8 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
private void CreateDebugConnector()
|
||||
{
|
||||
mDbgConnector = null;
|
||||
|
||||
string xPort;
|
||||
mDebugInfo.TryGetValue(BuildPropertyNames.VisualStudioDebugPortString, out xPort);
|
||||
|
||||
mDebugInfo.TryGetValue(BuildPropertyNames.VisualStudioDebugPortString, out var xPort);
|
||||
|
||||
// using (var xDebug = new StreamWriter(@"e:\debug.info", false))
|
||||
// {
|
||||
|
|
@ -298,10 +298,10 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
mDebugInfo.TryGetValue(BuildPropertyNames.CosmosDebugPortString, out xPort);
|
||||
}
|
||||
|
||||
var xParts = (null == xPort) ? null : xPort.Split(' ');
|
||||
var xParts = xPort?.Split(' ');
|
||||
if ((null == xParts) || (2 > xParts.Length))
|
||||
{
|
||||
throw new Exception(string.Format("Unable to parse VS debug port: '{0}'", xPort));
|
||||
throw new Exception(String.Format("Unable to parse VS debug port: '{0}'", xPort));
|
||||
//throw new Exception(string.Format(
|
||||
// "The '{0}' Cosmos project file property is either ill-formed or missing.",
|
||||
// BuildProperties.VisualStudioDebugPortString));
|
||||
|
|
@ -497,11 +497,10 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
OutputText("Using ISO file " + mISO + ".");
|
||||
mProjectFile = mDebugInfo["ProjectFile"];
|
||||
//
|
||||
bool xUseGDB = string.Equals(mDebugInfo[BuildPropertyNames.EnableGDBString], "true", StringComparison.InvariantCultureIgnoreCase);
|
||||
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);
|
||||
Boolean.TryParse(mDebugInfo[BuildPropertyNames.StartCosmosGDBString], out var xGDBClient);
|
||||
|
||||
switch (mLaunch)
|
||||
{
|
||||
|
|
@ -543,7 +542,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
string bochsConfigurationFileName;
|
||||
mDebugInfo.TryGetValue(BuildProperties.BochsEmulatorConfigurationFileString, out bochsConfigurationFileName);
|
||||
|
||||
if (string.IsNullOrEmpty(bochsConfigurationFileName))
|
||||
if (String.IsNullOrEmpty(bochsConfigurationFileName))
|
||||
{
|
||||
bochsConfigurationFileName = BuildProperties.BochsDefaultConfigurationFileName;
|
||||
}
|
||||
|
|
@ -598,9 +597,9 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
protected void LaunchGdbClient()
|
||||
{
|
||||
OutputText("Launching GDB client.");
|
||||
if (File.Exists(Cosmos.Build.Common.CosmosPaths.GdbClientExe))
|
||||
if (File.Exists(CosmosPaths.GdbClientExe))
|
||||
{
|
||||
var xPSInfo = new ProcessStartInfo(Cosmos.Build.Common.CosmosPaths.GdbClientExe);
|
||||
var xPSInfo = new ProcessStartInfo(CosmosPaths.GdbClientExe);
|
||||
xPSInfo.Arguments = "\"" + Path.ChangeExtension(mProjectFile, ".cgdb") + "\"" + @" /Connect";
|
||||
xPSInfo.UseShellExecute = false;
|
||||
xPSInfo.RedirectStandardInput = false;
|
||||
|
|
@ -611,9 +610,9 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
}
|
||||
else
|
||||
{
|
||||
AD7Util.MessageBox(string.Format(
|
||||
AD7Util.MessageBox(String.Format(
|
||||
"The GDB-Client could not be found at \"{0}\". Please deactivate it under \"Properties/Debug/Enable GDB\"",
|
||||
Cosmos.Build.Common.CosmosPaths.GdbClientExe), "GDB-Client");
|
||||
CosmosPaths.GdbClientExe), "GDB-Client");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -686,13 +685,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
mCallback.OnOutputStringUser(obj + "\r\n");
|
||||
}
|
||||
|
||||
internal AD7Thread Thread
|
||||
{
|
||||
get
|
||||
{
|
||||
return mThread;
|
||||
}
|
||||
}
|
||||
internal AD7Thread Thread => mThread;
|
||||
|
||||
void DbgCmdTrace(uint aAddress)
|
||||
{
|
||||
|
|
@ -1173,7 +1166,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
|
||||
string currentASMLine = mCurrentASMLine;
|
||||
|
||||
if (string.IsNullOrEmpty(currentASMLine))
|
||||
if (String.IsNullOrEmpty(currentASMLine))
|
||||
{
|
||||
mDbgConnector.SendCmd(Vs2Ds.AsmStepInto);
|
||||
}
|
||||
|
|
@ -1186,7 +1179,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
//Get the line after the call
|
||||
string nextASMLine = mNextASMLine1;
|
||||
uint? nextAddress = mNextAddress1;
|
||||
if (string.IsNullOrEmpty(nextASMLine) || !nextAddress.HasValue)
|
||||
if (String.IsNullOrEmpty(nextASMLine) || !nextAddress.HasValue)
|
||||
{
|
||||
mDbgConnector.SendCmd(Vs2Ds.AsmStepInto);
|
||||
}
|
||||
|
|
@ -1276,7 +1269,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
{
|
||||
xCurrentLabel = xCurrentLabels.OrderBy(q => q.Length).Last();
|
||||
}
|
||||
if (string.IsNullOrEmpty(xCurrentLabel))
|
||||
if (String.IsNullOrEmpty(xCurrentLabel))
|
||||
{
|
||||
xCurrentLabel = "NO_METHOD_LABEL_FOUND";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,13 +26,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
const uint mArrayFirstElementOffset = 16;
|
||||
private const string NULL = "null";
|
||||
|
||||
protected Int32 OFFSET
|
||||
{
|
||||
get
|
||||
{
|
||||
return mDebugInfo.OFFSET;
|
||||
}
|
||||
}
|
||||
protected int OFFSET => mDebugInfo.OFFSET;
|
||||
|
||||
public AD7Property(DebugLocalInfo localInfo, AD7Process process, AD7StackFrame stackFrame)
|
||||
{
|
||||
|
|
@ -124,17 +118,17 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
}
|
||||
if (xDataLength > 0)
|
||||
{
|
||||
if (this.m_variableInformation.Children.Count == 0)
|
||||
if (m_variableInformation.Children.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < xDataLength; i++)
|
||||
{
|
||||
DebugLocalInfo inf = new DebugLocalInfo();
|
||||
var inf = new DebugLocalInfo();
|
||||
inf.IsReference = true;
|
||||
inf.Type = typeof(T).FullName;
|
||||
inf.Offset = (int)(mArrayFirstElementOffset + (System.Runtime.InteropServices.Marshal.SizeOf(typeof(T)) * i));
|
||||
inf.Pointer = (uint)(xPointer + mArrayFirstElementOffset + (System.Runtime.InteropServices.Marshal.SizeOf(typeof(T)) * i));
|
||||
inf.Name = "[" + i.ToString() + "]";
|
||||
this.m_variableInformation.Children.Add(new AD7Property(inf, this.mProcess, this.mStackFrame));
|
||||
m_variableInformation.Children.Add(new AD7Property(inf, mProcess, mStackFrame));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -149,7 +143,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
// Construct a DEBUG_PROPERTY_INFO representing this local or parameter.
|
||||
public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields)
|
||||
{
|
||||
DEBUG_PROPERTY_INFO propertyInfo = new DEBUG_PROPERTY_INFO();
|
||||
var propertyInfo = new DEBUG_PROPERTY_INFO();
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -320,9 +314,13 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
for (int i = 0; (i / 2) < xDataLength; i += 2)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
xSB.Append(", ");
|
||||
}
|
||||
|
||||
char c = BitConverter.ToChar(xData, i);
|
||||
xSB.Append('\'');
|
||||
|
||||
if (c == '\0')
|
||||
{
|
||||
xSB.Append("\\0");
|
||||
|
|
@ -331,6 +329,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
{
|
||||
xSB.Append(c);
|
||||
}
|
||||
|
||||
xSB.Append('\'');
|
||||
|
||||
first = false;
|
||||
|
|
@ -494,7 +493,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
inf.Offset = xFieldInfo.OFFSET;
|
||||
inf.Pointer = (uint)(xPointer + xFieldInfo.OFFSET + 12);
|
||||
inf.Name = GetFieldName(xFieldInfo);
|
||||
this.m_variableInformation.Children.Add(new AD7Property(inf, this.mProcess, this.mStackFrame));
|
||||
m_variableInformation.Children.Add(new AD7Property(inf, mProcess, mStackFrame));
|
||||
}
|
||||
propertyInfo.bstrValue = String.Format("{0} (0x{1})", xPointer, xPointer.ToString("X").ToUpper());
|
||||
}
|
||||
|
|
@ -521,7 +520,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
// The sample does not support writing of values displayed in the debugger, so mark them all as read-only.
|
||||
propertyInfo.dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY;
|
||||
|
||||
if (this.m_variableInformation.Children.Count > 0)
|
||||
if (m_variableInformation.Children.Count > 0)
|
||||
{
|
||||
propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE;
|
||||
}
|
||||
|
|
@ -565,9 +564,9 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
{
|
||||
ppEnum = null;
|
||||
|
||||
if (this.m_variableInformation.Children.Count > 0)
|
||||
if (m_variableInformation.Children.Count > 0)
|
||||
{
|
||||
List<DEBUG_PROPERTY_INFO> infs = new List<DEBUG_PROPERTY_INFO>();
|
||||
var infs = new List<DEBUG_PROPERTY_INFO>();
|
||||
foreach (AD7Property dp in m_variableInformation.Children)
|
||||
{
|
||||
infs.Add(dp.ConstructDebugPropertyInfo(dwFields));
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio;
|
||||
using Microsoft.VisualStudio.Debugger.Interop;
|
||||
|
||||
using Cosmos.VS.DebugEngine.AD7.Definitions;
|
||||
using Cosmos.VS.DebugEngine.Engine.Impl;
|
||||
using Microsoft.VisualStudio.Debugger.Interop;
|
||||
using IL2CPU.Debug.Symbols;
|
||||
using Microsoft.VisualStudio;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
|
||||
namespace Cosmos.VS.DebugEngine.AD7.Impl
|
||||
{
|
||||
|
|
@ -24,8 +24,8 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
|
||||
// Must have empty holders, some code looks at length and can run
|
||||
// before we set them.
|
||||
internal LOCAL_ARGUMENT_INFO[] mLocalInfos = new LOCAL_ARGUMENT_INFO[] { };
|
||||
internal LOCAL_ARGUMENT_INFO[] mArgumentInfos = new LOCAL_ARGUMENT_INFO[] { };
|
||||
internal LOCAL_ARGUMENT_INFO[] mLocalInfos = Array.Empty<LOCAL_ARGUMENT_INFO>();
|
||||
internal LOCAL_ARGUMENT_INFO[] mArgumentInfos = Array.Empty<LOCAL_ARGUMENT_INFO>();
|
||||
|
||||
// An array of this frame's parameters
|
||||
private DebugLocalInfo[] mParams;
|
||||
|
|
@ -42,7 +42,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
var xProcess = mEngine.mProcess;
|
||||
if (mHasSource = xProcess.mCurrentAddress.HasValue)
|
||||
{
|
||||
UInt32 xAddress = xProcess.mCurrentAddress.Value;
|
||||
var xAddress = xProcess.mCurrentAddress.Value;
|
||||
var xSourceInfos = xProcess.mDebugInfoDb.GetSourceInfos(xAddress);
|
||||
if (!xSourceInfos.ContainsKey(xAddress))
|
||||
{
|
||||
|
|
@ -293,7 +293,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
{
|
||||
for (int i = 0; i < mLocals.Length; i++)
|
||||
{
|
||||
AD7Property property = new AD7Property(mLocals[i], this.mProcess, this);
|
||||
var property = new AD7Property(mLocals[i], mProcess, this);
|
||||
propInfo[i] = property.ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
|
||||
}
|
||||
}
|
||||
|
|
@ -302,7 +302,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
{
|
||||
for (int i = 0; i < mParams.Length; i++)
|
||||
{
|
||||
AD7Property property = new AD7Property(mParams[i], this.mProcess, this);
|
||||
var property = new AD7Property(mParams[i], mProcess, this);
|
||||
propInfo[localsLength + i] = property.ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
|
||||
}
|
||||
}
|
||||
|
|
@ -335,7 +335,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
|
||||
for (int i = 0; i < propInfo.Length; i++)
|
||||
{
|
||||
AD7Property property = new AD7Property(mParams[i], mProcess, this);
|
||||
var property = new AD7Property(mParams[i], mProcess, this);
|
||||
propInfo[i] = property.ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
|
||||
}
|
||||
|
||||
|
|
@ -459,7 +459,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
// or IDebugExpression2::EvaluateAsync methods to evaluate the parsed expression.
|
||||
int IDebugStackFrame2.GetExpressionContext(out IDebugExpressionContext2 ppExprCxt)
|
||||
{
|
||||
ppExprCxt = (IDebugExpressionContext2)this;
|
||||
ppExprCxt = this;
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
|
||||
|
|
@ -468,7 +468,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl
|
|||
{
|
||||
try
|
||||
{
|
||||
SetFrameInfo((enum_FRAMEINFO_FLAGS)dwFieldSpec, out pFrameInfo[0]);
|
||||
SetFrameInfo(dwFieldSpec, out pFrameInfo[0]);
|
||||
|
||||
return VSConstants.S_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace Cosmos.VS.DebugEngine.AD7.Impl {
|
|||
|
||||
xFrameInfoArray = new FRAMEINFO[1];
|
||||
var xFrame = new AD7StackFrame(mEngine, this, mProcess);
|
||||
xFrame.SetFrameInfo((enum_FRAMEINFO_FLAGS)aFieldSpec, out xFrameInfoArray[0]);
|
||||
xFrame.SetFrameInfo(aFieldSpec, out xFrameInfoArray[0]);
|
||||
|
||||
//} else {
|
||||
//frameInfoArray = new FRAMEINFO[numStackFrames];
|
||||
|
|
|
|||
|
|
@ -1,57 +1,26 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.VisualStudio.Debugger.Interop;
|
||||
|
||||
namespace Cosmos.VS.DebugEngine.AD7.Impl
|
||||
{
|
||||
public class DebugLocalInfo
|
||||
{
|
||||
public bool IsLocal
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public bool IsLocal { get; set; }
|
||||
|
||||
public bool IsReference
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public bool IsReference { get; set; }
|
||||
|
||||
public string Type
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Type { get; set; }
|
||||
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Name { get; set; }
|
||||
|
||||
public int Offset
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public int Offset { get; set; }
|
||||
|
||||
public uint Pointer
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
[SuppressMessage("Naming", "CA1720:Identifier contains type name", Scope = "member")]
|
||||
public uint Pointer { get; set; }
|
||||
|
||||
public int Index
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public int Index { get; set; }
|
||||
|
||||
private List<IDebugProperty2> m_children = new List<IDebugProperty2>();
|
||||
public List<IDebugProperty2> Children
|
||||
{
|
||||
get { return m_children; }
|
||||
set { m_children = value; }
|
||||
}
|
||||
public List<IDebugProperty2> Children { get; } = new List<IDebugProperty2>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,10 @@ namespace Cosmos.VS.DebugEngine
|
|||
|
||||
public static void MessageBox(string message, string title = "Cosmos Debug Engine")
|
||||
{
|
||||
ThreadHelper.ThrowIfNotOnUIThread();
|
||||
|
||||
VsShellUtilities.ShowMessageBox(ServiceProvider.GlobalProvider, message, title,
|
||||
OLEMSGICON.OLEMSGICON_NOICON, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ namespace Cosmos.VS.DebugEngine.Commands
|
|||
return VSConstants.S_OK;
|
||||
}
|
||||
|
||||
protected static bool IsQueryParameterList(System.IntPtr pvaIn, System.IntPtr pvaOut, uint nCmdexecopt)
|
||||
protected static bool IsQueryParameterList(IntPtr pvaIn, IntPtr pvaOut, uint nCmdexecopt)
|
||||
{
|
||||
ushort lo = (ushort)(nCmdexecopt & (uint)0xffff);
|
||||
ushort lo = (ushort)(nCmdexecopt & 0xffff);
|
||||
ushort hi = (ushort)(nCmdexecopt >> 16);
|
||||
if (lo == (ushort)OLECMDEXECOPT.OLECMDEXECOPT_SHOWHELP)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft;
|
||||
using Microsoft.VisualStudio;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
|
|
@ -43,6 +44,8 @@ namespace Cosmos.VS.DebugEngine.Commands
|
|||
}
|
||||
|
||||
var parseCommandLine = (IVsParseCommandLine)serviceProvider.GetService(typeof(SVsParseCommandLine));
|
||||
Assumes.Present(parseCommandLine);
|
||||
|
||||
hr = parseCommandLine.ParseCommandTail(arguments, iMaxParams: -1);
|
||||
|
||||
if (ErrorHandler.Failed(hr))
|
||||
|
|
@ -119,6 +122,8 @@ namespace Cosmos.VS.DebugEngine.Commands
|
|||
ThreadHelper.ThrowIfNotOnUIThread();
|
||||
|
||||
var debugger = (IVsDebugger4)serviceProvider.GetService(typeof(IVsDebugger));
|
||||
Assumes.Present(debugger);
|
||||
|
||||
var debugTargets = new VsDebugTargetInfo4[1];
|
||||
debugTargets[0].dlo = (uint)DEBUG_LAUNCH_OPERATION.DLO_CreateProcess;
|
||||
debugTargets[0].bstrExe = filePath;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft;
|
||||
using Microsoft.VisualStudio;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
|
|
@ -23,13 +24,13 @@ namespace Cosmos.VS.DebugEngine.Commands
|
|||
{
|
||||
}
|
||||
|
||||
public override int Execute(uint nCmdLogOpt, IntPtr pvaIn, IntPtr pvaOut)
|
||||
public override int Execute(uint nCmdExecOpt, IntPtr pvaIn, IntPtr pvaOut)
|
||||
{
|
||||
ThreadHelper.ThrowIfNotOnUIThread();
|
||||
|
||||
int hr;
|
||||
|
||||
if (IsQueryParameterList(pvaIn, pvaOut, nCmdLogOpt))
|
||||
if (IsQueryParameterList(pvaIn, pvaOut, nCmdExecOpt))
|
||||
{
|
||||
Marshal.GetNativeVariantForObject("$ /switchdefs:\"" + DebugLogCommandSyntax + "\"", pvaOut);
|
||||
return VSConstants.S_OK;
|
||||
|
|
@ -43,6 +44,8 @@ namespace Cosmos.VS.DebugEngine.Commands
|
|||
}
|
||||
|
||||
var parseCommandLine = (IVsParseCommandLine)serviceProvider.GetService(typeof(SVsParseCommandLine));
|
||||
Assumes.Present(parseCommandLine);
|
||||
|
||||
hr = parseCommandLine.ParseCommandTail(arguments, iMaxParams: -1);
|
||||
|
||||
if (ErrorHandler.Failed(hr))
|
||||
|
|
@ -106,6 +109,8 @@ namespace Cosmos.VS.DebugEngine.Commands
|
|||
catch (Exception e)
|
||||
{
|
||||
var commandWindow = (IVsCommandWindow)serviceProvider.GetService(typeof(SVsCommandWindow));
|
||||
Assumes.Present(commandWindow);
|
||||
|
||||
commandWindow.Print(String.Format(CultureInfo.CurrentCulture, "Error: {0}\r\n", e.Message));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
// A helper method used to construct a new pending breakpoint.
|
||||
public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP) {
|
||||
var pendingBreakpoint = new AD7PendingBreakpoint(pBPRequest, mEngine, this);
|
||||
ppPendingBP = (IDebugPendingBreakpoint2)pendingBreakpoint;
|
||||
ppPendingBP = pendingBreakpoint;
|
||||
mPendingBPs.Add(pendingBreakpoint);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,9 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
}
|
||||
|
||||
public void Send(IDebugEvent2 eventObject, string iidEvent, IDebugProgram2 program, IDebugThread2 thread) {
|
||||
uint attributes;
|
||||
var riidEvent = new Guid(iidEvent);
|
||||
|
||||
EngineUtils.RequireOk(eventObject.GetAttributes(out attributes));
|
||||
EngineUtils.RequireOk(eventObject.GetAttributes(out var attributes));
|
||||
EngineUtils.RequireOk(m_ad7Callback.Event(m_engine, null, program, thread, eventObject, ref riidEvent, attributes));
|
||||
}
|
||||
|
||||
|
|
@ -39,7 +38,7 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
// System.Diagnostics.Debug.Assert(Worker.CurrentThreadId == m_engine.DebuggedProcess.PollThreadId);
|
||||
//}
|
||||
|
||||
AD7ModuleLoadEvent eventObject = new AD7ModuleLoadEvent(aModule, true /* this is a module load */);
|
||||
var eventObject = new AD7ModuleLoadEvent(aModule, true /* this is a module load */);
|
||||
Send(eventObject, AD7ModuleLoadEvent.IID, null);
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +73,7 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
public void OnProcessExit(uint exitCode) {
|
||||
//System.Diagnostics.Debug.Assert(Worker.CurrentThreadId == m_engine.DebuggedProcess.PollThreadId);
|
||||
|
||||
AD7ProgramDestroyEvent eventObject = new AD7ProgramDestroyEvent(exitCode);
|
||||
var eventObject = new AD7ProgramDestroyEvent(exitCode);
|
||||
|
||||
Send(eventObject, AD7ProgramDestroyEvent.IID, null);
|
||||
}
|
||||
|
|
@ -98,7 +97,7 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
// System.Diagnostics.Debug.Assert(Worker.CurrentThreadId == m_engine.DebuggedProcess.PollThreadId);
|
||||
//}
|
||||
|
||||
AD7ThreadCreateEvent eventObject = new AD7ThreadCreateEvent();
|
||||
var eventObject = new AD7ThreadCreateEvent();
|
||||
Send(eventObject, AD7ThreadCreateEvent.IID, debuggedThread);
|
||||
}
|
||||
|
||||
|
|
@ -120,8 +119,7 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
// The sample engine does not support these features.
|
||||
var boundBreakpointsEnum = new AD7BoundBreakpointsEnum(boundBreakpoints);
|
||||
var eventObject = new AD7BreakpointEvent(boundBreakpointsEnum);
|
||||
var ad7Thread = (AD7Thread)thread;
|
||||
Send(eventObject, AD7BreakpointEvent.IID, ad7Thread);
|
||||
Send(eventObject, AD7BreakpointEvent.IID, thread);
|
||||
}
|
||||
|
||||
public void OnException() { //DebuggedThread thread, uint code)
|
||||
|
|
@ -155,7 +153,7 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
}
|
||||
|
||||
public void OnProgramDestroy(uint exitCode) {
|
||||
AD7ProgramDestroyEvent eventObject = new AD7ProgramDestroyEvent(exitCode);
|
||||
var eventObject = new AD7ProgramDestroyEvent(exitCode);
|
||||
Send(eventObject, AD7ProgramDestroyEvent.IID, null);
|
||||
}
|
||||
|
||||
|
|
@ -163,17 +161,16 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
public void OnSymbolSearch(AD7Module module, string status, enum_MODULE_INFO_FLAGS dwStatusFlags) {
|
||||
string statusString = (dwStatusFlags == enum_MODULE_INFO_FLAGS.MIF_SYMBOLS_LOADED ? "Symbols Loaded - " : "No symbols loaded") + status;
|
||||
|
||||
AD7SymbolSearchEvent eventObject = new AD7SymbolSearchEvent(module, statusString, dwStatusFlags);
|
||||
var eventObject = new AD7SymbolSearchEvent(module, statusString, dwStatusFlags);
|
||||
Send(eventObject, AD7SymbolSearchEvent.IID, null);
|
||||
}
|
||||
|
||||
// Engines notify the debugger that a breakpoint has bound through the breakpoint bound event.
|
||||
public void OnBreakpointBound(object objBoundBreakpoint, uint address) {
|
||||
AD7BoundBreakpoint boundBreakpoint = (AD7BoundBreakpoint)objBoundBreakpoint;
|
||||
IDebugPendingBreakpoint2 pendingBreakpoint;
|
||||
((IDebugBoundBreakpoint2)boundBreakpoint).GetPendingBreakpoint(out pendingBreakpoint);
|
||||
var boundBreakpoint = (AD7BoundBreakpoint)objBoundBreakpoint;
|
||||
((IDebugBoundBreakpoint2)boundBreakpoint).GetPendingBreakpoint(out var pendingBreakpoint);
|
||||
|
||||
AD7BreakpointBoundEvent eventObject = new AD7BreakpointBoundEvent((AD7PendingBreakpoint)pendingBreakpoint, boundBreakpoint);
|
||||
var eventObject = new AD7BreakpointBoundEvent((AD7PendingBreakpoint)pendingBreakpoint, boundBreakpoint);
|
||||
Send(eventObject, AD7BreakpointBoundEvent.IID, null);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
}
|
||||
|
||||
if (exe[0] == '\"') {
|
||||
startQuote = string.Empty;
|
||||
startQuote = String.Empty;
|
||||
if (exe.Length == 1) {
|
||||
//throw new ComponentException(Constants.E_WIN32_INVALID_NAME);
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
if (exe.Length == 2 || endQuote != exe.Length - 1) {
|
||||
//throw new ComponentException(Constants.E_WIN32_INVALID_NAME);
|
||||
}
|
||||
afterExe = string.Empty;
|
||||
afterExe = String.Empty;
|
||||
}
|
||||
} else {
|
||||
// If it doesn't start with a quote, it shouldn't have any
|
||||
|
|
@ -36,7 +36,7 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
|
||||
if (args == null) {
|
||||
args = "";
|
||||
} else if (args != String.Empty) {
|
||||
} else if (args.Length != 0) {
|
||||
afterExe = "\" ";
|
||||
} else {
|
||||
afterExe = " ";
|
||||
|
|
@ -47,9 +47,8 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
|
||||
public static string GetAddressDescription(/*DebuggedModule module,*/AD7Engine engine, uint ip)
|
||||
{
|
||||
AD7StackFrame d = new AD7StackFrame(engine, engine.mThread, engine.mProcess);
|
||||
FRAMEINFO info;
|
||||
d.SetFrameInfo(enum_FRAMEINFO_FLAGS.FIF_FUNCNAME | enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS, out info);
|
||||
var d = new AD7StackFrame(engine, engine.mThread, engine.mProcess);
|
||||
d.SetFrameInfo(enum_FRAMEINFO_FLAGS.FIF_FUNCNAME | enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS, out var info);
|
||||
return info.m_bstrFuncName;
|
||||
|
||||
//string location = ip.ToString("x8", CultureInfo.InvariantCulture);
|
||||
|
|
@ -76,8 +75,8 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
}
|
||||
|
||||
public static int GetProcessId(IDebugProcess2 process) {
|
||||
AD_PROCESS_ID[] pid = new AD_PROCESS_ID[1];
|
||||
EngineUtils.RequireOk(process.GetPhysicalProcessId(pid));
|
||||
var pid = new AD_PROCESS_ID[1];
|
||||
RequireOk(process.GetPhysicalProcessId(pid));
|
||||
|
||||
if (pid[0].ProcessIdType != (uint)enum_AD_PROCESS_ID.AD_PROCESS_ID_SYSTEM) {
|
||||
return 0;
|
||||
|
|
@ -87,9 +86,7 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
}
|
||||
|
||||
public static int GetProcessId(IDebugProgram2 program) {
|
||||
IDebugProcess2 process;
|
||||
RequireOk(program.GetProcess(out process));
|
||||
|
||||
RequireOk(program.GetProcess(out var process));
|
||||
return GetProcessId(process);
|
||||
}
|
||||
|
||||
|
|
@ -102,4 +99,4 @@ namespace Cosmos.VS.DebugEngine.Engine.Impl {
|
|||
return (value & flagValue) != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Cosmos.VS.DebugEngine.Utilities
|
|||
{
|
||||
if (aMethod == null)
|
||||
{
|
||||
throw new ArgumentNullException("aMethod");
|
||||
throw new ArgumentNullException(nameof(aMethod));
|
||||
}
|
||||
var xBuilder = new StringBuilder(256);
|
||||
var xParts = aMethod.ToString().Split(' ');
|
||||
|
|
@ -125,4 +125,4 @@ namespace Cosmos.VS.DebugEngine.Utilities
|
|||
return ((aThis & aFlag) == aFlag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue