LLVM
10.0.0svn
|
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. More...
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
Public Member Functions | |
support::endianness | getEndian () const override |
Error | readBytes (uint32_t Offset, uint32_t Size, ArrayRef< uint8_t > &Buffer) override |
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. More... | |
Error | readLongestContiguousChunk (uint32_t Offset, ArrayRef< uint8_t > &Buffer) override |
Given an offset into the stream, read as much as possible without copying any data. More... | |
uint32_t | getLength () override |
Return the number of bytes of data in this stream. More... | |
BumpPtrAllocator & | getAllocator () |
void | invalidateCache () |
uint32_t | getBlockSize () const |
uint32_t | getNumBlocks () const |
uint32_t | getStreamLength () const |
![]() | |
virtual | ~BinaryStream ()=default |
virtual BinaryStreamFlags | getFlags () const |
Return the properties of this stream. More... | |
Static Public Member Functions | |
static std::unique_ptr< MappedBlockStream > | createStream (uint32_t BlockSize, const MSFStreamLayout &Layout, BinaryStreamRef MsfData, BumpPtrAllocator &Allocator) |
static std::unique_ptr< MappedBlockStream > | createIndexedStream (const MSFLayout &Layout, BinaryStreamRef MsfData, uint32_t StreamIndex, BumpPtrAllocator &Allocator) |
static std::unique_ptr< MappedBlockStream > | createFpmStream (const MSFLayout &Layout, BinaryStreamRef MsfData, BumpPtrAllocator &Allocator) |
static std::unique_ptr< MappedBlockStream > | createDirectoryStream (const MSFLayout &Layout, BinaryStreamRef MsfData, BumpPtrAllocator &Allocator) |
Protected Member Functions | |
MappedBlockStream (uint32_t BlockSize, const MSFStreamLayout &StreamLayout, BinaryStreamRef MsfData, BumpPtrAllocator &Allocator) | |
![]() | |
Error | checkOffsetForRead (uint32_t Offset, uint32_t DataSize) |
Friends | |
class | WritableMappedBlockStream |
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.
Definition at line 39 of file MappedBlockStream.h.
|
protected |
Definition at line 45 of file MappedBlockStream.cpp.
Referenced by getStreamLength().
|
static |
|
static |
Definition at line 81 of file MappedBlockStream.cpp.
References llvm::msf::SuperBlock::BlockSize, createStream(), llvm::msf::getFpmStreamLayout(), and llvm::msf::MSFLayout::SB.
|
static |
Definition at line 59 of file MappedBlockStream.cpp.
References assert(), llvm::msf::MSFStreamLayout::Blocks, llvm::msf::SuperBlock::BlockSize, llvm::msf::MSFLayout::SB, llvm::msf::MSFLayout::StreamMap, and llvm::msf::MSFLayout::StreamSizes.
|
static |
Definition at line 52 of file MappedBlockStream.cpp.
Referenced by createDirectoryStream(), and createFpmStream().
|
inline |
Definition at line 70 of file MappedBlockStream.h.
References Allocator, and invalidateCache().
|
inline |
Definition at line 74 of file MappedBlockStream.h.
References BlockSize.
|
inlineoverridevirtual |
Implements llvm::BinaryStream.
Definition at line 59 of file MappedBlockStream.h.
References getLength(), llvm::support::little, readBytes(), readLongestContiguousChunk(), and Size.
|
overridevirtual |
Return the number of bytes of data in this stream.
Implements llvm::BinaryStream.
Definition at line 196 of file MappedBlockStream.cpp.
References llvm::alignTo(), llvm::msf::MSFStreamLayout::Blocks, llvm::msf::blockToOffset(), llvm::BinaryStream::checkOffsetForRead(), llvm::consumeError(), llvm::ArrayRef< T >::data(), llvm::MutableArrayRef< T >::data(), llvm::ArrayRef< T >::drop_front(), E, I, llvm::msf::MSFStreamLayout::Length, readBytes(), llvm::BinaryStreamRef::readBytes(), Size, llvm::ArrayRef< T >::size(), and llvm::Error::success().
Referenced by getEndian(), llvm::msf::WritableMappedBlockStream::getEndian(), and llvm::msf::WritableMappedBlockStream::getLength().
|
inline |
Definition at line 75 of file MappedBlockStream.h.
References llvm::msf::MSFStreamLayout::Blocks.
Referenced by readLongestContiguousChunk().
|
inline |
Definition at line 76 of file MappedBlockStream.h.
References Allocator, BlockSize, llvm::Data, llvm::msf::MSFStreamLayout::Length, MappedBlockStream(), and readBytes().
void MappedBlockStream::invalidateCache | ( | ) |
Definition at line 272 of file MappedBlockStream.cpp.
References llvm::Data, and llvm::ArrayRef< T >::size().
Referenced by getAllocator().
|
overridevirtual |
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.
Implements llvm::BinaryStream.
Definition at line 88 of file MappedBlockStream.cpp.
References llvm::AbsoluteDifference(), llvm::BumpPtrAllocatorImpl< AllocatorT, SlabSize, SizeThreshold >::Allocate(), llvm::BinaryStream::checkOffsetForRead(), intersect(), List, Size, llvm::ArrayRef< T >::slice(), and llvm::Error::success().
Referenced by getEndian(), llvm::msf::WritableMappedBlockStream::getEndian(), getLength(), getStreamLength(), and llvm::msf::WritableMappedBlockStream::readBytes().
|
overridevirtual |
Given an offset into the stream, read as much as possible without copying any data.
Implements llvm::BinaryStream.
Definition at line 166 of file MappedBlockStream.cpp.
References llvm::msf::MSFStreamLayout::Blocks, llvm::msf::blockToOffset(), llvm::BinaryStream::checkOffsetForRead(), getNumBlocks(), llvm::BinaryStreamRef::readBytes(), and llvm::Error::success().
Referenced by getEndian(), llvm::msf::WritableMappedBlockStream::getEndian(), and llvm::msf::WritableMappedBlockStream::readLongestContiguousChunk().
|
friend |
Definition at line 40 of file MappedBlockStream.h.
Referenced by llvm::msf::WritableMappedBlockStream::getStreamLength().