当前位置: 首页>>代码示例>>C#>>正文


C# DnDebugger.TryAdd方法代码示例

本文整理汇总了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;
        }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:17,代码来源:DnDebugger.cs

示例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;
 }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:18,代码来源:DnDebugger.cs

示例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;
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:24,代码来源:DnDebugger.cs


注:本文中的dndbg.Engine.DnDebugger.TryAdd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。