예제 #1
0
        public ImportedModule ImportMscorlib()
        {
            if (_mscorlib != null)
            {
                return(_mscorlib);
            }

            DkmClrAppDomain currentAppDomain = InstructionAddress.ModuleInstance.AppDomain;

            if (currentAppDomain.IsUnloaded)
            {
                return(null);
            }

            foreach (DkmClrModuleInstance moduleInstance in currentAppDomain.GetClrModuleInstances())
            {
                if (!moduleInstance.IsUnloaded && moduleInstance.ClrFlags.HasFlag(DkmClrModuleFlags.RuntimeModule))
                {
                    _mscorlib = ImportModule(moduleInstance);
                    return(_mscorlib);
                }
            }

            return(null);
        }
예제 #2
0
        protected ImportedMember(ImportedModule module, StringHandle nameHandle, ImportedType declaringType)
        {
            Module        = module;
            DeclaringType = declaringType;

            _nameHandle = nameHandle;
        }
예제 #3
0
        public ImportedMethod TryImportCurrentMethod()
        {
            if (_currentMethod != null)
            {
                return(_currentMethod);
            }

            IntPtr metadataBlock;
            uint   blockSize;

            try
            {
                metadataBlock = InstructionAddress.ModuleInstance.GetMetaDataBytesPtr(out blockSize);
            }
            catch (DkmException)
            {
                // This can fail when dump debugging if the full heap is not available
                return(null);
            }

            ImportedModule module = Session.Importer.ImportModule(metadataBlock, blockSize);

            _currentMethod = module.GetMethod(InstructionAddress.MethodId.Token);
            return(_currentMethod);
        }
예제 #4
0
        private void AddAssembly(ImportedModule module)
        {
            MetadataReader     mdReader    = module.Reader;
            AssemblyDefinition assemblyDef = mdReader.GetAssemblyDefinition();
            string             name        = mdReader.GetString(assemblyDef.Name);

            if (!_importedAssemblyNames.Contains(name))
            {
                _importedAssemblyNames.Add(name);
            }
        }
예제 #5
0
        public ImportedModule ImportModule(IntPtr metadataPtr, uint blockSize)
        {
            ImportedModule module;

            if (!_modulePtrMap.TryGetValue(metadataPtr, out module))
            {
                module = new ImportedModule(metadataPtr, blockSize);
                _modulePtrMap.Add(metadataPtr, module);
                AddAssembly(module);
            }

            return(module);
        }
예제 #6
0
 internal ImportedType(ImportedModule module, TypeDefinition typeDef)
     : base(module, typeDef.Name, null)
 {
     _typeDef = typeDef;
 }
예제 #7
0
 internal ImportedField(ImportedModule module, FieldDefinition fieldDef, ImportedType declaringType)
     : base(module, fieldDef.Name, declaringType)
 {
     _fieldDef = fieldDef;
 }
예제 #8
0
 internal ImportedMethod(ImportedModule module, MethodDefinition methodDef, ImportedType declaringType)
     : base(module, methodDef.Name, declaringType)
 {
     _methodDef = methodDef;
     _signature = methodDef.DecodeSignature(Module.XSharpTypeProvider, genericContext: null);
 }