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