class MSFBuilder
Declaration
class MSFBuilder { /* full declaration omitted */ };
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:26
Method Overview
- public Expected<uint32_t> addStream(uint32_t Size, ArrayRef<uint32_t> Blocks)
- public Expected<uint32_t> addStream(uint32_t Size)
- public Expected<llvm::FileBufferByteStream> commit(llvm::StringRef Path, llvm::msf::MSFLayout & Layout)
- public static Expected<llvm::msf::MSFBuilder> create(llvm::BumpPtrAllocator & Allocator, uint32_t BlockSize, uint32_t MinBlockCount = 0, bool CanGrow = true)
- public Expected<llvm::msf::MSFLayout> generateLayout()
- public llvm::BumpPtrAllocator & getAllocator()
- public uint32_t getNumFreeBlocks() const
- public uint32_t getNumStreams() const
- public uint32_t getNumUsedBlocks() const
- public ArrayRef<uint32_t> getStreamBlocks(uint32_t StreamIdx) const
- public uint32_t getStreamSize(uint32_t StreamIdx) const
- public uint32_t getTotalBlockCount() const
- public bool isBlockFree(uint32_t Idx) const
- public llvm::Error setBlockMapAddr(uint32_t Addr)
- public llvm::Error setDirectoryBlocksHint(ArrayRef<uint32_t> DirBlocks)
- public void setFreePageMap(uint32_t Fpm)
- public llvm::Error setStreamSize(uint32_t Idx, uint32_t Size)
- public void setUnknown1(uint32_t Unk1)
Methods
¶Expected<uint32_t> addStream(
uint32_t Size,
ArrayRef<uint32_t> Blocks)
Expected<uint32_t> addStream(
uint32_t Size,
ArrayRef<uint32_t> Blocks)
Description
Add a stream to the MSF file with the given size, occupying the given list of blocks. This is useful when reading a MSF file and you want a particular stream to occupy the original set of blocks. If the given blocks are already allocated, or if the number of blocks specified is incorrect for the given stream size, this function will return an Error.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:73
Parameters
- uint32_t Size
- ArrayRef<uint32_t> Blocks
¶Expected<uint32_t> addStream(uint32_t Size)
Expected<uint32_t> addStream(uint32_t Size)
Description
Add a stream to the MSF file with the given size, occupying any available blocks that the builder decides to use. This is useful when building a new PDB file from scratch and you don't care what blocks a stream occupies but you just want it to work.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:79
Parameters
- uint32_t Size
¶Expected<llvm::FileBufferByteStream> commit(
llvm::StringRef Path,
llvm::msf::MSFLayout& Layout)
Expected<llvm::FileBufferByteStream> commit(
llvm::StringRef Path,
llvm::msf::MSFLayout& Layout)
Description
Write the MSF layout to the underlying file.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:116
Parameters
- llvm::StringRef Path
- llvm::msf::MSFLayout& Layout
¶static Expected<llvm::msf::MSFBuilder> create(
llvm::BumpPtrAllocator& Allocator,
uint32_t BlockSize,
uint32_t MinBlockCount = 0,
bool CanGrow = true)
static Expected<llvm::msf::MSFBuilder> create(
llvm::BumpPtrAllocator& Allocator,
uint32_t BlockSize,
uint32_t MinBlockCount = 0,
bool CanGrow = true)
Description
Create a new `MSFBuilder`.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:56
Parameters
- llvm::BumpPtrAllocator& Allocator
- uint32_t BlockSize
- The internal block size used by the PDB file. See isValidBlockSize() for a list of valid block sizes.
- uint32_t MinBlockCount = 0
- Causes the builder to reserve up front space for at least `MinBlockCount` blocks. This is useful when using `MSFBuilder` to read an existing MSF that you want to write back out later. The original MSF file's SuperBlock contains the exact number of blocks used by the file, so is a good hint as to how many blocks the new MSF file will contain. Furthermore, it is actually necessary in this case. To preserve stability of the file's layout, it is helpful to try to keep all streams mapped to their original block numbers. To ensure that this is possible, space for all blocks must be allocated beforehand so that streams can be assigned to them.
- bool CanGrow = true
- If true, any operation which results in an attempt to locate a free block when all available blocks have been exhausted will allocate a new block, thereby growing the size of the final MSF file. When false, any such attempt will result in an error. This is especially useful in testing scenarios when you know your test isn't going to do anything to increase the size of the file, so having an Error returned if it were to happen would catch a programming error
Returns
an llvm::Error representing whether the operation succeeded or failed. Currently the only way this can fail is if an invalid block size is specified, or `MinBlockCount` does not leave enough room for the mandatory reserved blocks required by an MSF file.
¶Expected<llvm::msf::MSFLayout> generateLayout()
Expected<llvm::msf::MSFLayout> generateLayout()
Description
Finalize the layout and build the headers and structures that describe the MSF layout and can be written directly to the MSF file.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:113
¶llvm::BumpPtrAllocator& getAllocator()
llvm::BumpPtrAllocator& getAllocator()
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:118
¶uint32_t getNumFreeBlocks() const
uint32_t getNumFreeBlocks() const
Description
Get the total number of blocks that exist in the MSF file but are not allocated to any valid data.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:102
¶uint32_t getNumStreams() const
uint32_t getNumStreams() const
Description
Get the total number of streams in the MSF layout. This should return 1 for every call to `addStream`.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:88
¶uint32_t getNumUsedBlocks() const
uint32_t getNumUsedBlocks() const
Description
Get the total number of blocks that will be allocated to actual data in this MSF file.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:98
¶ArrayRef<uint32_t> getStreamBlocks(
uint32_t StreamIdx) const
ArrayRef<uint32_t> getStreamBlocks(
uint32_t StreamIdx) const
Description
Get the list of blocks allocated to a particular stream.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:94
Parameters
- uint32_t StreamIdx
¶uint32_t getStreamSize(uint32_t StreamIdx) const
uint32_t getStreamSize(uint32_t StreamIdx) const
Description
Get the size of a stream by index.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:91
Parameters
- uint32_t StreamIdx
¶uint32_t getTotalBlockCount() const
uint32_t getTotalBlockCount() const
Description
Get the total number of blocks in the MSF file. In practice this is equal to `getNumUsedBlocks() + getNumFreeBlocks()`.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:106
¶bool isBlockFree(uint32_t Idx) const
bool isBlockFree(uint32_t Idx) const
Description
Check whether a particular block is allocated or free.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:109
Parameters
- uint32_t Idx
¶llvm::Error setBlockMapAddr(uint32_t Addr)
llvm::Error setBlockMapAddr(uint32_t Addr)
Description
Request the block map to be at a specific block address. This is useful when editing a MSF and you want the layout to be as stable as possible.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:63
Parameters
- uint32_t Addr
¶llvm::Error setDirectoryBlocksHint(
ArrayRef<uint32_t> DirBlocks)
llvm::Error setDirectoryBlocksHint(
ArrayRef<uint32_t> DirBlocks)
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:64
Parameters
- ArrayRef<uint32_t> DirBlocks
¶void setFreePageMap(uint32_t Fpm)
void setFreePageMap(uint32_t Fpm)
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:65
Parameters
- uint32_t Fpm
¶llvm::Error setStreamSize(uint32_t Idx,
uint32_t Size)
llvm::Error setStreamSize(uint32_t Idx,
uint32_t Size)
Description
Update the size of an existing stream. This will allocate or deallocate blocks as needed to match the requested size. This can fail if `CanGrow` was set to false when initializing the `MSFBuilder`.
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:84
Parameters
- uint32_t Idx
- uint32_t Size
¶void setUnknown1(uint32_t Unk1)
void setUnknown1(uint32_t Unk1)
Declared at: llvm/include/llvm/DebugInfo/MSF/MSFBuilder.h:66
Parameters
- uint32_t Unk1