/// <summary> /// Reads the image data from the given stream. /// </summary> /// <param name="reader">Binary stream reader.</param> public ImageFileInfo(FastBinaryReader reader) { Id = reader.ReadInt32(); StartAddress = reader.ReadUInt64(); EndAddress = reader.ReadUInt64(); int nameLength = reader.ReadInt32(); Name = reader.ReadString(nameLength); Interesting = reader.ReadBoolean(); }
/// <summary> /// Loads a trace prefix file. /// </summary> /// <param name="reader">Binary reader to read the trace prefix.</param> public TracePrefixFile(FastBinaryReader reader) : base(reader) { // Read image file information int imageFileCount = reader.ReadInt32(); ImageFiles = new Dictionary <int, ImageFileInfo>(); for (int i = 0; i < imageFileCount; ++i) { var imageFile = new ImageFileInfo(reader); ImageFiles.Add(imageFile.Id, imageFile); } }
/// <summary> /// Reads trace data. /// </summary> /// <param name="reader">Binary reader containing the trace data.</param> protected TraceFile(FastBinaryReader reader) { // Read entries int entryCount = reader.ReadInt32(); List <TraceEntry> entries = new List <TraceEntry>(entryCount); for (int i = 0; i < entryCount; ++i) { var entry = TraceEntry.DeserializeNextEntry(reader); if (entry.EntryType == TraceEntry.TraceEntryTypes.Allocation) { Allocations.Add(((TraceEntryTypes.Allocation)entry).Id, (TraceEntryTypes.Allocation)entry); } entries.Add(entry); } Entries = entries; }
/// <summary> /// Loads a trace prefix file from the given byte buffer. /// </summary> /// <param name="buffer">Buffer containing the trace data.</param> /// <param name="allocations">Optional. Allocation lookup table, indexed by IDs.</param> public TracePrefixFile(Memory <byte> buffer, Dictionary <int, Allocation> allocations = null) : base(allocations) { // Read image file information var reader = new FastBinaryReader(buffer); int imageFileCount = reader.ReadInt32(); ImageFiles = new Dictionary <int, ImageFileInfo>(); for (int i = 0; i < imageFileCount; ++i) { var imageFile = new ImageFileInfo(reader); ImageFiles.Add(imageFile.Id, imageFile); } // Set internal buffer _buffer = buffer.Slice(reader.Position); }