Exemplo n.º 1
0
 public DbgModuleData(DbgEngineImpl engine, DnModule dnModule, ModuleId moduleId)
 {
     Engine   = engine;
     DnModule = dnModule;
     ModuleId = moduleId;
 }
Exemplo n.º 2
0
        public static DbgEngineModule CreateModule <T>(DbgEngineImpl engine, DbgObjectFactory objectFactory, DbgAppDomain appDomain, DnModule dnModule, T data) where T : class
        {
            ulong  address     = dnModule.Address;
            uint   size        = dnModule.Size;
            var    imageLayout = CalculateImageLayout(dnModule);
            string name        = GetFilename(dnModule.Name);
            string filename    = dnModule.Name;
            bool   isDynamic   = dnModule.IsDynamic;
            bool   isInMemory  = dnModule.IsInMemory;
            bool?  isOptimized = CalculateIsOptimized(dnModule);
            int    order       = dnModule.UniqueId;

            InitializeExeFields(dnModule, filename, imageLayout, out var isExe, out var isDll, out var timestamp, out var version, out var assemblySimpleName);

            var reflectionAppDomain = ((DbgCorDebugInternalAppDomainImpl)appDomain.InternalAppDomain).ReflectionAppDomain;

            var         closedListenerCollection = new ClosedListenerCollection();
            var         modules            = dnModule.Assembly.Modules;
            bool        isManifestModule   = modules[0] == dnModule;
            var         getMetadata        = CreateGetMetadataDelegate(engine, objectFactory.Runtime, dnModule, closedListenerCollection, imageLayout);
            var         fullyQualifiedName = DmdModule.GetFullyQualifiedName(isInMemory, isDynamic, dnModule.Name);
            DmdAssembly reflectionAssembly;
            DmdModule   reflectionModule;

            if (isManifestModule)
            {
                var assemblyLocation = isInMemory || isDynamic ? string.Empty : dnModule.Name;
                var asmOptions       = DmdCreateAssemblyOptions.None;
                if (isInMemory)
                {
                    asmOptions |= DmdCreateAssemblyOptions.InMemory;
                }
                if (isDynamic)
                {
                    asmOptions |= DmdCreateAssemblyOptions.Dynamic;
                }
                if (isExe)
                {
                    asmOptions |= DmdCreateAssemblyOptions.IsEXE;
                }
                else if (isDll)
                {
                    asmOptions |= DmdCreateAssemblyOptions.IsDLL;
                }
                var asmInfo = new DmdCreateAssemblyInfo(asmOptions, fullyQualifiedName, assemblyLocation, assemblySimpleName);
                reflectionAssembly = reflectionAppDomain.CreateAssembly(getMetadata, asmInfo);
                reflectionModule   = reflectionAssembly.ManifestModule;
            }
            else
            {
                var manifestModule = engine.TryGetModule(modules[0].CorModule);
                if (manifestModule == null)
                {
                    throw new InvalidOperationException();
                }
                reflectionAssembly = ((DbgCorDebugInternalModuleImpl)manifestModule.InternalModule).ReflectionModule.Assembly;
                reflectionModule   = reflectionAppDomain.CreateModule(reflectionAssembly, getMetadata, isInMemory, isDynamic, fullyQualifiedName);
            }

            var internalModule = new DbgCorDebugInternalModuleImpl(reflectionModule, closedListenerCollection);

            return(objectFactory.CreateModule(appDomain, internalModule, isExe, address, size, imageLayout, name, filename, isDynamic, isInMemory, isOptimized, order, timestamp, version, engine.GetMessageFlags(), data: data, onCreated: engineModule => internalModule.SetModule(engineModule.Module)));
        }
Exemplo n.º 3
0
 public DmdDispatcherImpl(DbgEngineImpl engine) => this.engine = engine ?? throw new ArgumentNullException(nameof(engine));
Exemplo n.º 4
0
 public DmdDynamicModuleHelperImpl(DbgEngineImpl engine) => this.engine = engine ?? throw new ArgumentNullException(nameof(engine));
 public DnlibAssemblyResolverImpl(DbgEngineImpl engine, DmdAppDomain appDomain)
 {
     this.engine    = engine ?? throw new ArgumentNullException(nameof(engine));
     this.appDomain = appDomain ?? throw new ArgumentNullException(nameof(appDomain));
     dict           = new Dictionary <IAssembly, AssemblyDef>(AssemblyNameComparer.CompareAll);
 }
Exemplo n.º 6
0
 public override void Dispose()
 {
     obj    = null;
     engine = null;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Should only be called by <see cref="DbgEngineImpl"/>
 /// </summary>
 public static DnDebuggerObjectHolderImpl <T> Create_DONT_CALL(DbgEngineImpl engine, T obj) => new DnDebuggerObjectHolderImpl <T>(engine, obj);
Exemplo n.º 8
0
 public DmdEvaluatorImpl(DbgEngineImpl engine) =>
 this.engine = engine ?? throw new ArgumentNullException(nameof(engine));
Exemplo n.º 9
0
 public CorDebugTypeCreator(DbgEngineImpl engine, CorAppDomain appDomain)
 {
     this.engine      = engine;
     this.appDomain   = appDomain;
     recursionCounter = 0;
 }