public static DebugSymbolEntry[] From(FileHeader hdr, BinaryReader rd, SmxDebugInfoSection info, SmxNameTable names) { var entries = new DebugSymbolEntry[info.NumSymbols]; for (var i = 0; i < info.NumSymbols; i++) { var entry = new DebugSymbolEntry(); entry.Address = rd.ReadInt32(); entry.TagId = rd.ReadUInt16(); // There's a padding of 2 bytes after this short. if (hdr.debugUnpacked) { rd.ReadBytes(2); } entry.CodeStart = rd.ReadUInt32(); entry.CodeEnd = rd.ReadUInt32(); entry.Ident = (SymKind)rd.ReadByte(); entry.Scope = (SymScope)rd.ReadByte(); entry.dimcount = rd.ReadUInt16(); entry.nameoffs = rd.ReadInt32(); entry.Name = names.StringAt(entry.nameoffs); if (entry.dimcount > 0) { entry.Dims = DebugSymbolDimEntry.From(hdr, rd, entry.dimcount); } entries[i] = entry; } return(entries); }
public int Size; // Size of the dimension. public static DebugSymbolDimEntry[] From(FileHeader hdr, BinaryReader rd, int count) { var entries = new DebugSymbolDimEntry[count]; for (var i = 0; i < count; i++) { var entry = new DebugSymbolDimEntry(); // There's a padding of 2 bytes before this short. if (hdr != null && hdr.debugUnpacked) { rd.ReadBytes(2); } entry.tagid = rd.ReadUInt16(); entry.Size = rd.ReadInt32(); entries[i] = entry; } return(entries); }
public static DebugNativeArgEntry[] From(BinaryReader rd, SmxNameTable names, int count) { var entries = new DebugNativeArgEntry[count]; for (var i = 0; i < count; i++) { var entry = new DebugNativeArgEntry(); entry.Ident = (SymKind)rd.ReadByte(); entry.tagid = rd.ReadUInt16(); entry.dimcount = rd.ReadUInt16(); entry.nameoffs = rd.ReadInt32(); if (entry.dimcount > 0) { entry.Dims = DebugSymbolDimEntry.From(null, rd, entry.dimcount); } entry.Name = names.StringAt(entry.nameoffs); entries[i] = entry; } return(entries); }
public int Size; // Size of the dimension. public static DebugSymbolDimEntry[] From(FileHeader hdr, BinaryReader rd, int count) { var entries = new DebugSymbolDimEntry[count]; for (var i = 0; i < count; i++) { var entry = new DebugSymbolDimEntry(); // There's a padding of 2 bytes before this short. if (hdr != null && hdr.debugUnpacked) rd.ReadBytes(2); entry.tagid = rd.ReadUInt16(); entry.Size = rd.ReadInt32(); entries[i] = entry; } return entries; }
private string dimsToString(Tag tag, DebugSymbolDimEntry[] dims) { string str = ""; for (var i = 0; i < dims.Length; i++) { int size; if (i == dims.Length - 1 && tag != null && tag.Name == "String") size = dims[i].Size * 4; else size = dims[i].Size; if (size == 0) str += "[]"; else str += string.Format("[{0}]", size); } return str; }