/// <summary> /// Initializes a new instance of the <see cref="PdbModule"/> class. /// </summary> /// <param name="module">The XML module description.</param> /// <param name="pdbFile">Already opened PDB file.</param> public PdbModule(XmlModule module, PdbFile pdbFile) { PdbFile = pdbFile; Name = !string.IsNullOrEmpty(module.Name) ? module.Name : Path.GetFileNameWithoutExtension(module.SymbolsPath).ToLower(); Namespace = module.Namespace; globalScopeCache = SimpleCache.CreateStruct(() => new PdbGlobalScope(this)); builtinSymbolsCache = new DictionaryCache <TypeIndex, PdbSymbol>(CreateBuiltinSymbol); allSymbolsCache = new ArrayCache <PdbSymbol>(PdbFile.TpiStream.TypeRecordCount, CreateSymbol); definedSymbolsCache = new ArrayCache <PdbSymbol>(PdbFile.TpiStream.TypeRecordCount, true, GetDefinedSymbol); constantsCache = SimpleCache.CreateStruct(() => { Dictionary <string, ConstantSymbol> constants = new Dictionary <string, ConstantSymbol>(); foreach (SymbolRecordKind kind in ConstantSymbol.Kinds) { foreach (ConstantSymbol c in PdbFile.PdbSymbolStream[kind].OfType <ConstantSymbol>()) { if (!constants.ContainsKey(c.Name)) { constants.Add(c.Name, c); } } } return((IReadOnlyDictionary <string, ConstantSymbol>)constants); }); }
/// <summary> /// Initializes a new instance of the <see cref="PdbStream"/> class. /// </summary> /// <param name="blocks">Array of block indexes in the parent stream.</param> /// <param name="length">Length of this stream in bytes.</param> /// <param name="file">PDB file that contains this stream.</param> public PdbStream(uint[] blocks, uint length, PdbFile file) { Blocks = blocks; Length = length; File = file; Reader = new MappedBlockBinaryReader <MMFileReader>(blocks, file.SuperBlock.BlockSize, length, file.Reader); }