internal DnNativeCodeBreakpoint(DnModuleId module, uint token, uint offset, Func<NativeCodeBreakpointConditionContext, bool> cond) : base(module, token, offset) { Condition = cond ?? defaultCond; }
IEnumerable<DnModule> GetLoadedDnModules(DnModuleId module) { foreach (var process in processes.GetAll()) { foreach (var appDomain in process.AppDomains) { foreach (var assembly in appDomain.Assemblies) { foreach (var dnMod in assembly.Modules) { if (dnMod.DnModuleId.Equals(module)) yield return dnMod; } } } } }
/// <summary> /// Creates a native instruction breakpoint /// </summary> /// <param name="module">Module</param> /// <param name="token">Method token</param> /// <param name="offset">Offset</param> /// <param name="cond">Condition</param> /// <returns></returns> public DnNativeCodeBreakpoint CreateNativeBreakpoint(DnModuleId module, uint token, uint offset, Func<NativeCodeBreakpointConditionContext, bool> cond) { DebugVerifyThread(); var bp = new DnNativeCodeBreakpoint(module, token, offset, cond); nativeCodeBreakpointList.Add(module, bp); foreach (var dnMod in GetLoadedDnModules(module)) bp.AddBreakpoint(dnMod); return bp; }
internal DnCodeBreakpoint(DnModuleId module, uint token, uint offset) { Module = module; Token = token; Offset = offset; code = null; }
public static ModuleId ToModuleId(this DnModuleId moduleId) => new ModuleId(moduleId.AssemblyFullName, moduleId.ModuleName, moduleId.IsDynamic, moduleId.IsInMemory, moduleId.ModuleNameOnly);
void SetILBreakpoint(DnModuleId moduleId, uint token) { Debug.Assert(token != 0 && breakpoint == null); DnBreakpoint bp = null; bp = debugger.CreateBreakpoint(moduleId, token, 0, ctx2 => { debugger.RemoveBreakpoint(bp); return true; }); }