// https://github.com/jbevain/cecil/blob/master/symbols/pdb/Microsoft.Cci.Pdb/CvInfo.cs public CodeViewTypes(SST sst, int module, byte[] data) : base(sst, module, data) { var cvtl = new CodeViewTypeLoader(data); var dict = cvtl.Load(); Console.WriteLine("== Type information for module {0}", module); foreach (var item in dict.OrderBy(d => d.Key)) { Dump(item.Key, item.Value.Leaves); } }
private void LoadModuleSymbols( int m, IGrouping <int, Subsection> module, Dictionary <Address, ImageSymbol> dict) { Debug.Print("== Module {0} symbols ==============", m); var list = new List <PublicSymbol>(); CodeViewTypeLoader types = null; foreach (var item in module) { if (item is sstPublics sp) { foreach (var sym in sp.symbols) { var addr = Address.SegPtr( (ushort)(sym.addr.Selector.Value + this.addrLoad.Selector), (uint)sym.addr.Offset); dict[addr] = ImageSymbol.Procedure(this.arch, addr, sym.name); var relocatedSym = new PublicSymbol(addr, sym.typeidx, sym.name); list.Add(relocatedSym); } } else if (item is CodeViewTypes ty) { types = new CodeViewTypeLoader(ty.data); } } var typeBuilder = new TypeBuilder(arch, types?.Load()); foreach (var s in list.OrderBy(tu => tu.addr)) { Debug.Print("{0} [{1}] {2:X6}:{3}", s.addr, m, s.typeidx, s.name); dict[s.addr] = typeBuilder.BuildSymbol(s); } }