class MappedBlockStream

Declaration

class MappedBlockStream : public BinaryStream { /* full declaration omitted */ };

Description

MappedBlockStream represents data stored in an MSF file into chunks of a particular size (called the Block Size), and whose chunks may not be necessarily contiguous. The arrangement of these chunks MSF the file is described by some other metadata contained within the MSF file. In the case of a standard MSF Stream, the layout of the stream's blocks is described by the MSF "directory", but in the case of the directory itself, the layout is described by an array at a fixed location within the MSF. MappedBlockStream provides methods for reading from and writing to one of these streams transparently, as if it were a contiguous sequence of bytes.

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:37

Inherits from: BinaryStream

Member Variables

private const uint32_t BlockSize
private const llvm::msf::MSFStreamLayout StreamLayout
private llvm::BinaryStreamRef MsfData
private llvm::BumpPtrAllocator& Allocator
private DenseMap<uint32_t, std::vector<CacheEntry>> CacheMap

Method Overview

  • protected MappedBlockStream(uint32_t BlockSize, const llvm::msf::MSFStreamLayout & StreamLayout, llvm::BinaryStreamRef MsfData, llvm::BumpPtrAllocator & Allocator)
  • public static std::unique_ptr<MappedBlockStream> createDirectoryStream(const llvm::msf::MSFLayout & Layout, llvm::BinaryStreamRef MsfData, llvm::BumpPtrAllocator & Allocator)
  • public static std::unique_ptr<MappedBlockStream> createFpmStream(const llvm::msf::MSFLayout & Layout, llvm::BinaryStreamRef MsfData, llvm::BumpPtrAllocator & Allocator)
  • public static std::unique_ptr<MappedBlockStream> createIndexedStream(const llvm::msf::MSFLayout & Layout, llvm::BinaryStreamRef MsfData, uint32_t StreamIndex, llvm::BumpPtrAllocator & Allocator)
  • public static std::unique_ptr<MappedBlockStream> createStream(uint32_t BlockSize, const llvm::msf::MSFStreamLayout & Layout, llvm::BinaryStreamRef MsfData, llvm::BumpPtrAllocator & Allocator)
  • private void fixCacheAfterWrite(uint64_t Offset, ArrayRef<uint8_t> Data) const
  • public llvm::BumpPtrAllocator & getAllocator()
  • public uint32_t getBlockSize() const
  • public support::endianness getEndian() const
  • public uint64_t getLength()
  • public uint32_t getNumBlocks() const
  • private const llvm::msf::MSFStreamLayout & getStreamLayout() const
  • public uint32_t getStreamLength() const
  • public void invalidateCache()
  • public llvm::Error readBytes(uint64_t Offset, uint64_t Size, ArrayRef<uint8_t> & Buffer)
  • private llvm::Error readBytes(uint64_t Offset, MutableArrayRef<uint8_t> Buffer)
  • public llvm::Error readLongestContiguousChunk(uint64_t Offset, ArrayRef<uint8_t> & Buffer)
  • private bool tryReadContiguously(uint64_t Offset, uint64_t Size, ArrayRef<uint8_t> & Buffer)

Inherited from BinaryStream:

Methods

MappedBlockStream(
    uint32_t BlockSize,
    const llvm::msf::MSFStreamLayout&
        StreamLayout,
    llvm::BinaryStreamRef MsfData,
    llvm::BumpPtrAllocator& Allocator)

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:77

Parameters

uint32_t BlockSize
const llvm::msf::MSFStreamLayout& StreamLayout
llvm::BinaryStreamRef MsfData
llvm::BumpPtrAllocator& Allocator

static std::unique_ptr<MappedBlockStream>
createDirectoryStream(
    const llvm::msf::MSFLayout& Layout,
    llvm::BinaryStreamRef MsfData,
    llvm::BumpPtrAllocator& Allocator)

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:54

Parameters

const llvm::msf::MSFLayout& Layout
llvm::BinaryStreamRef MsfData
llvm::BumpPtrAllocator& Allocator

static std::unique_ptr<MappedBlockStream>
createFpmStream(
    const llvm::msf::MSFLayout& Layout,
    llvm::BinaryStreamRef MsfData,
    llvm::BumpPtrAllocator& Allocator)

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:50

Parameters

const llvm::msf::MSFLayout& Layout
llvm::BinaryStreamRef MsfData
llvm::BumpPtrAllocator& Allocator

static std::unique_ptr<MappedBlockStream>
createIndexedStream(
    const llvm::msf::MSFLayout& Layout,
    llvm::BinaryStreamRef MsfData,
    uint32_t StreamIndex,
    llvm::BumpPtrAllocator& Allocator)

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:46

Parameters

const llvm::msf::MSFLayout& Layout
llvm::BinaryStreamRef MsfData
uint32_t StreamIndex
llvm::BumpPtrAllocator& Allocator

static std::unique_ptr<MappedBlockStream>
createStream(
    uint32_t BlockSize,
    const llvm::msf::MSFStreamLayout& Layout,
    llvm::BinaryStreamRef MsfData,
    llvm::BumpPtrAllocator& Allocator)

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:42

Parameters

uint32_t BlockSize
const llvm::msf::MSFStreamLayout& Layout
llvm::BinaryStreamRef MsfData
llvm::BumpPtrAllocator& Allocator

void fixCacheAfterWrite(
    uint64_t Offset,
    ArrayRef<uint8_t> Data) const

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:82

Parameters

uint64_t Offset
ArrayRef<uint8_t> Data

llvm::BumpPtrAllocator& getAllocator()

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:68

uint32_t getBlockSize() const

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:72

support::endianness getEndian() const

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:57

uint64_t getLength()

Description

Return the number of bytes of data in this stream.

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:66

uint32_t getNumBlocks() const

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:73

const llvm::msf::MSFStreamLayout&
getStreamLayout() const

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:81

uint32_t getStreamLength() const

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:74

void invalidateCache()

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:70

llvm::Error readBytes(uint64_t Offset,
                      uint64_t Size,
                      ArrayRef<uint8_t>& Buffer)

Description

Given an offset into the stream and a number of bytes, attempt to read the bytes and set the output ArrayRef to point to data owned by the stream.

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:61

Parameters

uint64_t Offset
uint64_t Size
ArrayRef<uint8_t>& Buffer

llvm::Error readBytes(
    uint64_t Offset,
    MutableArrayRef<uint8_t> Buffer)

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:84

Parameters

uint64_t Offset
MutableArrayRef<uint8_t> Buffer

llvm::Error readLongestContiguousChunk(
    uint64_t Offset,
    ArrayRef<uint8_t>& Buffer)

Description

Given an offset into the stream, read as much as possible without copying any data.

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:63

Parameters

uint64_t Offset
ArrayRef<uint8_t>& Buffer

bool tryReadContiguously(
    uint64_t Offset,
    uint64_t Size,
    ArrayRef<uint8_t>& Buffer)

Declared at: llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h:85

Parameters

uint64_t Offset
uint64_t Size
ArrayRef<uint8_t>& Buffer