mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 04:09:45 +00:00
Revert "[msf] Rename Msf to MSF."
This reverts commit 4d1557ffac
.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277194 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cc8a2a6d7e
commit
85c3e3ee9c
@ -14,8 +14,8 @@
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
namespace llvm {
|
||||
|
@ -11,8 +11,8 @@
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAM_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
#include "llvm/DebugInfo/CodeView/Line.h"
|
||||
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/FileOutputBuffer.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
@ -32,16 +32,16 @@ public:
|
||||
Error readBytes(uint32_t Offset, uint32_t Size,
|
||||
ArrayRef<uint8_t> &Buffer) const override {
|
||||
if (Offset > Data.size())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
if (Data.size() < Size + Offset)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
Buffer = Data.slice(Offset, Size);
|
||||
return Error::success();
|
||||
}
|
||||
Error readLongestContiguousChunk(uint32_t Offset,
|
||||
ArrayRef<uint8_t> &Buffer) const override {
|
||||
if (Offset >= Data.size())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
Buffer = Data.slice(Offset);
|
||||
return Error::success();
|
||||
}
|
||||
@ -90,9 +90,9 @@ public:
|
||||
|
||||
Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Buffer) const override {
|
||||
if (Data.size() < Buffer.size())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
if (Offset > Buffer.size() - Data.size())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
uint8_t *DataPtr = const_cast<uint8_t *>(Data.data());
|
||||
::memcpy(DataPtr + Offset, Buffer.data(), Buffer.size());
|
||||
@ -121,7 +121,7 @@ private:
|
||||
|
||||
Error commit() const override {
|
||||
if (FileBuffer->commit())
|
||||
return llvm::make_error<MSFError>(msf_error_code::not_writable);
|
||||
return llvm::make_error<MsfError>(msf_error_code::not_writable);
|
||||
return Error::success();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- IMSFFile.h - Abstract base class for an MSF file ---------*- C++ -*-===//
|
||||
//===- IMsfFile.h - Abstract base class for an MSF file ---------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
namespace llvm {
|
||||
namespace msf {
|
||||
|
||||
class IMSFFile {
|
||||
class IMsfFile {
|
||||
public:
|
||||
virtual ~IMSFFile() {}
|
||||
virtual ~IMsfFile() {}
|
||||
|
||||
virtual uint32_t getBlockSize() const = 0;
|
||||
virtual uint32_t getBlockCount() const = 0;
|
@ -1,4 +1,4 @@
|
||||
//===- MappedBlockStream.h - Discontiguous stream data in an MSF -*- C++
|
||||
//===- MappedBlockStream.h - Discontiguous stream data in an Msf -*- C++
|
||||
//-*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
@ -14,8 +14,8 @@
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFStreamLayout.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfStreamLayout.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
@ -25,16 +25,16 @@
|
||||
namespace llvm {
|
||||
namespace msf {
|
||||
|
||||
struct MSFLayout;
|
||||
struct MsfLayout;
|
||||
|
||||
/// MappedBlockStream represents data stored in an MSF file into chunks of a
|
||||
/// 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
|
||||
/// necessarily contiguous. The arrangement of these chunks within 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
|
||||
/// 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.
|
||||
class MappedBlockStream : public ReadableStream {
|
||||
@ -43,14 +43,14 @@ class MappedBlockStream : public ReadableStream {
|
||||
public:
|
||||
static std::unique_ptr<MappedBlockStream>
|
||||
createStream(uint32_t BlockSize, uint32_t NumBlocks,
|
||||
const MSFStreamLayout &Layout, const ReadableStream &MsfData);
|
||||
const MsfStreamLayout &Layout, const ReadableStream &MsfData);
|
||||
|
||||
static std::unique_ptr<MappedBlockStream>
|
||||
createIndexedStream(const MSFLayout &Layout, const ReadableStream &MsfData,
|
||||
createIndexedStream(const MsfLayout &Layout, const ReadableStream &MsfData,
|
||||
uint32_t StreamIndex);
|
||||
|
||||
static std::unique_ptr<MappedBlockStream>
|
||||
createDirectoryStream(const MSFLayout &Layout, const ReadableStream &MsfData);
|
||||
createDirectoryStream(const MsfLayout &Layout, const ReadableStream &MsfData);
|
||||
|
||||
Error readBytes(uint32_t Offset, uint32_t Size,
|
||||
ArrayRef<uint8_t> &Buffer) const override;
|
||||
@ -71,11 +71,11 @@ public:
|
||||
|
||||
protected:
|
||||
MappedBlockStream(uint32_t BlockSize, uint32_t NumBlocks,
|
||||
const MSFStreamLayout &StreamLayout,
|
||||
const MsfStreamLayout &StreamLayout,
|
||||
const ReadableStream &MsfData);
|
||||
|
||||
private:
|
||||
const MSFStreamLayout &getStreamLayout() const { return StreamLayout; }
|
||||
const MsfStreamLayout &getStreamLayout() const { return StreamLayout; }
|
||||
void fixCacheAfterWrite(uint32_t Offset, ArrayRef<uint8_t> Data) const;
|
||||
|
||||
Error readBytes(uint32_t Offset, MutableArrayRef<uint8_t> Buffer) const;
|
||||
@ -84,7 +84,7 @@ private:
|
||||
|
||||
const uint32_t BlockSize;
|
||||
const uint32_t NumBlocks;
|
||||
const MSFStreamLayout StreamLayout;
|
||||
const MsfStreamLayout StreamLayout;
|
||||
const ReadableStream &MsfData;
|
||||
|
||||
typedef MutableArrayRef<uint8_t> CacheEntry;
|
||||
@ -96,14 +96,14 @@ class WritableMappedBlockStream : public WritableStream {
|
||||
public:
|
||||
static std::unique_ptr<WritableMappedBlockStream>
|
||||
createStream(uint32_t BlockSize, uint32_t NumBlocks,
|
||||
const MSFStreamLayout &Layout, const WritableStream &MsfData);
|
||||
const MsfStreamLayout &Layout, const WritableStream &MsfData);
|
||||
|
||||
static std::unique_ptr<WritableMappedBlockStream>
|
||||
createIndexedStream(const MSFLayout &Layout, const WritableStream &MsfData,
|
||||
createIndexedStream(const MsfLayout &Layout, const WritableStream &MsfData,
|
||||
uint32_t StreamIndex);
|
||||
|
||||
static std::unique_ptr<WritableMappedBlockStream>
|
||||
createDirectoryStream(const MSFLayout &Layout, const WritableStream &MsfData);
|
||||
createDirectoryStream(const MsfLayout &Layout, const WritableStream &MsfData);
|
||||
|
||||
Error readBytes(uint32_t Offset, uint32_t Size,
|
||||
ArrayRef<uint8_t> &Buffer) const override;
|
||||
@ -115,7 +115,7 @@ public:
|
||||
|
||||
Error commit() const override;
|
||||
|
||||
const MSFStreamLayout &getStreamLayout() const {
|
||||
const MsfStreamLayout &getStreamLayout() const {
|
||||
return ReadInterface.getStreamLayout();
|
||||
}
|
||||
uint32_t getBlockSize() const { return ReadInterface.getBlockSize(); }
|
||||
@ -124,7 +124,7 @@ public:
|
||||
|
||||
protected:
|
||||
WritableMappedBlockStream(uint32_t BlockSize, uint32_t NumBlocks,
|
||||
const MSFStreamLayout &StreamLayout,
|
||||
const MsfStreamLayout &StreamLayout,
|
||||
const WritableStream &MsfData);
|
||||
|
||||
private:
|
@ -13,7 +13,7 @@
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MSFCommon.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfCommon.h"
|
||||
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
@ -24,15 +24,15 @@
|
||||
|
||||
namespace llvm {
|
||||
namespace msf {
|
||||
class MSFBuilder {
|
||||
class MsfBuilder {
|
||||
public:
|
||||
/// \brief Create a new `MSFBuilder`.
|
||||
/// \brief Create a new `MsfBuilder`.
|
||||
///
|
||||
/// \param BlockSize The internal block size used by the PDB file. See
|
||||
/// isValidBlockSize() for a list of valid block sizes.
|
||||
///
|
||||
/// \param MinBlockCount Causes the builder to reserve up front space for
|
||||
/// at least `MinBlockCount` blocks. This is useful when using `MSFBuilder`
|
||||
/// 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
|
||||
@ -54,7 +54,7 @@ public:
|
||||
/// 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.
|
||||
static Expected<MSFBuilder> create(BumpPtrAllocator &Allocator,
|
||||
static Expected<MsfBuilder> create(BumpPtrAllocator &Allocator,
|
||||
uint32_t BlockSize,
|
||||
uint32_t MinBlockCount = 0,
|
||||
bool CanGrow = true);
|
||||
@ -81,7 +81,7 @@ public:
|
||||
|
||||
/// 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`.
|
||||
/// was set to false when initializing the `MsfBuilder`.
|
||||
Error setStreamSize(uint32_t Idx, uint32_t Size);
|
||||
|
||||
/// Get the total number of streams in the MSF layout. This should return 1
|
||||
@ -111,10 +111,10 @@ public:
|
||||
|
||||
/// Finalize the layout and build the headers and structures that describe the
|
||||
/// MSF layout and can be written directly to the MSF file.
|
||||
Expected<MSFLayout> build();
|
||||
Expected<MsfLayout> build();
|
||||
|
||||
private:
|
||||
MSFBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
|
||||
MsfBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
|
||||
BumpPtrAllocator &Allocator);
|
||||
|
||||
Error allocateBlocks(uint32_t NumBlocks, MutableArrayRef<uint32_t> Blocks);
|
@ -1,4 +1,4 @@
|
||||
//===- MSFCommon.h - Common types and functions for MSF files ---*- C++ -*-===//
|
||||
//===- MsfCommon.h - Common types and functions for MSF files ---*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -48,8 +48,8 @@ struct SuperBlock {
|
||||
support::ulittle32_t BlockMapAddr;
|
||||
};
|
||||
|
||||
struct MSFLayout {
|
||||
MSFLayout() : SB(nullptr) {}
|
||||
struct MsfLayout {
|
||||
MsfLayout() : SB(nullptr) {}
|
||||
const SuperBlock *SB;
|
||||
ArrayRef<support::ulittle32_t> DirectoryBlocks;
|
||||
ArrayRef<support::ulittle32_t> StreamSizes;
|
@ -1,4 +1,4 @@
|
||||
//===- MSFError.h - Error extensions for MSF Files --------------*- C++ -*-===//
|
||||
//===- MsfError.h - Error extensions for Msf Files --------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -26,12 +26,12 @@ enum class msf_error_code {
|
||||
};
|
||||
|
||||
/// Base class for errors originating when parsing raw PDB files
|
||||
class MSFError : public ErrorInfo<MSFError> {
|
||||
class MsfError : public ErrorInfo<MsfError> {
|
||||
public:
|
||||
static char ID;
|
||||
MSFError(msf_error_code C);
|
||||
MSFError(const std::string &Context);
|
||||
MSFError(msf_error_code C, const std::string &Context);
|
||||
MsfError(msf_error_code C);
|
||||
MsfError(const std::string &Context);
|
||||
MsfError(msf_error_code C, const std::string &Context);
|
||||
|
||||
void log(raw_ostream &OS) const override;
|
||||
const std::string &getErrorMessage() const;
|
@ -1,4 +1,4 @@
|
||||
//===- MSFStreamLayout.h - Describes the layout of a stream -----*- C++ -*-===//
|
||||
//===- MsfStreamLayout.h - Describes the layout of a stream -----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -18,13 +18,13 @@
|
||||
namespace llvm {
|
||||
namespace msf {
|
||||
|
||||
/// \brief Describes the layout of a stream in an MSF layout. A "stream" here
|
||||
/// is defined as any logical unit of data which may be arranged inside the MSF
|
||||
/// \brief Describes the layout of a stream in an Msf layout. A "stream" here
|
||||
/// is defined as any logical unit of data which may be arranged inside the Msf
|
||||
/// file as a sequence of (possibly discontiguous) blocks. When we want to read
|
||||
/// from a particular MSF Stream, we fill out a stream layout structure and the
|
||||
/// reader uses it to determine which blocks in the underlying MSF file contain
|
||||
/// from a particular Msf Stream, we fill out a stream layout structure and the
|
||||
/// reader uses it to determine which blocks in the underlying Msf file contain
|
||||
/// the data, so that it can be pieced together in the right order.
|
||||
class MSFStreamLayout {
|
||||
class MsfStreamLayout {
|
||||
public:
|
||||
uint32_t Length;
|
||||
ArrayRef<support::ulittle32_t> Blocks;
|
@ -10,7 +10,7 @@
|
||||
#ifndef LLVM_DEBUGINFO_MSF_STREAMARRAY_H
|
||||
#define LLVM_DEBUGINFO_MSF_STREAMARRAY_H
|
||||
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include <functional>
|
@ -11,10 +11,10 @@
|
||||
#define LLVM_DEBUGINFO_MSF_STREAMREADER_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
@ -61,7 +61,7 @@ public:
|
||||
}
|
||||
|
||||
if (NumElements > UINT32_MAX / sizeof(T))
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
if (auto EC = readBytes(Bytes, NumElements * sizeof(T)))
|
||||
return EC;
|
||||
@ -86,9 +86,9 @@ public:
|
||||
}
|
||||
uint32_t Length = NumItems * sizeof(T);
|
||||
if (Length / sizeof(T) != NumItems)
|
||||
return make_error<MSFError>(msf_error_code::invalid_format);
|
||||
return make_error<MsfError>(msf_error_code::invalid_format);
|
||||
if (Offset + Length > Stream.getLength())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
ReadableStreamRef View = Stream.slice(Offset, Length);
|
||||
Array = FixedStreamArray<T>(View);
|
||||
Offset += Length;
|
@ -10,8 +10,8 @@
|
||||
#ifndef LLVM_DEBUGINFO_MSF_STREAMREF_H
|
||||
#define LLVM_DEBUGINFO_MSF_STREAMREF_H
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace msf {
|
||||
@ -76,9 +76,9 @@ public:
|
||||
Error readBytes(uint32_t Offset, uint32_t Size,
|
||||
ArrayRef<uint8_t> &Buffer) const {
|
||||
if (ViewOffset + Offset < Offset)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
if (Size + Offset > Length)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
return Stream->readBytes(ViewOffset + Offset, Size, Buffer);
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ public:
|
||||
Error readLongestContiguousChunk(uint32_t Offset,
|
||||
ArrayRef<uint8_t> &Buffer) const {
|
||||
if (Offset >= Length)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
if (auto EC = Stream->readLongestContiguousChunk(Offset, Buffer))
|
||||
return EC;
|
||||
@ -117,7 +117,7 @@ public:
|
||||
|
||||
Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Data) const {
|
||||
if (Data.size() + Offset > Length)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
return Stream->writeBytes(ViewOffset + Offset, Data);
|
||||
}
|
||||
|
@ -11,10 +11,10 @@
|
||||
#define LLVM_DEBUGINFO_MSF_STREAMWRITER_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
@ -54,7 +54,7 @@ public:
|
||||
return Error::success();
|
||||
|
||||
if (Array.size() > UINT32_MAX / sizeof(T))
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
return writeBytes(
|
||||
ArrayRef<uint8_t>(reinterpret_cast<const uint8_t *>(Array.data()),
|
@ -11,9 +11,9 @@
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include "llvm/ADT/StringSet.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/ByteStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
@ -48,7 +48,7 @@ public:
|
||||
|
||||
Expected<std::unique_ptr<DbiStream>> build(PDBFile &File,
|
||||
const msf::WritableStream &Buffer);
|
||||
Error commit(const msf::MSFLayout &Layout,
|
||||
Error commit(const msf::MsfLayout &Layout,
|
||||
const msf::WritableStream &Buffer) const;
|
||||
|
||||
private:
|
||||
|
@ -11,7 +11,7 @@
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_PDBINFOSTREAM_H
|
||||
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameMap.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
Expected<std::unique_ptr<InfoStream>>
|
||||
build(PDBFile &File, const msf::WritableStream &Buffer);
|
||||
|
||||
Error commit(const msf::MSFLayout &Layout,
|
||||
Error commit(const msf::MsfLayout &Layout,
|
||||
const msf::WritableStream &Buffer) const;
|
||||
|
||||
private:
|
||||
|
@ -11,8 +11,8 @@
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_MODINFO_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include <cstdint>
|
||||
|
@ -14,9 +14,9 @@
|
||||
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
namespace llvm {
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
|
@ -11,10 +11,10 @@
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_PDBFILE_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/DebugInfo/MSF/IMSFFile.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFCommon.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfFile.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
@ -38,7 +38,7 @@ class PublicsStream;
|
||||
class SymbolStream;
|
||||
class TpiStream;
|
||||
|
||||
class PDBFile : public msf::IMSFFile {
|
||||
class PDBFile : public msf::IMsfFile {
|
||||
friend PDBFileBuilder;
|
||||
|
||||
public:
|
||||
@ -74,7 +74,7 @@ public:
|
||||
return ContainerLayout.StreamMap;
|
||||
}
|
||||
|
||||
const msf::MSFLayout &getMsfLayout() const { return ContainerLayout; }
|
||||
const msf::MsfLayout &getMsfLayout() const { return ContainerLayout; }
|
||||
const msf::ReadableStream &getMsfBuffer() const { return *Buffer; }
|
||||
|
||||
ArrayRef<support::ulittle32_t> getDirectoryBlockArray() const;
|
||||
@ -95,7 +95,7 @@ private:
|
||||
|
||||
std::unique_ptr<msf::ReadableStream> Buffer;
|
||||
|
||||
msf::MSFLayout ContainerLayout;
|
||||
msf::MsfLayout ContainerLayout;
|
||||
|
||||
std::unique_ptr<InfoStream> Info;
|
||||
std::unique_ptr<DbiStream> Dbi;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
namespace llvm {
|
||||
namespace msf {
|
||||
class MSFBuilder;
|
||||
class MsfBuilder;
|
||||
}
|
||||
namespace pdb {
|
||||
class DbiStreamBuilder;
|
||||
@ -37,7 +37,7 @@ public:
|
||||
|
||||
Error initialize(const msf::SuperBlock &Super);
|
||||
|
||||
msf::MSFBuilder &getMsfBuilder();
|
||||
msf::MsfBuilder &getMsfBuilder();
|
||||
InfoStreamBuilder &getInfoBuilder();
|
||||
DbiStreamBuilder &getDbiBuilder();
|
||||
|
||||
@ -47,11 +47,11 @@ public:
|
||||
Error commit(const msf::WritableStream &Buffer);
|
||||
|
||||
private:
|
||||
Expected<msf::MSFLayout> finalizeMsfLayout() const;
|
||||
Expected<msf::MsfLayout> finalizeMsfLayout() const;
|
||||
|
||||
BumpPtrAllocator &Allocator;
|
||||
|
||||
std::unique_ptr<msf::MSFBuilder> Msf;
|
||||
std::unique_ptr<msf::MsfBuilder> Msf;
|
||||
std::unique_ptr<InfoStreamBuilder> Info;
|
||||
std::unique_ptr<DbiStreamBuilder> Dbi;
|
||||
};
|
||||
|
@ -11,8 +11,8 @@
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_PUBLICSSTREAM_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
|
||||
#include "llvm/DebugInfo/MSF/ByteStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
|
@ -19,4 +19,4 @@
|
||||
type = Library
|
||||
name = AsmPrinter
|
||||
parent = Libraries
|
||||
required_libraries = Analysis CodeGen Core DebugInfoCodeView DebugInfoMSF MC MCParser Support Target TransformUtils
|
||||
required_libraries = Analysis CodeGen Core DebugInfoCodeView DebugInfoMsf MC MCParser Support Target TransformUtils
|
||||
|
@ -1,5 +1,5 @@
|
||||
add_subdirectory(DWARF)
|
||||
add_subdirectory(MSF)
|
||||
add_subdirectory(Msf)
|
||||
add_subdirectory(CodeView)
|
||||
add_subdirectory(PDB)
|
||||
add_subdirectory(Symbolize)
|
||||
|
@ -19,4 +19,4 @@
|
||||
type = Library
|
||||
name = DebugInfoCodeView
|
||||
parent = DebugInfo
|
||||
required_libraries = Support DebugInfoMSF
|
||||
required_libraries = Support DebugInfoMsf
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
|
@ -8,8 +8,8 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/MSF/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/Support/ScopedPrinter.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
@ -16,7 +16,7 @@
|
||||
;===------------------------------------------------------------------------===;
|
||||
|
||||
[common]
|
||||
subdirectories = DWARF MSF CodeView PDB Symbolize
|
||||
subdirectories = DWARF Msf CodeView PDB Symbolize
|
||||
|
||||
[component_0]
|
||||
type = Group
|
||||
|
@ -1,8 +1,8 @@
|
||||
add_llvm_library(LLVMDebugInfoMSF
|
||||
add_llvm_library(LLVMDebugInfoMsf
|
||||
MappedBlockStream.cpp
|
||||
MSFBuilder.cpp
|
||||
MSFCommon.cpp
|
||||
MSFError.cpp
|
||||
MsfBuilder.cpp
|
||||
MsfCommon.cpp
|
||||
MsfError.cpp
|
||||
StreamReader.cpp
|
||||
StreamWriter.cpp
|
||||
ADDITIONAL_HEADER_DIRS
|
@ -1,4 +1,4 @@
|
||||
;===- ./lib/DebugInfo/MSF/LLVMBuild.txt -------------------*- Conf -*--===;
|
||||
;===- ./lib/DebugInfo/Msf/LLVMBuild.txt -------------------*- Conf -*--===;
|
||||
;
|
||||
; The LLVM Compiler Infrastructure
|
||||
;
|
||||
@ -17,6 +17,6 @@
|
||||
|
||||
[component_0]
|
||||
type = Library
|
||||
name = DebugInfoMSF
|
||||
name = DebugInfoMsf
|
||||
parent = DebugInfo
|
||||
required_libraries = Support
|
@ -7,12 +7,12 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/IMSFFile.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFCommon.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFStreamLayout.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfFile.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfStreamLayout.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
@ -33,24 +33,24 @@ static Interval intersect(const Interval &I1, const Interval &I2) {
|
||||
}
|
||||
|
||||
MappedBlockStream::MappedBlockStream(uint32_t BlockSize, uint32_t NumBlocks,
|
||||
const MSFStreamLayout &Layout,
|
||||
const MsfStreamLayout &Layout,
|
||||
const ReadableStream &MsfData)
|
||||
: BlockSize(BlockSize), NumBlocks(NumBlocks), StreamLayout(Layout),
|
||||
MsfData(MsfData) {}
|
||||
|
||||
std::unique_ptr<MappedBlockStream>
|
||||
MappedBlockStream::createStream(uint32_t BlockSize, uint32_t NumBlocks,
|
||||
const MSFStreamLayout &Layout,
|
||||
const MsfStreamLayout &Layout,
|
||||
const ReadableStream &MsfData) {
|
||||
return llvm::make_unique<MappedBlockStreamImpl<MappedBlockStream>>(
|
||||
BlockSize, NumBlocks, Layout, MsfData);
|
||||
}
|
||||
|
||||
std::unique_ptr<MappedBlockStream>
|
||||
MappedBlockStream::createIndexedStream(const MSFLayout &Layout,
|
||||
MappedBlockStream::createIndexedStream(const MsfLayout &Layout,
|
||||
const ReadableStream &MsfData,
|
||||
uint32_t StreamIndex) {
|
||||
MSFStreamLayout SL;
|
||||
MsfStreamLayout SL;
|
||||
SL.Blocks = Layout.StreamMap[StreamIndex];
|
||||
SL.Length = Layout.StreamSizes[StreamIndex];
|
||||
return llvm::make_unique<MappedBlockStreamImpl<MappedBlockStream>>(
|
||||
@ -58,9 +58,9 @@ MappedBlockStream::createIndexedStream(const MSFLayout &Layout,
|
||||
}
|
||||
|
||||
std::unique_ptr<MappedBlockStream>
|
||||
MappedBlockStream::createDirectoryStream(const MSFLayout &Layout,
|
||||
MappedBlockStream::createDirectoryStream(const MsfLayout &Layout,
|
||||
const ReadableStream &MsfData) {
|
||||
MSFStreamLayout SL;
|
||||
MsfStreamLayout SL;
|
||||
SL.Blocks = Layout.DirectoryBlocks;
|
||||
SL.Length = Layout.SB->NumDirectoryBytes;
|
||||
return createStream(Layout.SB->BlockSize, Layout.SB->NumBlocks, SL, MsfData);
|
||||
@ -70,9 +70,9 @@ Error MappedBlockStream::readBytes(uint32_t Offset, uint32_t Size,
|
||||
ArrayRef<uint8_t> &Buffer) const {
|
||||
// Make sure we aren't trying to read beyond the end of the stream.
|
||||
if (Size > StreamLayout.Length)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
if (Offset > StreamLayout.Length - Size)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
if (tryReadContiguously(Offset, Size, Buffer))
|
||||
return Error::success();
|
||||
@ -150,7 +150,7 @@ Error MappedBlockStream::readLongestContiguousChunk(
|
||||
uint32_t Offset, ArrayRef<uint8_t> &Buffer) const {
|
||||
// Make sure we aren't trying to read beyond the end of the stream.
|
||||
if (Offset >= StreamLayout.Length)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
uint32_t First = Offset / BlockSize;
|
||||
uint32_t Last = First;
|
||||
|
||||
@ -221,9 +221,9 @@ Error MappedBlockStream::readBytes(uint32_t Offset,
|
||||
|
||||
// Make sure we aren't trying to read beyond the end of the stream.
|
||||
if (Buffer.size() > StreamLayout.Length)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
if (Offset > StreamLayout.Length - Buffer.size())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
uint32_t BytesLeft = Buffer.size();
|
||||
uint32_t BytesWritten = 0;
|
||||
@ -292,24 +292,24 @@ void MappedBlockStream::fixCacheAfterWrite(uint32_t Offset,
|
||||
}
|
||||
|
||||
WritableMappedBlockStream::WritableMappedBlockStream(
|
||||
uint32_t BlockSize, uint32_t NumBlocks, const MSFStreamLayout &Layout,
|
||||
uint32_t BlockSize, uint32_t NumBlocks, const MsfStreamLayout &Layout,
|
||||
const WritableStream &MsfData)
|
||||
: ReadInterface(BlockSize, NumBlocks, Layout, MsfData),
|
||||
WriteInterface(MsfData) {}
|
||||
|
||||
std::unique_ptr<WritableMappedBlockStream>
|
||||
WritableMappedBlockStream::createStream(uint32_t BlockSize, uint32_t NumBlocks,
|
||||
const MSFStreamLayout &Layout,
|
||||
const MsfStreamLayout &Layout,
|
||||
const WritableStream &MsfData) {
|
||||
return llvm::make_unique<MappedBlockStreamImpl<WritableMappedBlockStream>>(
|
||||
BlockSize, NumBlocks, Layout, MsfData);
|
||||
}
|
||||
|
||||
std::unique_ptr<WritableMappedBlockStream>
|
||||
WritableMappedBlockStream::createIndexedStream(const MSFLayout &Layout,
|
||||
WritableMappedBlockStream::createIndexedStream(const MsfLayout &Layout,
|
||||
const WritableStream &MsfData,
|
||||
uint32_t StreamIndex) {
|
||||
MSFStreamLayout SL;
|
||||
MsfStreamLayout SL;
|
||||
SL.Blocks = Layout.StreamMap[StreamIndex];
|
||||
SL.Length = Layout.StreamSizes[StreamIndex];
|
||||
return createStream(Layout.SB->BlockSize, Layout.SB->NumBlocks, SL, MsfData);
|
||||
@ -317,8 +317,8 @@ WritableMappedBlockStream::createIndexedStream(const MSFLayout &Layout,
|
||||
|
||||
std::unique_ptr<WritableMappedBlockStream>
|
||||
WritableMappedBlockStream::createDirectoryStream(
|
||||
const MSFLayout &Layout, const WritableStream &MsfData) {
|
||||
MSFStreamLayout SL;
|
||||
const MsfLayout &Layout, const WritableStream &MsfData) {
|
||||
MsfStreamLayout SL;
|
||||
SL.Blocks = Layout.DirectoryBlocks;
|
||||
SL.Length = Layout.SB->NumDirectoryBytes;
|
||||
return createStream(Layout.SB->BlockSize, Layout.SB->NumBlocks, SL, MsfData);
|
||||
@ -342,10 +342,10 @@ Error WritableMappedBlockStream::writeBytes(uint32_t Offset,
|
||||
ArrayRef<uint8_t> Buffer) const {
|
||||
// Make sure we aren't trying to write beyond the end of the stream.
|
||||
if (Buffer.size() > getStreamLength())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
if (Offset > getStreamLayout().Length - Buffer.size())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
uint32_t BlockNum = Offset / getBlockSize();
|
||||
uint32_t OffsetInBlock = Offset % getBlockSize();
|
@ -6,8 +6,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfBuilder.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
@ -22,7 +22,7 @@ const uint32_t kNumReservedPages = 3;
|
||||
const uint32_t kDefaultBlockMapAddr = kNumReservedPages;
|
||||
}
|
||||
|
||||
MSFBuilder::MSFBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
|
||||
MsfBuilder::MsfBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
|
||||
BumpPtrAllocator &Allocator)
|
||||
: Allocator(Allocator), IsGrowable(CanGrow), BlockSize(BlockSize),
|
||||
MininumBlocks(MinBlockCount), BlockMapAddr(kDefaultBlockMapAddr),
|
||||
@ -33,31 +33,31 @@ MSFBuilder::MSFBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
|
||||
FreeBlocks[BlockMapAddr] = false;
|
||||
}
|
||||
|
||||
Expected<MSFBuilder> MSFBuilder::create(BumpPtrAllocator &Allocator,
|
||||
Expected<MsfBuilder> MsfBuilder::create(BumpPtrAllocator &Allocator,
|
||||
uint32_t BlockSize,
|
||||
uint32_t MinBlockCount, bool CanGrow) {
|
||||
if (!isValidBlockSize(BlockSize))
|
||||
return make_error<MSFError>(msf_error_code::invalid_format,
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"The requested block size is unsupported");
|
||||
|
||||
return MSFBuilder(BlockSize,
|
||||
return MsfBuilder(BlockSize,
|
||||
std::max(MinBlockCount, msf::getMinimumBlockCount()),
|
||||
CanGrow, Allocator);
|
||||
}
|
||||
|
||||
Error MSFBuilder::setBlockMapAddr(uint32_t Addr) {
|
||||
Error MsfBuilder::setBlockMapAddr(uint32_t Addr) {
|
||||
if (Addr == BlockMapAddr)
|
||||
return Error::success();
|
||||
|
||||
if (Addr >= FreeBlocks.size()) {
|
||||
if (!IsGrowable)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer,
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer,
|
||||
"Cannot grow the number of blocks");
|
||||
FreeBlocks.resize(Addr + 1);
|
||||
}
|
||||
|
||||
if (!isBlockFree(Addr))
|
||||
return make_error<MSFError>(
|
||||
return make_error<MsfError>(
|
||||
msf_error_code::block_in_use,
|
||||
"Requested block map address is already in use");
|
||||
FreeBlocks[BlockMapAddr] = true;
|
||||
@ -66,16 +66,16 @@ Error MSFBuilder::setBlockMapAddr(uint32_t Addr) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
void MSFBuilder::setFreePageMap(uint32_t Fpm) { FreePageMap = Fpm; }
|
||||
void MsfBuilder::setFreePageMap(uint32_t Fpm) { FreePageMap = Fpm; }
|
||||
|
||||
void MSFBuilder::setUnknown1(uint32_t Unk1) { Unknown1 = Unk1; }
|
||||
void MsfBuilder::setUnknown1(uint32_t Unk1) { Unknown1 = Unk1; }
|
||||
|
||||
Error MSFBuilder::setDirectoryBlocksHint(ArrayRef<uint32_t> DirBlocks) {
|
||||
Error MsfBuilder::setDirectoryBlocksHint(ArrayRef<uint32_t> DirBlocks) {
|
||||
for (auto B : DirectoryBlocks)
|
||||
FreeBlocks[B] = true;
|
||||
for (auto B : DirBlocks) {
|
||||
if (!isBlockFree(B)) {
|
||||
return make_error<MSFError>(msf_error_code::unspecified,
|
||||
return make_error<MsfError>(msf_error_code::unspecified,
|
||||
"Attempt to reuse an allocated block");
|
||||
}
|
||||
FreeBlocks[B] = false;
|
||||
@ -85,7 +85,7 @@ Error MSFBuilder::setDirectoryBlocksHint(ArrayRef<uint32_t> DirBlocks) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error MSFBuilder::allocateBlocks(uint32_t NumBlocks,
|
||||
Error MsfBuilder::allocateBlocks(uint32_t NumBlocks,
|
||||
MutableArrayRef<uint32_t> Blocks) {
|
||||
if (NumBlocks == 0)
|
||||
return Error::success();
|
||||
@ -93,7 +93,7 @@ Error MSFBuilder::allocateBlocks(uint32_t NumBlocks,
|
||||
uint32_t NumFreeBlocks = FreeBlocks.count();
|
||||
if (NumFreeBlocks < NumBlocks) {
|
||||
if (!IsGrowable)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer,
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer,
|
||||
"There are no free Blocks in the file");
|
||||
uint32_t AllocBlocks = NumBlocks - NumFreeBlocks;
|
||||
FreeBlocks.resize(AllocBlocks + FreeBlocks.size(), true);
|
||||
@ -112,23 +112,23 @@ Error MSFBuilder::allocateBlocks(uint32_t NumBlocks,
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
uint32_t MSFBuilder::getNumUsedBlocks() const {
|
||||
uint32_t MsfBuilder::getNumUsedBlocks() const {
|
||||
return getTotalBlockCount() - getNumFreeBlocks();
|
||||
}
|
||||
|
||||
uint32_t MSFBuilder::getNumFreeBlocks() const { return FreeBlocks.count(); }
|
||||
uint32_t MsfBuilder::getNumFreeBlocks() const { return FreeBlocks.count(); }
|
||||
|
||||
uint32_t MSFBuilder::getTotalBlockCount() const { return FreeBlocks.size(); }
|
||||
uint32_t MsfBuilder::getTotalBlockCount() const { return FreeBlocks.size(); }
|
||||
|
||||
bool MSFBuilder::isBlockFree(uint32_t Idx) const { return FreeBlocks[Idx]; }
|
||||
bool MsfBuilder::isBlockFree(uint32_t Idx) const { return FreeBlocks[Idx]; }
|
||||
|
||||
Error MSFBuilder::addStream(uint32_t Size, ArrayRef<uint32_t> Blocks) {
|
||||
Error MsfBuilder::addStream(uint32_t Size, ArrayRef<uint32_t> Blocks) {
|
||||
// Add a new stream mapped to the specified blocks. Verify that the specified
|
||||
// blocks are both necessary and sufficient for holding the requested number
|
||||
// of bytes, and verify that all requested blocks are free.
|
||||
uint32_t ReqBlocks = bytesToBlocks(Size, BlockSize);
|
||||
if (ReqBlocks != Blocks.size())
|
||||
return make_error<MSFError>(
|
||||
return make_error<MsfError>(
|
||||
msf_error_code::invalid_format,
|
||||
"Incorrect number of blocks for requested stream size");
|
||||
for (auto Block : Blocks) {
|
||||
@ -136,7 +136,7 @@ Error MSFBuilder::addStream(uint32_t Size, ArrayRef<uint32_t> Blocks) {
|
||||
FreeBlocks.resize(Block + 1, true);
|
||||
|
||||
if (!FreeBlocks.test(Block))
|
||||
return make_error<MSFError>(
|
||||
return make_error<MsfError>(
|
||||
msf_error_code::unspecified,
|
||||
"Attempt to re-use an already allocated block");
|
||||
}
|
||||
@ -148,7 +148,7 @@ Error MSFBuilder::addStream(uint32_t Size, ArrayRef<uint32_t> Blocks) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error MSFBuilder::addStream(uint32_t Size) {
|
||||
Error MsfBuilder::addStream(uint32_t Size) {
|
||||
uint32_t ReqBlocks = bytesToBlocks(Size, BlockSize);
|
||||
std::vector<uint32_t> NewBlocks;
|
||||
NewBlocks.resize(ReqBlocks);
|
||||
@ -158,7 +158,7 @@ Error MSFBuilder::addStream(uint32_t Size) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error MSFBuilder::setStreamSize(uint32_t Idx, uint32_t Size) {
|
||||
Error MsfBuilder::setStreamSize(uint32_t Idx, uint32_t Size) {
|
||||
uint32_t OldSize = getStreamSize(Idx);
|
||||
if (OldSize == Size)
|
||||
return Error::success();
|
||||
@ -191,17 +191,17 @@ Error MSFBuilder::setStreamSize(uint32_t Idx, uint32_t Size) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
uint32_t MSFBuilder::getNumStreams() const { return StreamData.size(); }
|
||||
uint32_t MsfBuilder::getNumStreams() const { return StreamData.size(); }
|
||||
|
||||
uint32_t MSFBuilder::getStreamSize(uint32_t StreamIdx) const {
|
||||
uint32_t MsfBuilder::getStreamSize(uint32_t StreamIdx) const {
|
||||
return StreamData[StreamIdx].first;
|
||||
}
|
||||
|
||||
ArrayRef<uint32_t> MSFBuilder::getStreamBlocks(uint32_t StreamIdx) const {
|
||||
ArrayRef<uint32_t> MsfBuilder::getStreamBlocks(uint32_t StreamIdx) const {
|
||||
return StreamData[StreamIdx].second;
|
||||
}
|
||||
|
||||
uint32_t MSFBuilder::computeDirectoryByteSize() const {
|
||||
uint32_t MsfBuilder::computeDirectoryByteSize() const {
|
||||
// The directory has the following layout, where each item is a ulittle32_t:
|
||||
// NumStreams
|
||||
// StreamSizes[NumStreams]
|
||||
@ -217,9 +217,9 @@ uint32_t MSFBuilder::computeDirectoryByteSize() const {
|
||||
return Size;
|
||||
}
|
||||
|
||||
Expected<MSFLayout> MSFBuilder::build() {
|
||||
Expected<MsfLayout> MsfBuilder::build() {
|
||||
SuperBlock *SB = Allocator.Allocate<SuperBlock>();
|
||||
MSFLayout L;
|
||||
MsfLayout L;
|
||||
L.SB = SB;
|
||||
|
||||
std::memcpy(SB->MagicBytes, Magic, sizeof(Magic));
|
@ -1,4 +1,4 @@
|
||||
//===- MSFCommon.cpp - Common types and functions for MSF files -*- C++ -*-===//
|
||||
//===- MsfCommon.cpp - Common types and functions for MSF files -*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -7,8 +7,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MSFCommon.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
@ -16,16 +16,16 @@ using namespace llvm::msf;
|
||||
Error llvm::msf::validateSuperBlock(const SuperBlock &SB) {
|
||||
// Check the magic bytes.
|
||||
if (std::memcmp(SB.MagicBytes, Magic, sizeof(Magic)) != 0)
|
||||
return make_error<MSFError>(msf_error_code::invalid_format,
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"MSF magic header doesn't match");
|
||||
|
||||
if (!isValidBlockSize(SB.BlockSize))
|
||||
return make_error<MSFError>(msf_error_code::invalid_format,
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"Unsupported block size.");
|
||||
|
||||
// We don't support directories whose sizes aren't a multiple of four bytes.
|
||||
if (SB.NumDirectoryBytes % sizeof(support::ulittle32_t) != 0)
|
||||
return make_error<MSFError>(msf_error_code::invalid_format,
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"Directory size is not multiple of 4.");
|
||||
|
||||
// The number of blocks which comprise the directory is a simple function of
|
||||
@ -37,11 +37,11 @@ Error llvm::msf::validateSuperBlock(const SuperBlock &SB) {
|
||||
// block numbers. It is unclear what would happen if the number of blocks
|
||||
// couldn't fit on a single block.
|
||||
if (NumDirectoryBlocks > SB.BlockSize / sizeof(support::ulittle32_t))
|
||||
return make_error<MSFError>(msf_error_code::invalid_format,
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"Too many directory blocks.");
|
||||
|
||||
if (SB.BlockMapAddr == 0)
|
||||
return make_error<MSFError>(msf_error_code::invalid_format,
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"Block 0 is reserved");
|
||||
|
||||
return Error::success();
|
@ -1,4 +1,4 @@
|
||||
//===- MSFError.cpp - Error extensions for MSF files ------------*- C++ -*-===//
|
||||
//===- MsfError.cpp - Error extensions for Msf files ------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -7,7 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
|
||||
@ -18,7 +18,7 @@ namespace {
|
||||
// FIXME: This class is only here to support the transition to llvm::Error. It
|
||||
// will be removed once this transition is complete. Clients should prefer to
|
||||
// deal with the Error value directly, rather than converting to error_code.
|
||||
class MSFErrorCategory : public std::error_category {
|
||||
class MsfErrorCategory : public std::error_category {
|
||||
public:
|
||||
const char *name() const LLVM_NOEXCEPT override { return "llvm.msf"; }
|
||||
|
||||
@ -43,17 +43,17 @@ public:
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
static ManagedStatic<MSFErrorCategory> Category;
|
||||
static ManagedStatic<MsfErrorCategory> Category;
|
||||
|
||||
char MSFError::ID = 0;
|
||||
char MsfError::ID = 0;
|
||||
|
||||
MSFError::MSFError(msf_error_code C) : MSFError(C, "") {}
|
||||
MsfError::MsfError(msf_error_code C) : MsfError(C, "") {}
|
||||
|
||||
MSFError::MSFError(const std::string &Context)
|
||||
: MSFError(msf_error_code::unspecified, Context) {}
|
||||
MsfError::MsfError(const std::string &Context)
|
||||
: MsfError(msf_error_code::unspecified, Context) {}
|
||||
|
||||
MSFError::MSFError(msf_error_code C, const std::string &Context) : Code(C) {
|
||||
ErrMsg = "MSF Error: ";
|
||||
MsfError::MsfError(msf_error_code C, const std::string &Context) : Code(C) {
|
||||
ErrMsg = "Msf Error: ";
|
||||
std::error_code EC = convertToErrorCode();
|
||||
if (Code != msf_error_code::unspecified)
|
||||
ErrMsg += EC.message() + " ";
|
||||
@ -61,10 +61,10 @@ MSFError::MSFError(msf_error_code C, const std::string &Context) : Code(C) {
|
||||
ErrMsg += Context;
|
||||
}
|
||||
|
||||
void MSFError::log(raw_ostream &OS) const { OS << ErrMsg << "\n"; }
|
||||
void MsfError::log(raw_ostream &OS) const { OS << ErrMsg << "\n"; }
|
||||
|
||||
const std::string &MSFError::getErrorMessage() const { return ErrMsg; }
|
||||
const std::string &MsfError::getErrorMessage() const { return ErrMsg; }
|
||||
|
||||
std::error_code MSFError::convertToErrorCode() const {
|
||||
std::error_code MsfError::convertToErrorCode() const {
|
||||
return std::error_code(static_cast<int>(Code), *Category);
|
||||
}
|
@ -7,10 +7,10 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
@ -86,7 +86,7 @@ Error StreamReader::readStreamRef(ReadableStreamRef &Ref) {
|
||||
|
||||
Error StreamReader::readStreamRef(ReadableStreamRef &Ref, uint32_t Length) {
|
||||
if (bytesRemaining() < Length)
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
Ref = Stream.slice(Offset, Length);
|
||||
Offset += Length;
|
||||
return Error::success();
|
@ -7,11 +7,11 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/MSF/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MSFError.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
@ -19,5 +19,5 @@
|
||||
type = Library
|
||||
name = DebugInfoPDB
|
||||
parent = DebugInfo
|
||||
required_libraries = Object Support DebugInfoCodeView DebugInfoMSF
|
||||
required_libraries = Object Support DebugInfoCodeView DebugInfoMsf
|
||||
|
||||
|
@ -9,9 +9,9 @@
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
||||
@ -248,7 +248,7 @@ DbiStreamBuilder::build(PDBFile &File, const msf::WritableStream &Buffer) {
|
||||
return std::move(Dbi);
|
||||
}
|
||||
|
||||
Error DbiStreamBuilder::commit(const msf::MSFLayout &Layout,
|
||||
Error DbiStreamBuilder::commit(const msf::MsfLayout &Layout,
|
||||
const msf::WritableStream &Buffer) const {
|
||||
auto InfoS =
|
||||
WritableMappedBlockStream::createIndexedStream(Layout, Buffer, StreamDBI);
|
||||
|
@ -10,8 +10,8 @@
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
|
||||
@ -55,7 +55,7 @@ InfoStreamBuilder::build(PDBFile &File, const msf::WritableStream &Buffer) {
|
||||
return std::move(Info);
|
||||
}
|
||||
|
||||
Error InfoStreamBuilder::commit(const msf::MSFLayout &Layout,
|
||||
Error InfoStreamBuilder::commit(const msf::MsfLayout &Layout,
|
||||
const msf::WritableStream &Buffer) const {
|
||||
auto InfoS =
|
||||
WritableMappedBlockStream::createIndexedStream(Layout, Buffer, StreamPDB);
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModStream.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/Hash.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameMap.h"
|
||||
#include "llvm/ADT/SparseBitVector.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameMapBuilder.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameMap.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
|
@ -10,10 +10,10 @@
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamArray.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
|
||||
|
@ -11,9 +11,9 @@
|
||||
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfBuilder.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
|
||||
@ -31,20 +31,20 @@ PDBFileBuilder::PDBFileBuilder(BumpPtrAllocator &Allocator)
|
||||
|
||||
Error PDBFileBuilder::initialize(const msf::SuperBlock &Super) {
|
||||
auto ExpectedMsf =
|
||||
MSFBuilder::create(Allocator, Super.BlockSize, Super.NumBlocks);
|
||||
MsfBuilder::create(Allocator, Super.BlockSize, Super.NumBlocks);
|
||||
if (!ExpectedMsf)
|
||||
return ExpectedMsf.takeError();
|
||||
|
||||
auto &MsfResult = *ExpectedMsf;
|
||||
if (auto EC = MsfResult.setBlockMapAddr(Super.BlockMapAddr))
|
||||
return EC;
|
||||
Msf = llvm::make_unique<MSFBuilder>(std::move(MsfResult));
|
||||
Msf = llvm::make_unique<MsfBuilder>(std::move(MsfResult));
|
||||
Msf->setFreePageMap(Super.FreeBlockMapBlock);
|
||||
Msf->setUnknown1(Super.Unknown1);
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
MSFBuilder &PDBFileBuilder::getMsfBuilder() { return *Msf; }
|
||||
MsfBuilder &PDBFileBuilder::getMsfBuilder() { return *Msf; }
|
||||
|
||||
InfoStreamBuilder &PDBFileBuilder::getInfoBuilder() {
|
||||
if (!Info)
|
||||
@ -58,7 +58,7 @@ DbiStreamBuilder &PDBFileBuilder::getDbiBuilder() {
|
||||
return *Dbi;
|
||||
}
|
||||
|
||||
Expected<msf::MSFLayout> PDBFileBuilder::finalizeMsfLayout() const {
|
||||
Expected<msf::MsfLayout> PDBFileBuilder::finalizeMsfLayout() const {
|
||||
if (Info) {
|
||||
uint32_t Length = Info->calculateSerializedLength();
|
||||
if (auto EC = Msf->setStreamSize(StreamPDB, Length))
|
||||
|
@ -26,8 +26,8 @@
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawSession.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/ByteStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/PDB/GenericError.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/Hash.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
DebugInfoCodeView
|
||||
DebugInfoMSF
|
||||
DebugInfoMsf
|
||||
DebugInfoPDB
|
||||
Object
|
||||
Support
|
||||
|
@ -19,5 +19,5 @@
|
||||
type = Tool
|
||||
name = llvm-pdbdump
|
||||
parent = Tools
|
||||
required_libraries = DebugInfoMSF DebugInfoPDB
|
||||
required_libraries = DebugInfoMsf DebugInfoPDB
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include "llvm/DebugInfo/CodeView/EnumTables.h"
|
||||
#include "llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolDumper.h"
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBExtras.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/EnumTables.h"
|
||||
|
@ -113,7 +113,7 @@ void MappingTraits<PdbObject>::mapping(IO &IO, PdbObject &Obj) {
|
||||
IO.mapOptional("DbiStream", Obj.DbiStream);
|
||||
}
|
||||
|
||||
void MappingTraits<MSFHeaders>::mapping(IO &IO, MSFHeaders &Obj) {
|
||||
void MappingTraits<MsfHeaders>::mapping(IO &IO, MsfHeaders &Obj) {
|
||||
IO.mapRequired("SuperBlock", Obj.SuperBlock);
|
||||
IO.mapRequired("NumDirectoryBlocks", Obj.NumDirectoryBlocks);
|
||||
IO.mapRequired("DirectoryBlocks", Obj.DirectoryBlocks);
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "OutputStyle.h"
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFCommon.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
@ -26,7 +26,7 @@ namespace llvm {
|
||||
namespace pdb {
|
||||
|
||||
namespace yaml {
|
||||
struct MSFHeaders {
|
||||
struct MsfHeaders {
|
||||
msf::SuperBlock SuperBlock;
|
||||
uint32_t NumDirectoryBlocks;
|
||||
std::vector<uint32_t> DirectoryBlocks;
|
||||
@ -70,7 +70,7 @@ struct PdbDbiStream {
|
||||
};
|
||||
|
||||
struct PdbObject {
|
||||
Optional<MSFHeaders> Headers;
|
||||
Optional<MsfHeaders> Headers;
|
||||
Optional<std::vector<uint32_t>> StreamSizes;
|
||||
Optional<std::vector<StreamBlockList>> StreamMap;
|
||||
Optional<PdbInfoStream> PdbStream;
|
||||
@ -87,8 +87,8 @@ template <> struct MappingTraits<pdb::yaml::PdbObject> {
|
||||
static void mapping(IO &IO, pdb::yaml::PdbObject &Obj);
|
||||
};
|
||||
|
||||
template <> struct MappingTraits<pdb::yaml::MSFHeaders> {
|
||||
static void mapping(IO &IO, pdb::yaml::MSFHeaders &Obj);
|
||||
template <> struct MappingTraits<pdb::yaml::MsfHeaders> {
|
||||
static void mapping(IO &IO, pdb::yaml::MsfHeaders &Obj);
|
||||
};
|
||||
|
||||
template <> struct MappingTraits<msf::SuperBlock> {
|
||||
|
@ -53,7 +53,7 @@ Error YAMLOutputStyle::dumpFileHeaders() {
|
||||
if (opts::pdb2yaml::NoFileHeaders)
|
||||
return Error::success();
|
||||
|
||||
yaml::MSFHeaders Headers;
|
||||
yaml::MsfHeaders Headers;
|
||||
Obj.Headers.emplace();
|
||||
Obj.Headers->SuperBlock.NumBlocks = File.getBlockCount();
|
||||
Obj.Headers->SuperBlock.BlockMapAddr = File.getBlockMapIndex();
|
||||
|
@ -29,8 +29,8 @@
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Config/config.h"
|
||||
#include "llvm/DebugInfo/MSF/ByteStream.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfBuilder.h"
|
||||
#include "llvm/DebugInfo/PDB/GenericError.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
|
||||
|
@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
|
||||
Object
|
||||
Support
|
||||
DebugInfoCodeView
|
||||
DebugInfoMSF
|
||||
DebugInfoMsf
|
||||
)
|
||||
|
||||
add_llvm_tool(llvm-readobj
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
|
||||
#include "llvm/DebugInfo/MSF/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/Object/COFF.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
|
@ -19,4 +19,4 @@
|
||||
type = Tool
|
||||
name = llvm-readobj
|
||||
parent = Tools
|
||||
required_libraries = all-targets BitReader Object DebugInfoCodeView DebugInfoMSF
|
||||
required_libraries = all-targets BitReader Object DebugInfoCodeView DebugInfoMsf
|
||||
|
@ -1,12 +1,12 @@
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
DebugInfoCodeView
|
||||
DebugInfoMSF
|
||||
DebugInfoMsf
|
||||
DebugInfoPDB
|
||||
)
|
||||
|
||||
set(DebugInfoPDBSources
|
||||
MappedBlockStreamTest.cpp
|
||||
MSFBuilderTest.cpp
|
||||
MsfBuilderTest.cpp
|
||||
PDBApiTest.cpp
|
||||
)
|
||||
|
||||
|
@ -9,13 +9,13 @@
|
||||
|
||||
#include "ErrorChecking.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/ByteStream.h"
|
||||
#include "llvm/DebugInfo/MSF/IMSFFile.h"
|
||||
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFStreamLayout.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamReader.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamRef.h"
|
||||
#include "llvm/DebugInfo/MSF/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfFile.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfStreamLayout.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <unordered_map>
|
||||
@ -39,7 +39,7 @@ public:
|
||||
Error readBytes(uint32_t Offset, uint32_t Size,
|
||||
ArrayRef<uint8_t> &Buffer) const override {
|
||||
if (Offset + Size > Data.size())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
Buffer = Data.slice(Offset, Size);
|
||||
return Error::success();
|
||||
}
|
||||
@ -47,7 +47,7 @@ public:
|
||||
Error readLongestContiguousChunk(uint32_t Offset,
|
||||
ArrayRef<uint8_t> &Buffer) const override {
|
||||
if (Offset >= Data.size())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
Buffer = Data.drop_front(Offset);
|
||||
return Error::success();
|
||||
}
|
||||
@ -56,14 +56,14 @@ public:
|
||||
|
||||
Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> SrcData) const override {
|
||||
if (Offset + SrcData.size() > Data.size())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
::memcpy(&Data[Offset], SrcData.data(), SrcData.size());
|
||||
return Error::success();
|
||||
}
|
||||
Error commit() const override { return Error::success(); }
|
||||
|
||||
MSFStreamLayout layout() const {
|
||||
return MSFStreamLayout{static_cast<uint32_t>(Data.size()), Blocks};
|
||||
MsfStreamLayout layout() const {
|
||||
return MsfStreamLayout{static_cast<uint32_t>(Data.size()), Blocks};
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -1,4 +1,4 @@
|
||||
//===- MSFBuilderTest.cpp Tests manipulation of MSF stream metadata ------===//
|
||||
//===- MsfBuilderTest.cpp Tests manipulation of MSF stream metadata ------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
@ -9,8 +9,8 @@
|
||||
|
||||
#include "ErrorChecking.h"
|
||||
|
||||
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
|
||||
#include "llvm/DebugInfo/MSF/MSFCommon.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfBuilder.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfCommon.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@ -18,7 +18,7 @@ using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
|
||||
namespace {
|
||||
class MSFBuilderTest : public testing::Test {
|
||||
class MsfBuilderTest : public testing::Test {
|
||||
protected:
|
||||
void initializeSimpleSuperBlock(msf::SuperBlock &SB) {
|
||||
initializeSuperBlock(SB);
|
||||
@ -40,7 +40,7 @@ protected:
|
||||
};
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, ValidateSuperBlockAccept) {
|
||||
TEST_F(MsfBuilderTest, ValidateSuperBlockAccept) {
|
||||
// Test that a known good super block passes validation.
|
||||
SuperBlock SB;
|
||||
initializeSuperBlock(SB);
|
||||
@ -48,7 +48,7 @@ TEST_F(MSFBuilderTest, ValidateSuperBlockAccept) {
|
||||
EXPECT_NO_ERROR(msf::validateSuperBlock(SB));
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, ValidateSuperBlockReject) {
|
||||
TEST_F(MsfBuilderTest, ValidateSuperBlockReject) {
|
||||
// Test that various known problems cause a super block to be rejected.
|
||||
SuperBlock SB;
|
||||
initializeSimpleSuperBlock(SB);
|
||||
@ -75,7 +75,7 @@ TEST_F(MSFBuilderTest, ValidateSuperBlockReject) {
|
||||
EXPECT_ERROR(msf::validateSuperBlock(SB));
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, TestUsedBlocksMarkedAsUsed) {
|
||||
TEST_F(MsfBuilderTest, TestUsedBlocksMarkedAsUsed) {
|
||||
// Test that when assigning a stream to a known list of blocks, the blocks
|
||||
// are correctly marked as used after adding, but no other incorrect blocks
|
||||
// are accidentally marked as used.
|
||||
@ -84,7 +84,7 @@ TEST_F(MSFBuilderTest, TestUsedBlocksMarkedAsUsed) {
|
||||
// Allocate some extra blocks at the end so we can verify that they're free
|
||||
// after the initialization.
|
||||
uint32_t NumBlocks = msf::getMinimumBlockCount() + Blocks.size() + 10;
|
||||
auto ExpectedMsf = MSFBuilder::create(Allocator, 4096, NumBlocks);
|
||||
auto ExpectedMsf = MsfBuilder::create(Allocator, 4096, NumBlocks);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
|
||||
@ -100,22 +100,22 @@ TEST_F(MSFBuilderTest, TestUsedBlocksMarkedAsUsed) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, TestAddStreamNoDirectoryBlockIncrease) {
|
||||
TEST_F(MsfBuilderTest, TestAddStreamNoDirectoryBlockIncrease) {
|
||||
// Test that adding a new stream correctly updates the directory. This only
|
||||
// tests the case where the directory *DOES NOT* grow large enough that it
|
||||
// crosses a Block boundary.
|
||||
auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
|
||||
auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
|
||||
auto ExpectedL1 = Msf.build();
|
||||
EXPECT_EXPECTED(ExpectedL1);
|
||||
MSFLayout &L1 = *ExpectedL1;
|
||||
MsfLayout &L1 = *ExpectedL1;
|
||||
|
||||
auto OldDirBlocks = L1.DirectoryBlocks;
|
||||
EXPECT_EQ(1U, OldDirBlocks.size());
|
||||
|
||||
auto ExpectedMsf2 = MSFBuilder::create(Allocator, 4096);
|
||||
auto ExpectedMsf2 = MsfBuilder::create(Allocator, 4096);
|
||||
EXPECT_EXPECTED(ExpectedMsf2);
|
||||
auto &Msf2 = *ExpectedMsf2;
|
||||
|
||||
@ -127,18 +127,18 @@ TEST_F(MSFBuilderTest, TestAddStreamNoDirectoryBlockIncrease) {
|
||||
|
||||
auto ExpectedL2 = Msf2.build();
|
||||
EXPECT_EXPECTED(ExpectedL2);
|
||||
MSFLayout &L2 = *ExpectedL2;
|
||||
MsfLayout &L2 = *ExpectedL2;
|
||||
auto NewDirBlocks = L2.DirectoryBlocks;
|
||||
EXPECT_EQ(1U, NewDirBlocks.size());
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, TestAddStreamWithDirectoryBlockIncrease) {
|
||||
TEST_F(MsfBuilderTest, TestAddStreamWithDirectoryBlockIncrease) {
|
||||
// Test that adding a new stream correctly updates the directory. This only
|
||||
// tests the case where the directory *DOES* grow large enough that it
|
||||
// crosses a Block boundary. This is because the newly added stream occupies
|
||||
// so many Blocks that need to be indexed in the directory that the directory
|
||||
// crosses a Block boundary.
|
||||
auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
|
||||
auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
|
||||
@ -146,15 +146,15 @@ TEST_F(MSFBuilderTest, TestAddStreamWithDirectoryBlockIncrease) {
|
||||
|
||||
auto ExpectedL1 = Msf.build();
|
||||
EXPECT_EXPECTED(ExpectedL1);
|
||||
MSFLayout &L1 = *ExpectedL1;
|
||||
MsfLayout &L1 = *ExpectedL1;
|
||||
auto DirBlocks = L1.DirectoryBlocks;
|
||||
EXPECT_EQ(2U, DirBlocks.size());
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, TestGrowStreamNoBlockIncrease) {
|
||||
TEST_F(MsfBuilderTest, TestGrowStreamNoBlockIncrease) {
|
||||
// Test growing an existing stream by a value that does not affect the number
|
||||
// of blocks it occupies.
|
||||
auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
|
||||
auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
|
||||
@ -171,12 +171,12 @@ TEST_F(MSFBuilderTest, TestGrowStreamNoBlockIncrease) {
|
||||
EXPECT_EQ(OldStreamBlocks, NewStreamBlocks);
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, TestGrowStreamWithBlockIncrease) {
|
||||
TEST_F(MsfBuilderTest, TestGrowStreamWithBlockIncrease) {
|
||||
// Test that growing an existing stream to a value large enough that it causes
|
||||
// the need to allocate new Blocks to the stream correctly updates the
|
||||
// stream's
|
||||
// block list.
|
||||
auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
|
||||
auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
|
||||
@ -194,10 +194,10 @@ TEST_F(MSFBuilderTest, TestGrowStreamWithBlockIncrease) {
|
||||
EXPECT_NE(NewStreamBlocks[0], NewStreamBlocks[1]);
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, TestShrinkStreamNoBlockDecrease) {
|
||||
TEST_F(MsfBuilderTest, TestShrinkStreamNoBlockDecrease) {
|
||||
// Test that shrinking an existing stream by a value that does not affect the
|
||||
// number of Blocks it occupies makes no changes to stream's block list.
|
||||
auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
|
||||
auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
|
||||
@ -214,11 +214,11 @@ TEST_F(MSFBuilderTest, TestShrinkStreamNoBlockDecrease) {
|
||||
EXPECT_EQ(OldStreamBlocks, NewStreamBlocks);
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, TestShrinkStreamWithBlockDecrease) {
|
||||
TEST_F(MsfBuilderTest, TestShrinkStreamWithBlockDecrease) {
|
||||
// Test that shrinking an existing stream to a value large enough that it
|
||||
// causes the need to deallocate new Blocks to the stream correctly updates
|
||||
// the stream's block list.
|
||||
auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
|
||||
auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
|
||||
@ -235,10 +235,10 @@ TEST_F(MSFBuilderTest, TestShrinkStreamWithBlockDecrease) {
|
||||
EXPECT_EQ(OldStreamBlocks[0], NewStreamBlocks[0]);
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, TestRejectReusedStreamBlock) {
|
||||
TEST_F(MsfBuilderTest, TestRejectReusedStreamBlock) {
|
||||
// Test that attempting to add a stream and assigning a block that is already
|
||||
// in use by another stream fails.
|
||||
auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
|
||||
auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
|
||||
@ -248,10 +248,10 @@ TEST_F(MSFBuilderTest, TestRejectReusedStreamBlock) {
|
||||
EXPECT_ERROR(Msf.addStream(6144, Blocks));
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, TestBlockCountsWhenAddingStreams) {
|
||||
TEST_F(MsfBuilderTest, TestBlockCountsWhenAddingStreams) {
|
||||
// Test that when adding multiple streams, the number of used and free Blocks
|
||||
// allocated to the MSF file are as expected.
|
||||
auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
|
||||
auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
|
||||
@ -269,10 +269,10 @@ TEST_F(MSFBuilderTest, TestBlockCountsWhenAddingStreams) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, BuildMsfLayout) {
|
||||
// Test that we can generate an MSFLayout structure from a valid layout
|
||||
TEST_F(MsfBuilderTest, BuildMsfLayout) {
|
||||
// Test that we can generate an Msf MsfLayout structure from a valid layout
|
||||
// specification.
|
||||
auto ExpectedMsf = MSFBuilder::create(Allocator, 4096);
|
||||
auto ExpectedMsf = MsfBuilder::create(Allocator, 4096);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
|
||||
@ -286,7 +286,7 @@ TEST_F(MSFBuilderTest, BuildMsfLayout) {
|
||||
|
||||
auto ExpectedLayout = Msf.build();
|
||||
EXPECT_EXPECTED(ExpectedLayout);
|
||||
MSFLayout &L = *ExpectedLayout;
|
||||
MsfLayout &L = *ExpectedLayout;
|
||||
EXPECT_EQ(4096U, L.SB->BlockSize);
|
||||
EXPECT_EQ(ExpectedNumBlocks, L.SB->NumBlocks);
|
||||
|
||||
@ -301,8 +301,8 @@ TEST_F(MSFBuilderTest, BuildMsfLayout) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, UseDirectoryBlockHint) {
|
||||
Expected<MSFBuilder> ExpectedMsf = MSFBuilder::create(
|
||||
TEST_F(MsfBuilderTest, UseDirectoryBlockHint) {
|
||||
Expected<MsfBuilder> ExpectedMsf = MsfBuilder::create(
|
||||
Allocator, 4096, msf::getMinimumBlockCount() + 1, false);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
@ -313,7 +313,7 @@ TEST_F(MSFBuilderTest, UseDirectoryBlockHint) {
|
||||
|
||||
auto ExpectedLayout = Msf.build();
|
||||
EXPECT_EXPECTED(ExpectedLayout);
|
||||
MSFLayout &L = *ExpectedLayout;
|
||||
MsfLayout &L = *ExpectedLayout;
|
||||
EXPECT_EQ(msf::getMinimumBlockCount() + 2, L.SB->NumBlocks);
|
||||
EXPECT_EQ(1U, L.DirectoryBlocks.size());
|
||||
EXPECT_EQ(1U, L.StreamMap[0].size());
|
||||
@ -322,9 +322,9 @@ TEST_F(MSFBuilderTest, UseDirectoryBlockHint) {
|
||||
EXPECT_EQ(B + 2, L.StreamMap[0].front());
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, DirectoryBlockHintInsufficient) {
|
||||
Expected<MSFBuilder> ExpectedMsf =
|
||||
MSFBuilder::create(Allocator, 4096, msf::getMinimumBlockCount() + 2);
|
||||
TEST_F(MsfBuilderTest, DirectoryBlockHintInsufficient) {
|
||||
Expected<MsfBuilder> ExpectedMsf =
|
||||
MsfBuilder::create(Allocator, 4096, msf::getMinimumBlockCount() + 2);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
uint32_t B = msf::getFirstUnreservedBlock();
|
||||
@ -335,14 +335,14 @@ TEST_F(MSFBuilderTest, DirectoryBlockHintInsufficient) {
|
||||
|
||||
auto ExpectedLayout = Msf.build();
|
||||
EXPECT_EXPECTED(ExpectedLayout);
|
||||
MSFLayout &L = *ExpectedLayout;
|
||||
MsfLayout &L = *ExpectedLayout;
|
||||
EXPECT_EQ(2U, L.DirectoryBlocks.size());
|
||||
EXPECT_EQ(B + 1, L.DirectoryBlocks[0]);
|
||||
}
|
||||
|
||||
TEST_F(MSFBuilderTest, DirectoryBlockHintOverestimated) {
|
||||
Expected<MSFBuilder> ExpectedMsf =
|
||||
MSFBuilder::create(Allocator, 4096, msf::getMinimumBlockCount() + 2);
|
||||
TEST_F(MsfBuilderTest, DirectoryBlockHintOverestimated) {
|
||||
Expected<MsfBuilder> ExpectedMsf =
|
||||
MsfBuilder::create(Allocator, 4096, msf::getMinimumBlockCount() + 2);
|
||||
EXPECT_EXPECTED(ExpectedMsf);
|
||||
auto &Msf = *ExpectedMsf;
|
||||
|
||||
@ -353,7 +353,7 @@ TEST_F(MSFBuilderTest, DirectoryBlockHintOverestimated) {
|
||||
|
||||
auto ExpectedLayout = Msf.build();
|
||||
EXPECT_EXPECTED(ExpectedLayout);
|
||||
MSFLayout &L = *ExpectedLayout;
|
||||
MsfLayout &L = *ExpectedLayout;
|
||||
EXPECT_EQ(1U, L.DirectoryBlocks.size());
|
||||
EXPECT_EQ(B + 1, L.DirectoryBlocks[0]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user