コード例 #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
ファイル: Importer.cs プロジェクト: orangesocks/XSharpPublic
        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
ファイル: Importer.cs プロジェクト: orangesocks/XSharpPublic
        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);
 }