本文整理汇总了C#中dndbg.Engine.DnDebugger.TryAdd方法的典型用法代码示例。如果您正苦于以下问题:C# DnDebugger.TryAdd方法的具体用法?C# DnDebugger.TryAdd怎么用?C# DnDebugger.TryAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dndbg.Engine.DnDebugger
的用法示例。
在下文中一共展示了DnDebugger.TryAdd方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Attach
public static DnDebugger Attach(AttachProcessOptions options)
{
var process = Process.GetProcessById(options.ProcessId);
var filename = process.MainModule.FileName;
string debuggeeVersion;
var corDebug = CreateCorDebug(options, out debuggeeVersion);
if (corDebug == null)
throw new Exception("An ICorDebug instance couldn't be created");
var dbg = new DnDebugger(corDebug, options.DebugOptions, options.DebugMessageDispatcher, debuggeeVersion);
ICorDebugProcess comProcess;
corDebug.DebugActiveProcess(options.ProcessId, 0, out comProcess);
var dnProcess = dbg.TryAdd(comProcess);
if (dnProcess != null)
dnProcess.Initialize(true, filename, string.Empty, string.Empty);
return dbg;
}
示例2: CreateDnDebuggerCoreCLR
static DnDebugger CreateDnDebuggerCoreCLR(DebugProcessOptions options)
{
var clrType = (CoreCLRTypeDebugInfo)options.CLRTypeDebugInfo;
var dbg2 = CoreCLRHelper.CreateDnDebugger(options, clrType, () => false, (cd, pid) => {
var dbg = new DnDebugger(cd, options.DebugOptions, options.DebugMessageDispatcher, null);
if (options.BreakProcessType != BreakProcessType.None)
new BreakProcessHelper(dbg, options.BreakProcessType, options.Filename);
ICorDebugProcess comProcess;
cd.DebugActiveProcess((int)pid, 0, out comProcess);
var dnProcess = dbg.TryAdd(comProcess);
if (dnProcess != null)
dnProcess.Initialize(false, options.Filename, options.CurrentDirectory, options.CommandLine);
return dbg;
});
if (dbg2 == null)
throw new Exception("Could not create a debugger instance");
return dbg2;
}
示例3: Attach
public static DnDebugger Attach(AttachProcessOptions options) {
ICLRRuntimeInfo rtInfo = null;
var process = Process.GetProcessById(options.ProcessId);
var filename = process.MainModule.FileName;
foreach (var t in GetCLRRuntimeInfos(process)) {
if (string.IsNullOrEmpty(options.DebuggeeVersion) || t.Item1 == options.DebuggeeVersion) {
rtInfo = t.Item2;
break;
}
}
if (rtInfo == null)
throw new Exception("Couldn't find a .NET runtime or the correct .NET runtime");
var clsid = new Guid("DF8395B5-A4BA-450B-A77C-A9A47762C520");
var riid = typeof(ICorDebug).GUID;
var corDebug = (ICorDebug)rtInfo.GetInterface(ref clsid, ref riid);
var dbg = new DnDebugger(corDebug, options.DebugOptions, options.DebugMessageDispatcher, options.DebuggeeVersion);
ICorDebugProcess comProcess;
corDebug.DebugActiveProcess(options.ProcessId, 0, out comProcess);
var dnProcess = dbg.TryAdd(comProcess);
if (dnProcess != null)
dnProcess.Initialize(true, filename, string.Empty, string.Empty);
return dbg;
}