public SourceFileModuleReader(IServiceContainer ctx, SpanStream stream) : base(stream) { this.pdb = ctx.GetService <PDBFile>(); // including .c file NumberOfFiles = ReadUInt16(); UInt16 hdrFlags = ReadUInt16(); switch (hdrFlags) { case 0: case 1: break; default: throw new InvalidAssumptionException("hdrFlags"); } bool isRoot = (hdrFlags & 1) == 1; // dataOffset - startOfData = headerSize UInt32 dataOffset = ReadUInt32(); UInt32[] childFileOffsets = Enumerable.Range(1, NumberOfFiles - 1) .Select(_ => ReadUInt32()) .ToArray(); UInt32 unk1 = ReadUInt32(); UInt32 unk2 = ReadUInt32(); if (hdrFlags == 1) { UInt32 maybeFlags = ReadUInt32(); UInt32 numTables = ReadUInt32(); UInt32[] tableOffsets = Enumerable.Range(1, (int)numTables) .Select(_ => ReadUInt32()) .ToArray(); UInt32[][] unkDataPerTable = Enumerable.Range(1, (int)numTables) .Select(_ => { UInt32[] data = new UInt32[2]; data[0] = ReadUInt32(); data[1] = ReadUInt32(); return(data); }).ToArray(); } FileName = ReadCString(); // table data follows... // skip it for now, and go read child headers Children = childFileOffsets.Select(offset => { return(PerformAt(offset, () => { return new SourceFileModuleReader(ctx, this); })); }).ToArray(); }
public TPIReader(IServiceContainer ctx, SpanStream stream) : base(stream) { this.ctx = ctx; PDBFile pdb = ctx.GetService <PDBFile>(); if (pdb.Type == PDBType.Old) { this.TypeReader = new ReadTypeDelegate(ReadTypeOld); JGHeaderOld oldHdr = ctx.GetService <JGHeaderOld>(); Header = ImportJGOld(oldHdr); } else { Header = Read <TPIHeader>(); if (Header.HeaderSize != Marshal.SizeOf <TPIHeader>()) { throw new InvalidDataException(); } if (!Enum.IsDefined(typeof(TPIVersion), Header.Version)) { throw new InvalidDataException(); } this.TypeReader = new ReadTypeDelegate(ReadType); } #if false if (Header.Version != TPIVersion.V80) { throw new NotImplementedException($"TPI Version {Header.Version} not supported yet"); } #endif lazyLeafContainers = LazyFactory.CreateLazy(ReadTypes); }
public DBIWriter(PDBFile pdb, StreamTableWriter stWr, Stream stream) : base(stream) { }
public override void Write(PDBFile pdb, Stream stream) { data.Write(pdb, stream); }
public abstract void Write(PDBFile pdb, Stream stream);
public Context(string pdbFilePath) { stream = new FileStream(pdbFilePath, FileMode.Open, FileAccess.Read); Pdb = new PDBFile(this, stream); }
public void Write(PDBFile pdb, Stream stream) { throw new NotImplementedException(); }
public void Write(PDBFile pdb, Stream stream) { Leaf.Data.Write(pdb, stream); }