internal void UnloadModule(ICorDebugModule pModule) { if (moduleCache.TryRemove(pModule, out _)) { Console.WriteLine($"Unable to UNLOAD Module {pModule} from the cache"); } }
internal Module(AppDomain appDomain, ICorDebugModule corModule) { this.appDomain = appDomain; this.process = appDomain.Process; this.corModule = corModule; unresolvedAssembly = TypeSystemExtensions.LoadModuleAsync(this, corModule); metaData = new MetaDataImport(corModule); if (IsDynamic || IsInMemory) { name = corModule.GetName(); } else { fullPath = corModule.GetName(); name = System.IO.Path.GetFileName(FullPath); } SetJITCompilerFlags(); LoadSymbolsFromDisk(process.Options.SymbolsSearchPaths); ResetJustMyCode(); LoadSymbolsDynamic(); }
public UpdateModuleSymbolsDebugCallbackEventArgs(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule, IStream pSymbolStream) : base(pAppDomain) { AppDomain = pAppDomain; Module = pModule; SymbolStream = pSymbolStream; }
public MetaDataImport(ICorDebugModule pModule) { Guid guid = new Guid("{ 0x7dac8207, 0xd3ae, 0x4c75, { 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44 } }"); metaData = (IMetaDataImport)pModule.GetMetaDataInterface(ref guid); TrackedComObjects.Track(metaData); }
/* Get the module for the given metadata interface */ public CorModule GetModuleFromMetaDataInterface(IUnknown metadataInterface) { ICorDebugModule module = null; _ad().GetModuleFromMetaDataInterface(metadataInterface, out module); return(new CorModule(module)); }
public DebugMetadataImporter(ICorDebugModule module) { _module = module; Guid interfaceGuid = typeof(IMetadataImport).GUID; _module.GetMetaDataInterface(ref interfaceGuid, out _metadatImport); }
/** Get the module for the given metadata interface */ #if I_DONT_WANT_TO public DebuggedModule GetModuleFromMetaDataInterface(IUnknown metaData) { ICorDebugModule module = null; _ad().GetModuleFromMetaDataInterface(metaData, out module); return(new DebuggedModule(module)); }
internal DnModule(DnAssembly ownerAssembly, ICorDebugModule module, int incrementedId, int moduleOrder) { this.ownerAssembly = ownerAssembly; this.module = new CorModule(module); this.incrementedId = incrementedId; this.moduleOrder = moduleOrder; }
public MetaData(ICorDebugModule pModule) { Guid guid = new Guid("{ 0x7dac8207, 0xd3ae, 0x4c75, { 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44 } }"); metaData = (IMetaDataImport)pModule.GetMetaDataInterface(ref guid); ResourceManager.TrackCOMObject(metaData, typeof(IMetaDataImport)); }
internal void LoadModule(ICorDebugModule pModule, CorModule module) { if (moduleCache.TryAdd(pModule, module) == false) { Console.WriteLine($"Unable to LOAD Module {pModule}, {module} into the cache"); } }
// TODO change to use out param? like GetModule(..) and other APIs? internal CorModule GetCachedModule(ICorDebugModule pModule) { if (moduleCache.TryGetValue(pModule, out var module)) { return(module); } return(null); }
public CorModule(ICorDebugModule md) { corModule = md; char[] name = new char[300]; uint sz = 0; corModule.GetName((uint)name.Length, out sz, name); fullName = new String(name, 0, (int)(sz - 1)); }
void ICorDebugManagedCallback.LoadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { var ev = new CorModuleLoadEventArgs(new CorAppDomain(pAppDomain, p_options), new CorModule(pModule, p_options)); GetOwner(ev.Controller).DispatchEvent(ev); FinishEvent(ev); }
internal DnModule(DnAssembly ownerAssembly, ICorDebugModule module, int uniqueId, int uniqueIdProcess, int uniqueIdAppDomain) { Assembly = ownerAssembly; CorModule = new CorModule(module); UniqueId = uniqueId; UniqueIdProcess = uniqueIdProcess; UniqueIdAppDomain = uniqueIdAppDomain; DnModuleId = CorModule.GetModuleId((uint)UniqueId); }
public void UnloadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { EnterCallback(PausedReason.Other, "UnloadModule", pAppDomain); process.Modules.Remove(process.Modules[pModule]); ExitCallback(); }
public void LoadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { EnterCallback(PausedReason.Other, "LoadModule " + pModule.Name, pAppDomain); process.AddModule(pModule); ExitCallback(); }
public unsafe void LoadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { EnterCallback(PausedReason.Other, "LoadModule", pAppDomain); process.AddModule(pModule); ExitCallback_Continue(); }
public unsafe void LoadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { ManagedCallback managedCallback = GetProcessCallbackInterface("LoadModule", pAppDomain); if (managedCallback != null) { managedCallback.LoadModule(pAppDomain, pModule); } }
public void UpdateModuleSymbols(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule, IStream pSymbolStream) { ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain); if (managedCallback != null) { managedCallback.UpdateModuleSymbols(pAppDomain, pModule, pSymbolStream); } }
public void UnloadModule( ICorDebugAppDomain appDomain, ICorDebugModule module) { m_delegate.OnModuleUnload( new DebuggedModuleEventArgs( new DebuggedAppDomain(appDomain), new DebuggedModule(module))); }
internal DnModule(DnAssembly ownerAssembly, ICorDebugModule module, int uniqueId, int uniqueIdProcess, int uniqueIdAppDomain) { this.ownerAssembly = ownerAssembly; this.module = new CorModule(module); this.uniqueId = uniqueId; this.uniqueIdProcess = uniqueIdProcess; this.uniqueIdAppDomain = uniqueIdAppDomain; this.serializedDnModule = this.module.SerializedDnModule; }
internal DnModule(DnAssembly ownerAssembly, ICorDebugModule module, int uniqueId, int uniqueIdProcess, int uniqueIdAppDomain) { this.Assembly = ownerAssembly; this.CorModule = new CorModule(module); this.UniqueId = uniqueId; this.UniqueIdProcess = uniqueIdProcess; this.UniqueIdAppDomain = uniqueIdAppDomain; this.DnModuleId = this.CorModule.DnModuleId; }
public void UnloadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain); if (managedCallback != null) { managedCallback.UnloadModule(pAppDomain, pModule); } }
internal Module GetModule(ICorDebugModule corModule) { foreach(Module module in moduleCollection) { if (module.CorModule == corModule) { return module; } } throw new DebuggerException("Module is not in collection"); }
void ICorDebugManagedCallback.UnloadModule( ICorDebugAppDomain appDomain, ICorDebugModule managedModule) { if (DebugOutput) { Console.WriteLine("info: UnloadModule"); } appDomain.Continue(0); }
public void LoadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { EnterCallback(PausedReason.Other, "LoadModule " + pModule.GetName(), pAppDomain); Module module = new Module(process.AppDomains[pAppDomain], pModule); process.Modules.Add(module); ExitCallback(); }
public void UpdateModuleSymbols( ICorDebugAppDomain appDomain, ICorDebugModule module, IStream stream) { m_delegate.OnUpdateModuleSymbols( new UpdateModuleSymbolsEventArgs( new DebuggedAppDomain(appDomain), new DebuggedModule(module), stream)); }
// // IEnumerator interface // #region IEnumerator Members public bool MoveNext() { var a = new ICorDebugModule[1]; uint c = 0; int r = m_enum.Next((uint) a.Length, a, out c); if (r == 0 && c == 1) // S_OK && we got 1 new element m_mod = new CorModule(a[0]); else m_mod = null; return m_mod != null; }
void ICorDebugManagedCallback.UpdateModuleSymbols( ICorDebugAppDomain appDomain, ICorDebugModule managedModule, IStream stream) { if (DebugOutput) { Console.WriteLine("info: UpdateModuleSymbols"); } appDomain.Continue(0); }
public void LoadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { EnterCallback("LoadModule " + pModule.GetName(), pAppDomain); Module module = new Module(process.GetAppDomain(pAppDomain), pModule); process.modules.Add(module); process.OnModuleLoaded(module); ExitCallback(); }
internal void ModuleUnloaded(ICorDebugModule comModule) { var module = modules.TryGet(comModule); if (module == null) { return; } module.SetHasUnloaded(); modules.Remove(comModule); }
public void UnloadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { EnterCallback("UnloadModule", pAppDomain); Module module = process.GetModule(pModule); process.modules.Remove(module); process.OnModuleUnloaded(module); ExitCallback(); }
internal Module this[ICorDebugModule corModule] { get { foreach (Module module in this) { if (module.CorModule == corModule) { return(module); } } throw new DebuggerException("Module is not in collection"); } }
private IList<DebugModule> LoadModules() { ICorDebugModuleEnum modulesEnum; _assembly.EnumerateModules(out modulesEnum); uint modCount; modulesEnum.GetCount(out modCount); ICorDebugModule[] modules = new ICorDebugModule[modCount]; uint modulesFetched; modulesEnum.Next(modCount, modules, out modulesFetched); var result = new List<DebugModule>((int)modulesFetched); for (int i = 0; i < modulesFetched; i++) { result.Add(new DebugModule(modules[i])); } return result; }
internal Module(AppDomain appDomain, ICorDebugModule corModule) { this.appDomain = appDomain; this.process = appDomain.Process; this.corModule = corModule; metaData = new MetaDataImport(corModule); if (IsDynamic || IsInMemory) { name = corModule.GetName(); } else { fullPath = corModule.GetName(); name = System.IO.Path.GetFileName(FullPath); } asmFilename = corModule.GetAssembly().GetName(); SetJITCompilerFlags(); LoadSymbolsFromDisk(process.Options.SymbolsSearchPaths); ResetJustMyCodeStatus(); }
internal RuntimeModule(RuntimeAssembly assembly, ICorDebugModule comModule) { _assembly = assembly; _comModule = comModule; Symbols = _assembly.Domain.Process.Session.SymbolsServer.GetSymbolsProviderForFile(this.Name); if (Symbols != null) { int index = 0, max = Session.PendingBreakpoints.Count; Session.ProgressReporter.Report("Symbol reader present. Finding pending breakpoints to set."); while (index < max) { if (TrySetBreakpoint(Session.PendingBreakpoints[index])) { max--; Session.PendingBreakpoints.RemoveAt(index); } else { index++; } } } }
public DebuggerModuleLoadedEventArgs(ICorDebugModule module) { _module = module; }
public void UpdateModuleSymbols(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule, IStream pSymbolStream) { try { _EnterCallback(); _CallbackNotImplemented(); _CallbackEvent("UpdateModuleSymbols"); } catch (Exception e) { _CallbackException(e); } }
public void UnloadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { try { _EnterCallback(); lock (dbgproc) { dbgproc.imodules.Remove(pModule); } _ResumeCallback(); _CallbackEvent("UnloadModule"); } catch (Exception e) { _CallbackException(e); } }
public void LoadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { try { _EnterCallback(); string assemblyname; bool thismodule = false; lock (dbgproc) { dbgproc.imodules.Add(pModule); ICorDebugModule2 imod2 = pModule as ICorDebugModule2; if (null != imod2) { imod2.SetJITCompilerFlags(0x3); // CORDEBUG_JIT_DISABLE_OPTIMIZATION } //lock (dbgproc) { IntPtr pasmnamebuf = Marshal.AllocHGlobal(PATH_BUFFER_LENGTH * 2); uint asmnamelen = (uint)PATH_BUFFER_LENGTH; pModule.GetName(asmnamelen, out asmnamelen, pasmnamebuf); if (asmnamelen > PATH_BUFFER_LENGTH) { throw new Exception("Assembly path too long"); } asmnamelen--; // Remove nul. assemblyname = Marshal.PtrToStringUni(pasmnamebuf, (int)asmnamelen); Marshal.FreeHGlobal(pasmnamebuf); } if (assemblyname.EndsWith(".exe", true, null)) { thismodule = true; //lock (dbgproc) // ... { Guid CLSID_CorSymBinder = new Guid("0A29FF9E-7F9C-4437-8B11-F424491E3931"); ISymUnmanagedBinder binder = (ISymUnmanagedBinder)Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_CorSymBinder)); ICorDebugModule imod = pModule; //ICorDebugAssembly iasm; //imod.GetAssembly(out iasm); Guid CLSID_IMetaDataDispenser = new Guid(0xe5cb7a31, 0x7512, 0x11d2, 0x89, 0xce, 0x00, 0x80, 0xc7, 0x92, 0xe5, 0xd8); IMetaDataDispenser disp = (IMetaDataDispenser)Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_IMetaDataDispenser)); Guid CLSID_IMetaDataImport = new Guid(0x7dac8207, 0xd3ae, 0x4c75, 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44); object oimporter; disp.OpenScope(assemblyname, 0 /* OPEN_READ */, ref CLSID_IMetaDataImport, out oimporter); IntPtr pimporter = IntPtr.Zero; try { pimporter = Marshal.GetComInterfaceForObject(oimporter, typeof(IMMImport)); ISymUnmanagedReader reader; int hrreader = binder.GetReaderForFile(pimporter, assemblyname, null, out reader); if (0 == hrreader) { { System.Diagnostics.SymbolStore.SymbolToken symtok; int hruep = reader.GetUserEntryPoint(out symtok); if (0 == hruep) { //dbgproc.dout.WriteLine("Got entry point for " + assemblyname); ICorDebugFunction idbgFunc; imod.GetFunctionFromToken((uint)symtok.GetToken(), out idbgFunc); ICorDebugClass pclass; idbgFunc.GetClass(out pclass); ICorDebugFunctionBreakpoint pBkpt; idbgFunc.CreateBreakpoint(out pBkpt); pBkpt.Activate(1); dbgproc.EntryPointBreakpointSet = true; dbgproc.ProcessStarted = true; } } } else { dbgproc.EntryPointBreakpointSet = false; dbgproc.dout.WriteLine("Unable to find entry point (no debug information reader) for " + assemblyname); } } finally { if (IntPtr.Zero != pimporter) { Marshal.Release(pimporter); pimporter = IntPtr.Zero; } } } } //else { if (assemblyname.EndsWith(@"\mscorlib.dll", true, null)) { //lock (dbgproc) { dbgproc.imoduleMscorlib = pModule; } } } } _ResumeCallback(); _CallbackEvent("LoadModule"); /*{ string asmfn; int ilslash = assemblyname.LastIndexOf('\\'); if (-1 == ilslash) { asmfn = assemblyname; } else { asmfn = assemblyname.Substring(ilslash + 1); } _CallbackEvent("LoadModule:" + asmfn); }*/ if (thismodule) { _CallbackEvent("LoadModule:this"); } } catch (Exception e) { _CallbackException(e); } }
void ICorDebugManagedCallback.UnloadModule( ICorDebugAppDomain appDomain, ICorDebugModule managedModule) { HandleEvent(ManagedCallbackType.OnModuleUnload, new CorModuleEventArgs( appDomain == null ? null : new CorAppDomain(appDomain), managedModule == null ? null : new CorModule(managedModule), ManagedCallbackType.OnModuleUnload)); }
public DnAssembly TryGetValidAssembly(ICorDebugAppDomain comAppDomain, ICorDebugModule comModule) { DebugVerifyThread(); if (comModule == null) return null; var appDomain = TryGetValidAppDomain(comAppDomain); if (appDomain == null) return null; ICorDebugAssembly comAssembly; int hr = comModule.GetAssembly(out comAssembly); if (hr < 0) return null; return appDomain.TryGetAssembly(comAssembly); }
public void UpdateModuleSymbols(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule, IStream pSymbolStream) { EnterCallback("UpdateModuleSymbols", pAppDomain); Module module = process.GetModule(pModule); if (module.CorModule is ICorDebugModule3 && module.IsDynamic) { // In .NET 4.0, we use the LoadClass callback to load dynamic modules // because it always works - UpdateModuleSymbols does not. // - Simple dynamic code generation seems to trigger both callbacks. // - IronPython for some reason causes just the LoadClass callback // so we choose to rely on it out of the two. } else { // In .NET 2.0, this is the the only method and it works fine module.LoadSymbolsFromMemory(pSymbolStream); } ExitCallback(); }
internal DnModule TryAdd(ICorDebugModule comModule) { return modules.Add(comModule); }
internal Module GetModule(ICorDebugModule corModule) { foreach(Module module in this.Modules) { if (module.CorModule == corModule) { return module; } } throw new DebuggerException("Module is not in collection"); }
public UpdateModuleSymbolsDebugCallbackEventArgs(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule, IStream pSymbolStream) : base(pAppDomain) { this.AppDomain = pAppDomain; this.Module = pModule; this.SymbolStream = pSymbolStream; }
DnModule CreateModule(ICorDebugModule comModule, int id) { return new DnModule(this, comModule, id, Debugger.GetNextModuleId()); }
public void LoadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { Logger.WriteLine("Module {0} loaded", new DebugModule(pModule).Name); var handler = OnModuleLoaded; if (handler != null) handler(this, new DebuggerModuleLoadedEventArgs(pModule)); pAppDomain.Continue(0); }
/// <summary> /// Gets a module or null /// </summary> /// <param name="comModule">Module</param> /// <returns></returns> public DnModule TryGetModule(ICorDebugModule comModule) { Debugger.DebugVerifyThread(); return modules.TryGet(comModule); }
public void UnloadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule) { try { Logger.WriteLine("Module {0} unloaded", new DebugModule(pModule).Name); } catch (Exception) { Logger.WriteLine("Could not resolve unloaded module name"); } pAppDomain.Continue(0); }
public void UpdateModuleSymbols(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule, IStream pSymbolStream) { pAppDomain.Continue(0); }
int ICorDebugFunction.GetModule( out ICorDebugModule ppModule ) { m_class.ICorDebugClass.GetModule( out ppModule ); return Utility.COM_HResults.S_OK; }
internal RuntimeModule GetModule(ICorDebugModule module) { return _modules[module]; }
public virtual void UnloadModule(ICorDebugAppDomain appDomain, ICorDebugModule module) { this.DefaultHandler(appDomain); }
void ICorDebugManagedCallback.UpdateModuleSymbols( ICorDebugAppDomain appDomain, ICorDebugModule managedModule, IStream stream) { HandleEvent(ManagedCallbackType.OnUpdateModuleSymbols, new CorUpdateModuleSymbolsEventArgs(appDomain == null ? null : new CorAppDomain(appDomain), managedModule == null ? null : new CorModule(managedModule), stream, ManagedCallbackType.OnUpdateModuleSymbols)); }
public virtual void UpdateModuleSymbols( ICorDebugAppDomain appDomain, ICorDebugModule module, IStream symbolStream) { this.DefaultHandler(appDomain); }