forked from OSchip/llvm-project
[msf] Create LLVMDebugInfoMsf
This provides a better layering of responsibilities among different aspects of PDB writing code. Some of the MSF related code was contained in CodeView, and some was in PDB prior to this. Further, we were often saying PDB when we meant MSF, and the two are actually independent of each other since in theory you can have other types of data besides PDB data in an MSF. So, this patch separates the MSF specific code into its own library, with no dependencies on anything else, and DebugInfoCodeView and DebugInfoPDB take dependencies on DebugInfoMsf. llvm-svn: 276458
This commit is contained in:
parent
b8f95b5c6e
commit
bac69d33d0
|
@ -12,9 +12,10 @@
|
|||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
namespace llvm {
|
||||
|
@ -26,10 +27,14 @@ template <typename Kind> struct CVRecord {
|
|||
ArrayRef<uint8_t> Data;
|
||||
ArrayRef<uint8_t> RawData;
|
||||
};
|
||||
}
|
||||
namespace msf {
|
||||
|
||||
template <typename Kind> struct VarStreamArrayExtractor<CVRecord<Kind>> {
|
||||
template <typename Kind>
|
||||
struct VarStreamArrayExtractor<codeview::CVRecord<Kind>> {
|
||||
Error operator()(StreamRef Stream, uint32_t &Len,
|
||||
CVRecord<Kind> &Item) const {
|
||||
codeview::CVRecord<Kind> &Item) const {
|
||||
using namespace codeview;
|
||||
const RecordPrefix *Prefix = nullptr;
|
||||
StreamReader Reader(Stream);
|
||||
uint32_t Offset = Reader.getOffset();
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
//===- CodeViewOStream.h ----------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_CODEVIEWOSTREAM_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_CODEVIEWOSTREAM_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
|
||||
template <typename Writer> class CodeViewOStream {
|
||||
private:
|
||||
CodeViewOStream(const CodeViewOStream &) = delete;
|
||||
CodeViewOStream &operator=(const CodeViewOStream &) = delete;
|
||||
|
||||
public:
|
||||
typedef typename Writer::LabelType LabelType;
|
||||
|
||||
public:
|
||||
explicit CodeViewOStream(Writer &W);
|
||||
|
||||
private:
|
||||
uint64_t size() const { return W.tell(); }
|
||||
|
||||
private:
|
||||
Writer &W;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -11,8 +11,8 @@
|
|||
#define LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAM_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
|
@ -59,29 +59,31 @@ struct ColumnNumberEntry {
|
|||
class ModuleSubstream {
|
||||
public:
|
||||
ModuleSubstream();
|
||||
ModuleSubstream(ModuleSubstreamKind Kind, StreamRef Data);
|
||||
static Error initialize(StreamRef Stream, ModuleSubstream &Info);
|
||||
ModuleSubstream(ModuleSubstreamKind Kind, msf::StreamRef Data);
|
||||
static Error initialize(msf::StreamRef Stream, ModuleSubstream &Info);
|
||||
uint32_t getRecordLength() const;
|
||||
ModuleSubstreamKind getSubstreamKind() const;
|
||||
StreamRef getRecordData() const;
|
||||
msf::StreamRef getRecordData() const;
|
||||
|
||||
private:
|
||||
ModuleSubstreamKind Kind;
|
||||
StreamRef Data;
|
||||
msf::StreamRef Data;
|
||||
};
|
||||
|
||||
template <> struct VarStreamArrayExtractor<ModuleSubstream> {
|
||||
typedef msf::VarStreamArray<ModuleSubstream> ModuleSubstreamArray;
|
||||
} // namespace codeview
|
||||
|
||||
namespace msf {
|
||||
template <> struct VarStreamArrayExtractor<codeview::ModuleSubstream> {
|
||||
Error operator()(StreamRef Stream, uint32_t &Length,
|
||||
ModuleSubstream &Info) const {
|
||||
if (auto EC = ModuleSubstream::initialize(Stream, Info))
|
||||
codeview::ModuleSubstream &Info) const {
|
||||
if (auto EC = codeview::ModuleSubstream::initialize(Stream, Info))
|
||||
return EC;
|
||||
Length = Info.getRecordLength();
|
||||
return Error::success();
|
||||
}
|
||||
};
|
||||
|
||||
typedef VarStreamArray<ModuleSubstream> ModuleSubstreamArray;
|
||||
}
|
||||
}
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAM_H
|
||||
|
|
|
@ -14,24 +14,62 @@
|
|||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
#include "llvm/DebugInfo/CodeView/Line.h"
|
||||
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
|
||||
struct LineColumnEntry {
|
||||
support::ulittle32_t NameIndex;
|
||||
FixedStreamArray<LineNumberEntry> LineNumbers;
|
||||
FixedStreamArray<ColumnNumberEntry> Columns;
|
||||
msf::FixedStreamArray<LineNumberEntry> LineNumbers;
|
||||
msf::FixedStreamArray<ColumnNumberEntry> Columns;
|
||||
};
|
||||
|
||||
template <> class VarStreamArrayExtractor<LineColumnEntry> {
|
||||
struct FileChecksumEntry {
|
||||
uint32_t FileNameOffset; // Byte offset of filename in global stringtable.
|
||||
FileChecksumKind Kind; // The type of checksum.
|
||||
ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
|
||||
};
|
||||
|
||||
typedef msf::VarStreamArray<LineColumnEntry> LineInfoArray;
|
||||
typedef msf::VarStreamArray<FileChecksumEntry> FileChecksumArray;
|
||||
|
||||
class IModuleSubstreamVisitor {
|
||||
public:
|
||||
VarStreamArrayExtractor(const LineSubstreamHeader *Header) : Header(Header) {}
|
||||
virtual ~IModuleSubstreamVisitor() {}
|
||||
|
||||
virtual Error visitUnknown(ModuleSubstreamKind Kind, msf::StreamRef Data) = 0;
|
||||
virtual Error visitSymbols(msf::StreamRef Data);
|
||||
virtual Error visitLines(msf::StreamRef Data,
|
||||
const LineSubstreamHeader *Header,
|
||||
const LineInfoArray &Lines);
|
||||
virtual Error visitStringTable(msf::StreamRef Data);
|
||||
virtual Error visitFileChecksums(msf::StreamRef Data,
|
||||
const FileChecksumArray &Checksums);
|
||||
virtual Error visitFrameData(msf::StreamRef Data);
|
||||
virtual Error visitInlineeLines(msf::StreamRef Data);
|
||||
virtual Error visitCrossScopeImports(msf::StreamRef Data);
|
||||
virtual Error visitCrossScopeExports(msf::StreamRef Data);
|
||||
virtual Error visitILLines(msf::StreamRef Data);
|
||||
virtual Error visitFuncMDTokenMap(msf::StreamRef Data);
|
||||
virtual Error visitTypeMDTokenMap(msf::StreamRef Data);
|
||||
virtual Error visitMergedAssemblyInput(msf::StreamRef Data);
|
||||
virtual Error visitCoffSymbolRVA(msf::StreamRef Data);
|
||||
};
|
||||
|
||||
Error visitModuleSubstream(const ModuleSubstream &R,
|
||||
IModuleSubstreamVisitor &V);
|
||||
} // namespace codeview
|
||||
|
||||
namespace msf {
|
||||
template <> class VarStreamArrayExtractor<codeview::LineColumnEntry> {
|
||||
public:
|
||||
VarStreamArrayExtractor(const codeview::LineSubstreamHeader *Header)
|
||||
: Header(Header) {}
|
||||
|
||||
Error operator()(StreamRef Stream, uint32_t &Len,
|
||||
LineColumnEntry &Item) const {
|
||||
codeview::LineColumnEntry &Item) const {
|
||||
using namespace codeview;
|
||||
const LineFileBlockHeader *BlockHeader;
|
||||
StreamReader Reader(Stream);
|
||||
if (auto EC = Reader.readObject(BlockHeader))
|
||||
|
@ -61,19 +99,14 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
const LineSubstreamHeader *Header;
|
||||
const codeview::LineSubstreamHeader *Header;
|
||||
};
|
||||
|
||||
struct FileChecksumEntry {
|
||||
uint32_t FileNameOffset; // Byte offset of filename in global stringtable.
|
||||
FileChecksumKind Kind; // The type of checksum.
|
||||
ArrayRef<uint8_t> Checksum; // The bytes of the checksum.
|
||||
};
|
||||
|
||||
template <> class VarStreamArrayExtractor<FileChecksumEntry> {
|
||||
template <> class VarStreamArrayExtractor<codeview::FileChecksumEntry> {
|
||||
public:
|
||||
Error operator()(StreamRef Stream, uint32_t &Len,
|
||||
FileChecksumEntry &Item) const {
|
||||
codeview::FileChecksumEntry &Item) const {
|
||||
using namespace codeview;
|
||||
const FileChecksum *Header;
|
||||
StreamReader Reader(Stream);
|
||||
if (auto EC = Reader.readObject(Header))
|
||||
|
@ -87,35 +120,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
typedef VarStreamArray<LineColumnEntry> LineInfoArray;
|
||||
typedef VarStreamArray<FileChecksumEntry> FileChecksumArray;
|
||||
|
||||
class IModuleSubstreamVisitor {
|
||||
public:
|
||||
virtual ~IModuleSubstreamVisitor() {}
|
||||
|
||||
virtual Error visitUnknown(ModuleSubstreamKind Kind, StreamRef Data) = 0;
|
||||
virtual Error visitSymbols(StreamRef Data);
|
||||
virtual Error visitLines(StreamRef Data, const LineSubstreamHeader *Header,
|
||||
const LineInfoArray &Lines);
|
||||
virtual Error visitStringTable(StreamRef Data);
|
||||
virtual Error visitFileChecksums(StreamRef Data,
|
||||
const FileChecksumArray &Checksums);
|
||||
virtual Error visitFrameData(StreamRef Data);
|
||||
virtual Error visitInlineeLines(StreamRef Data);
|
||||
virtual Error visitCrossScopeImports(StreamRef Data);
|
||||
virtual Error visitCrossScopeExports(StreamRef Data);
|
||||
virtual Error visitILLines(StreamRef Data);
|
||||
virtual Error visitFuncMDTokenMap(StreamRef Data);
|
||||
virtual Error visitTypeMDTokenMap(StreamRef Data);
|
||||
virtual Error visitMergedAssemblyInput(StreamRef Data);
|
||||
virtual Error visitCoffSymbolRVA(StreamRef Data);
|
||||
};
|
||||
|
||||
Error visitModuleSubstream(const ModuleSubstream &R,
|
||||
IModuleSubstreamVisitor &V);
|
||||
|
||||
} // namespace codeview
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAMVISITOR_H
|
||||
|
|
|
@ -15,18 +15,17 @@
|
|||
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
|
||||
using llvm::support::ulittle16_t;
|
||||
using llvm::support::ulittle32_t;
|
||||
using llvm::support::little32_t;
|
||||
using support::ulittle16_t;
|
||||
using support::ulittle32_t;
|
||||
using support::little32_t;
|
||||
|
||||
class SymbolRecord {
|
||||
protected:
|
||||
|
@ -1444,7 +1443,7 @@ public:
|
|||
};
|
||||
|
||||
typedef CVRecord<SymbolKind> CVSymbol;
|
||||
typedef VarStreamArray<CVSymbol> CVSymbolArray;
|
||||
typedef msf::VarStreamArray<CVSymbol> CVSymbolArray;
|
||||
|
||||
} // namespace codeview
|
||||
} // namespace llvm
|
||||
|
|
|
@ -1195,7 +1195,7 @@ private:
|
|||
};
|
||||
|
||||
typedef CVRecord<TypeLeafKind> CVType;
|
||||
typedef VarStreamArray<CVType> CVTypeArray;
|
||||
typedef msf::VarStreamArray<CVType> CVTypeArray;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,19 +7,19 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_BYTESTREAM_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_BYTESTREAM_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_BYTESTREAM_H
|
||||
#define LLVM_DEBUGINFO_MSF_BYTESTREAM_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
class StreamReader;
|
||||
|
||||
template <bool Writable = false> class ByteStream : public StreamInterface {
|
||||
|
@ -52,7 +52,7 @@ private:
|
|||
extern template class ByteStream<true>;
|
||||
extern template class ByteStream<false>;
|
||||
|
||||
} // end namespace pdb
|
||||
} // end namespace msf
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_BYTESTREAM_H
|
||||
#endif // LLVM_DEBUGINFO_MSF_BYTESTREAM_H
|
|
@ -7,29 +7,31 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_DIRECTORYSTREAMDATA_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_DIRECTORYSTREAMDATA_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_DIRECTORYSTREAMDATA_H
|
||||
#define LLVM_DEBUGINFO_MSF_DIRECTORYSTREAMDATA_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IPDBStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfFile.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfStreamData.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
class IPDBFile;
|
||||
namespace msf {
|
||||
class IMsfFile;
|
||||
|
||||
class DirectoryStreamData : public IPDBStreamData {
|
||||
class DirectoryStreamData : public IMsfStreamData {
|
||||
public:
|
||||
DirectoryStreamData(const PDBFile &File) : File(File) {}
|
||||
DirectoryStreamData(uint32_t Length, ArrayRef<support::ulittle32_t> Blocks)
|
||||
: Length(Length), Blocks(Blocks) {}
|
||||
|
||||
virtual uint32_t getLength() { return File.getNumDirectoryBytes(); }
|
||||
virtual uint32_t getLength() { return Length; }
|
||||
virtual llvm::ArrayRef<llvm::support::ulittle32_t> getStreamBlocks() {
|
||||
return File.getDirectoryBlockArray();
|
||||
return Blocks;
|
||||
}
|
||||
|
||||
private:
|
||||
const PDBFile &File;
|
||||
uint32_t Length;
|
||||
ArrayRef<support::ulittle32_t> Blocks;
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
//===- IPDBFile.h - Abstract base class for a PDB file ----------*- C++ -*-===//
|
||||
//===- IMsfFile.h - Abstract base class for an MSF file ---------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,23 +7,23 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_IPDBFILE_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_IPDBFILE_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_IMSFFILE_H
|
||||
#define LLVM_DEBUGINFO_MSF_IMSFFILE_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
namespace msf {
|
||||
|
||||
class IPDBFile {
|
||||
class IMsfFile {
|
||||
public:
|
||||
virtual ~IPDBFile() {}
|
||||
virtual ~IMsfFile() {}
|
||||
|
||||
virtual uint32_t getBlockSize() const = 0;
|
||||
virtual uint32_t getBlockCount() const = 0;
|
||||
|
@ -41,4 +41,4 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_RAW_IPDBFILE_H
|
||||
#endif // LLVM_DEBUGINFO_MSF_IMSFFILE_H
|
|
@ -1,4 +1,4 @@
|
|||
//===- IPDBStreamData.h - Base interface for PDB Stream Data ----*- C++ -*-===//
|
||||
//===- IMsfStreamData.h - Base interface for Msf Stream Data ----*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,15 +7,17 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_IPDBSTREAMDATA_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_IPDBSTREAMDATA_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_IMSFSTREAMDATA_H
|
||||
#define LLVM_DEBUGINFO_MSF_IMSFSTREAMDATA_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
/// IPDBStream abstracts the notion of PDB stream data. Although we already
|
||||
namespace msf {
|
||||
/// IMsfStream abstracts the notion of PDB stream data. Although we already
|
||||
/// have another stream abstraction (namely in the form of StreamInterface
|
||||
/// and MappedBlockStream), they assume that the stream data is referenced
|
||||
/// the same way. Namely, by looking in the directory to get the list of
|
||||
|
@ -25,14 +27,14 @@ namespace pdb {
|
|||
/// notion of stream data further, we can use a MappedBlockStream to read
|
||||
/// from the directory itself, or from an indexed stream which references
|
||||
/// the directory.
|
||||
class IPDBStreamData {
|
||||
class IMsfStreamData {
|
||||
public:
|
||||
virtual ~IPDBStreamData() {}
|
||||
virtual ~IMsfStreamData() {}
|
||||
|
||||
virtual uint32_t getLength() = 0;
|
||||
virtual ArrayRef<support::ulittle32_t> getStreamBlocks() = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_DEBUGINFO_MSF_IMSFSTREAMDATA_H
|
|
@ -1,4 +1,4 @@
|
|||
//===- IndexedStreamData.h - Standard PDB Stream Data -----------*- C++ -*-===//
|
||||
//===- IndexedStreamData.h - Standard Msf Stream Data -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,18 +7,18 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_INDEXEDSTREAMDATA_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_INDEXEDSTREAMDATA_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_INDEXEDSTREAMDATA_H
|
||||
#define LLVM_DEBUGINFO_MSF_INDEXEDSTREAMDATA_H
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/IPDBStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfStreamData.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
class IPDBFile;
|
||||
namespace msf {
|
||||
class IMsfFile;
|
||||
|
||||
class IndexedStreamData : public IPDBStreamData {
|
||||
class IndexedStreamData : public IMsfStreamData {
|
||||
public:
|
||||
IndexedStreamData(uint32_t StreamIdx, const IPDBFile &File);
|
||||
IndexedStreamData(uint32_t StreamIdx, const IMsfFile &File);
|
||||
virtual ~IndexedStreamData() {}
|
||||
|
||||
uint32_t getLength() override;
|
||||
|
@ -26,9 +26,9 @@ public:
|
|||
|
||||
private:
|
||||
uint32_t StreamIdx;
|
||||
const IPDBFile &File;
|
||||
const IMsfFile &File;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_DEBUGINFO_MSF_INDEXEDSTREAMDATA_H
|
|
@ -1,4 +1,5 @@
|
|||
//===- MappedBlockStream.h - Reads stream data from a PDBFile ---*- C++ -*-===//
|
||||
//===- MappedBlockStream.h - Discontiguous stream data in an Msf -*- C++
|
||||
//-*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,14 +8,14 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_MAPPEDBLOCKSTREAM_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_MAPPEDBLOCKSTREAM_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_MAPPEDBLOCKSTREAM_H
|
||||
#define LLVM_DEBUGINFO_MSF_MAPPEDBLOCKSTREAM_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IPDBStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
@ -22,12 +23,21 @@
|
|||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
namespace msf {
|
||||
|
||||
class IPDBFile;
|
||||
class PDBFile;
|
||||
class IMsfFile;
|
||||
|
||||
class MappedBlockStream : public codeview::StreamInterface {
|
||||
/// MappedBlockStream represents data stored in an Msf file into chunks of a
|
||||
/// particular size (called the Block Size), and whose chunks may not be
|
||||
/// necessarily contiguous. The arrangement of these chunks within the file
|
||||
/// is described by some other metadata contained within the Msf file. In
|
||||
/// the case of a standard Msf Stream, the layout of the stream's blocks
|
||||
/// is described by the Msf "directory", but in the case of the directory
|
||||
/// itself, the layout is described by an array at a fixed location within
|
||||
/// the Msf. MappedBlockStream provides methods for reading from and writing
|
||||
/// to one of these streams transparently, as if it were a contiguous sequence
|
||||
/// of bytes.
|
||||
class MappedBlockStream : public StreamInterface {
|
||||
public:
|
||||
Error readBytes(uint32_t Offset, uint32_t Size,
|
||||
ArrayRef<uint8_t> &Buffer) const override;
|
||||
|
@ -41,21 +51,22 @@ public:
|
|||
uint32_t getNumBytesCopied() const;
|
||||
|
||||
static Expected<std::unique_ptr<MappedBlockStream>>
|
||||
createIndexedStream(uint32_t StreamIdx, const IPDBFile &File);
|
||||
createIndexedStream(uint32_t StreamIdx, const IMsfFile &File);
|
||||
static Expected<std::unique_ptr<MappedBlockStream>>
|
||||
createDirectoryStream(const PDBFile &File);
|
||||
createDirectoryStream(uint32_t Length, ArrayRef<support::ulittle32_t> Blocks,
|
||||
const IMsfFile &File);
|
||||
|
||||
llvm::BumpPtrAllocator &getAllocator() { return Pool; }
|
||||
|
||||
protected:
|
||||
MappedBlockStream(std::unique_ptr<IPDBStreamData> Data, const IPDBFile &File);
|
||||
MappedBlockStream(std::unique_ptr<IMsfStreamData> Data, const IMsfFile &File);
|
||||
|
||||
Error readBytes(uint32_t Offset, MutableArrayRef<uint8_t> Buffer) const;
|
||||
bool tryReadContiguously(uint32_t Offset, uint32_t Size,
|
||||
ArrayRef<uint8_t> &Buffer) const;
|
||||
|
||||
const IPDBFile &Pdb;
|
||||
std::unique_ptr<IPDBStreamData> Data;
|
||||
const IMsfFile &Msf;
|
||||
std::unique_ptr<IMsfStreamData> Data;
|
||||
|
||||
typedef MutableArrayRef<uint8_t> CacheEntry;
|
||||
mutable llvm::BumpPtrAllocator Pool;
|
||||
|
@ -65,4 +76,4 @@ protected:
|
|||
} // end namespace pdb
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_PDB_RAW_MAPPEDBLOCKSTREAM_H
|
||||
#endif // LLVM_DEBUGINFO_MSF_MAPPEDBLOCKSTREAM_H
|
|
@ -7,14 +7,13 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_MSFBUILDER_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_MSFBUILDER_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_MSFBUILDER_H
|
||||
#define LLVM_DEBUGINFO_MSF_MSFBUILDER_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfCommon.h"
|
||||
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
@ -24,7 +23,7 @@
|
|||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
namespace msf {
|
||||
class MsfBuilder {
|
||||
public:
|
||||
/// \brief Create a new `MsfBuilder`.
|
||||
|
@ -34,9 +33,9 @@ public:
|
|||
///
|
||||
/// \param MinBlockCount Causes the builder to reserve up front space for
|
||||
/// at least `MinBlockCount` blocks. This is useful when using `MsfBuilder`
|
||||
/// to read an existing PDB that you want to write back out later. The
|
||||
/// original PDB 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 PDB file
|
||||
/// to read an existing MSF that you want to write back out later. The
|
||||
/// original MSF file's SuperBlock contains the exact number of blocks used
|
||||
/// by the file, so is a good hint as to how many blocks the new MSF file
|
||||
/// will contain. Furthermore, it is actually necessary in this case. To
|
||||
/// preserve stability of the file's layout, it is helpful to try to keep
|
||||
/// all streams mapped to their original block numbers. To ensure that this
|
||||
|
@ -45,7 +44,7 @@ public:
|
|||
///
|
||||
/// \param CanGrow If true, any operation which results in an attempt to
|
||||
/// locate a free block when all available blocks have been exhausted will
|
||||
/// allocate a new block, thereby growing the size of the final PDB file.
|
||||
/// allocate a new block, thereby growing the size of the final MSF file.
|
||||
/// When false, any such attempt will result in an error. This is especially
|
||||
/// useful in testing scenarios when you know your test isn't going to do
|
||||
/// anything to increase the size of the file, so having an Error returned if
|
||||
|
@ -61,14 +60,14 @@ public:
|
|||
bool CanGrow = true);
|
||||
|
||||
/// Request the block map to be at a specific block address. This is useful
|
||||
/// when editing a PDB and you want the layout to be as stable as possible.
|
||||
/// when editing a MSF and you want the layout to be as stable as possible.
|
||||
Error setBlockMapAddr(uint32_t Addr);
|
||||
Error setDirectoryBlocksHint(ArrayRef<uint32_t> DirBlocks);
|
||||
void setFreePageMap(uint32_t Fpm);
|
||||
void setUnknown1(uint32_t Unk1);
|
||||
|
||||
/// Add a stream to the MSF file with the given size, occupying the given
|
||||
/// list of blocks. This is useful when reading a PDB file and you want a
|
||||
/// list of blocks. This is useful when reading a MSF file and you want a
|
||||
/// particular stream to occupy the original set of blocks. If the given
|
||||
/// blocks are already allocated, or if the number of blocks specified is
|
||||
/// incorrect for the given stream size, this function will return an Error.
|
||||
|
@ -112,7 +111,7 @@ public:
|
|||
|
||||
/// Finalize the layout and build the headers and structures that describe the
|
||||
/// MSF layout and can be written directly to the MSF file.
|
||||
Expected<msf::Layout> build();
|
||||
Expected<Layout> build();
|
||||
|
||||
private:
|
||||
MsfBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
|
||||
|
@ -135,7 +134,7 @@ private:
|
|||
std::vector<uint32_t> DirectoryBlocks;
|
||||
std::vector<std::pair<uint32_t, BlockList>> StreamData;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_DEBUGINFO_MSF_MSFBUILDER_H
|
|
@ -7,8 +7,8 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_PDB_RAW_MSFCOMMON_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_MSFCOMMON_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_MSFCOMMON_H
|
||||
#define LLVM_DEBUGINFO_MSF_MSFCOMMON_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
|||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace pdb {
|
||||
namespace msf {
|
||||
static const char Magic[] = {'M', 'i', 'c', 'r', 'o', 's', 'o', 'f',
|
||||
't', ' ', 'C', '/', 'C', '+', '+', ' ',
|
||||
|
@ -38,7 +37,7 @@ struct SuperBlock {
|
|||
// The index of the free block map.
|
||||
support::ulittle32_t FreeBlockMapBlock;
|
||||
// This contains the number of blocks resident in the file system. In
|
||||
// practice, NumBlocks * BlockSize is equivalent to the size of the PDB
|
||||
// practice, NumBlocks * BlockSize is equivalent to the size of the MSF
|
||||
// file.
|
||||
support::ulittle32_t NumBlocks;
|
||||
// This contains the number of bytes which make up the directory.
|
||||
|
@ -83,8 +82,7 @@ inline uint64_t blockToOffset(uint64_t BlockNumber, uint64_t BlockSize) {
|
|||
}
|
||||
|
||||
Error validateSuperBlock(const SuperBlock &SB);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
#endif
|
||||
#endif // LLVM_DEBUGINFO_MSF_MSFCOMMON_H
|
|
@ -0,0 +1,47 @@
|
|||
//===- MsfError.h - Error extensions for Msf Files --------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_MSF_MSFERROR_H
|
||||
#define LLVM_DEBUGINFO_MSF_MSFERROR_H
|
||||
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
namespace msf {
|
||||
enum class msf_error_code {
|
||||
unspecified = 1,
|
||||
insufficient_buffer,
|
||||
not_writable,
|
||||
no_stream,
|
||||
invalid_format,
|
||||
block_in_use
|
||||
};
|
||||
|
||||
/// Base class for errors originating when parsing raw PDB files
|
||||
class MsfError : public ErrorInfo<MsfError> {
|
||||
public:
|
||||
static char ID;
|
||||
MsfError(msf_error_code C);
|
||||
MsfError(const std::string &Context);
|
||||
MsfError(msf_error_code C, const std::string &Context);
|
||||
|
||||
void log(raw_ostream &OS) const override;
|
||||
const std::string &getErrorMessage() const;
|
||||
std::error_code convertToErrorCode() const override;
|
||||
|
||||
private:
|
||||
std::string ErrMsg;
|
||||
msf_error_code Code;
|
||||
};
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_MSF_MSFERROR_H
|
|
@ -7,17 +7,17 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_STREAMARRAY_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_STREAMARRAY_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_STREAMARRAY_H
|
||||
#define LLVM_DEBUGINFO_MSF_STREAMARRAY_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
|
||||
/// VarStreamArrayExtractor is intended to be specialized to provide customized
|
||||
/// extraction logic. On input it receives a StreamRef pointing to the
|
||||
|
@ -269,7 +269,7 @@ private:
|
|||
uint32_t Index;
|
||||
};
|
||||
|
||||
} // namespace codeview
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_STREAMARRAY_H
|
||||
#endif // LLVM_DEBUGINFO_MSF_STREAMARRAY_H
|
|
@ -7,15 +7,15 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_STREAMINTERFACE_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_STREAMINTERFACE_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_STREAMINTERFACE_H
|
||||
#define LLVM_DEBUGINFO_MSF_STREAMINTERFACE_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
|
||||
/// StreamInterface abstracts the notion of a data stream. This way, an
|
||||
/// implementation could implement trivial reading from a contiguous memory
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
virtual Error commit() const = 0;
|
||||
};
|
||||
|
||||
} // end namespace codeview
|
||||
} // end namespace msf
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_STREAMINTERFACE_H
|
||||
#endif // LLVM_DEBUGINFO_MSF_STREAMINTERFACE_H
|
|
@ -7,20 +7,20 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_STREAMREADER_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_STREAMREADER_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_STREAMREADER_H
|
||||
#define LLVM_DEBUGINFO_MSF_STREAMREADER_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
|
||||
class StreamRef;
|
||||
|
||||
|
@ -61,8 +61,8 @@ public:
|
|||
return Error::success();
|
||||
}
|
||||
|
||||
if (NumElements > UINT32_MAX/sizeof(T))
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
if (NumElements > UINT32_MAX / sizeof(T))
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
if (auto EC = readBytes(Bytes, NumElements * sizeof(T)))
|
||||
return EC;
|
||||
|
@ -87,9 +87,9 @@ public:
|
|||
}
|
||||
uint32_t Length = NumItems * sizeof(T);
|
||||
if (Length / sizeof(T) != NumItems)
|
||||
return make_error<CodeViewError>(cv_error_code::corrupt_record);
|
||||
return make_error<MsfError>(msf_error_code::invalid_format);
|
||||
if (Offset + Length > Stream.getLength())
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
StreamRef View = Stream.slice(Offset, Length);
|
||||
Array = FixedStreamArray<T>(View);
|
||||
Offset += Length;
|
||||
|
@ -105,7 +105,7 @@ private:
|
|||
StreamRef Stream;
|
||||
uint32_t Offset;
|
||||
};
|
||||
} // namespace codeview
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_STREAMREADER_H
|
||||
#endif // LLVM_DEBUGINFO_MSF_STREAMREADER_H
|
|
@ -7,14 +7,14 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_STREAMREF_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_STREAMREF_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_STREAMREF_H
|
||||
#define LLVM_DEBUGINFO_MSF_STREAMREF_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
|
||||
class StreamRef {
|
||||
public:
|
||||
|
@ -30,9 +30,9 @@ public:
|
|||
Error readBytes(uint32_t Offset, uint32_t Size,
|
||||
ArrayRef<uint8_t> &Buffer) const {
|
||||
if (ViewOffset + Offset < Offset)
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
if (Size + Offset > Length)
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
return Stream->readBytes(ViewOffset + Offset, Size, Buffer);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
Error readLongestContiguousChunk(uint32_t Offset,
|
||||
ArrayRef<uint8_t> &Buffer) const {
|
||||
if (Offset >= Length)
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
if (auto EC = Stream->readLongestContiguousChunk(Offset, Buffer))
|
||||
return EC;
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
|
||||
Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Data) const {
|
||||
if (Data.size() + Offset > Length)
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
return Stream->writeBytes(ViewOffset + Offset, Data);
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ private:
|
|||
uint32_t ViewOffset;
|
||||
uint32_t Length;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_STREAMREF_H
|
||||
#endif // LLVM_DEBUGINFO_MSF_STREAMREF_H
|
|
@ -7,20 +7,20 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_DEBUGINFO_CODEVIEW_STREAMWRITER_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_STREAMWRITER_H
|
||||
#ifndef LLVM_DEBUGINFO_MSF_STREAMWRITER_H
|
||||
#define LLVM_DEBUGINFO_MSF_STREAMWRITER_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
|
||||
class StreamRef;
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
return Error::success();
|
||||
|
||||
if (Array.size() > UINT32_MAX / sizeof(T))
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
return writeBytes(
|
||||
ArrayRef<uint8_t>(reinterpret_cast<const uint8_t *>(Array.data()),
|
||||
|
@ -80,7 +80,7 @@ private:
|
|||
StreamRef Stream;
|
||||
uint32_t Offset;
|
||||
};
|
||||
} // namespace codeview
|
||||
} // namespace msf
|
||||
} // namespace llvm
|
||||
|
||||
#endif // LLVM_DEBUGINFO_CODEVIEW_STREAMREADER_H
|
||||
#endif // LLVM_DEBUGINFO_MSF_STREAMWRITER_H
|
|
@ -11,10 +11,10 @@
|
|||
#define LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
|
@ -37,7 +37,7 @@ class DbiStream {
|
|||
friend class DbiStreamBuilder;
|
||||
|
||||
public:
|
||||
DbiStream(PDBFile &File, std::unique_ptr<MappedBlockStream> Stream);
|
||||
DbiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
|
||||
~DbiStream();
|
||||
Error reload();
|
||||
|
||||
|
@ -70,11 +70,11 @@ public:
|
|||
|
||||
Expected<StringRef> getFileNameForIndex(uint32_t Index) const;
|
||||
|
||||
codeview::FixedStreamArray<object::coff_section> getSectionHeaders();
|
||||
msf::FixedStreamArray<object::coff_section> getSectionHeaders();
|
||||
|
||||
codeview::FixedStreamArray<object::FpoData> getFpoRecords();
|
||||
msf::FixedStreamArray<object::FpoData> getFpoRecords();
|
||||
|
||||
codeview::FixedStreamArray<SecMapEntry> getSectionMap() const;
|
||||
msf::FixedStreamArray<SecMapEntry> getSectionMap() const;
|
||||
void visitSectionContributions(ISectionContribVisitor &Visitor) const;
|
||||
|
||||
Error commit();
|
||||
|
@ -88,33 +88,33 @@ private:
|
|||
Error initializeFpoRecords();
|
||||
|
||||
PDBFile &Pdb;
|
||||
std::unique_ptr<MappedBlockStream> Stream;
|
||||
std::unique_ptr<msf::MappedBlockStream> Stream;
|
||||
|
||||
std::vector<ModuleInfoEx> ModuleInfos;
|
||||
NameHashTable ECNames;
|
||||
|
||||
codeview::StreamRef ModInfoSubstream;
|
||||
codeview::StreamRef SecContrSubstream;
|
||||
codeview::StreamRef SecMapSubstream;
|
||||
codeview::StreamRef FileInfoSubstream;
|
||||
codeview::StreamRef TypeServerMapSubstream;
|
||||
codeview::StreamRef ECSubstream;
|
||||
msf::StreamRef ModInfoSubstream;
|
||||
msf::StreamRef SecContrSubstream;
|
||||
msf::StreamRef SecMapSubstream;
|
||||
msf::StreamRef FileInfoSubstream;
|
||||
msf::StreamRef TypeServerMapSubstream;
|
||||
msf::StreamRef ECSubstream;
|
||||
|
||||
codeview::StreamRef NamesBuffer;
|
||||
msf::StreamRef NamesBuffer;
|
||||
|
||||
codeview::FixedStreamArray<support::ulittle16_t> DbgStreams;
|
||||
msf::FixedStreamArray<support::ulittle16_t> DbgStreams;
|
||||
|
||||
PdbRaw_DbiSecContribVer SectionContribVersion;
|
||||
codeview::FixedStreamArray<SectionContrib> SectionContribs;
|
||||
codeview::FixedStreamArray<SectionContrib2> SectionContribs2;
|
||||
codeview::FixedStreamArray<SecMapEntry> SectionMap;
|
||||
codeview::FixedStreamArray<support::little32_t> FileNameOffsets;
|
||||
msf::FixedStreamArray<SectionContrib> SectionContribs;
|
||||
msf::FixedStreamArray<SectionContrib2> SectionContribs2;
|
||||
msf::FixedStreamArray<SecMapEntry> SectionMap;
|
||||
msf::FixedStreamArray<support::little32_t> FileNameOffsets;
|
||||
|
||||
std::unique_ptr<MappedBlockStream> SectionHeaderStream;
|
||||
codeview::FixedStreamArray<object::coff_section> SectionHeaders;
|
||||
std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
|
||||
msf::FixedStreamArray<object::coff_section> SectionHeaders;
|
||||
|
||||
std::unique_ptr<MappedBlockStream> FpoStream;
|
||||
codeview::FixedStreamArray<object::FpoData> FpoRecords;
|
||||
std::unique_ptr<msf::MappedBlockStream> FpoStream;
|
||||
msf::FixedStreamArray<object::FpoData> FpoRecords;
|
||||
|
||||
const DbiStreamHeader *Header;
|
||||
};
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
#include "llvm/ADT/StringSet.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
|
@ -75,9 +76,9 @@ private:
|
|||
|
||||
StringMap<uint32_t> SourceFileNames;
|
||||
|
||||
codeview::StreamRef NamesBuffer;
|
||||
codeview::ByteStream<true> ModInfoBuffer;
|
||||
codeview::ByteStream<true> FileInfoBuffer;
|
||||
msf::StreamRef NamesBuffer;
|
||||
msf::ByteStream<true> ModInfoBuffer;
|
||||
msf::ByteStream<true> FileInfoBuffer;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#define LLVM_DEBUGINFO_PDB_RAW_PDBINFOSTREAM_H
|
||||
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameMap.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
|
||||
|
@ -35,7 +35,7 @@ class InfoStream {
|
|||
};
|
||||
|
||||
public:
|
||||
InfoStream(std::unique_ptr<MappedBlockStream> Stream);
|
||||
InfoStream(std::unique_ptr<msf::MappedBlockStream> Stream);
|
||||
|
||||
Error reload();
|
||||
Error commit();
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
iterator_range<StringMapConstIterator<uint32_t>> named_streams() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<MappedBlockStream> Stream;
|
||||
std::unique_ptr<msf::MappedBlockStream> Stream;
|
||||
|
||||
// PDB file format version. We only support VC70. See the enumeration
|
||||
// `PdbRaw_ImplVer` for the other possible values.
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#define LLVM_DEBUGINFO_PDB_RAW_MODINFO_H
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include <cstdint>
|
||||
|
@ -29,7 +29,7 @@ public:
|
|||
ModInfo(const ModInfo &Info);
|
||||
~ModInfo();
|
||||
|
||||
static Error initialize(codeview::StreamRef Stream, ModInfo &Info);
|
||||
static Error initialize(msf::StreamRef Stream, ModInfo &Info);
|
||||
|
||||
bool hasECInfo() const;
|
||||
uint16_t getTypeServerIndex() const;
|
||||
|
@ -63,7 +63,7 @@ struct ModuleInfoEx {
|
|||
|
||||
} // end namespace pdb
|
||||
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
template <> struct VarStreamArrayExtractor<pdb::ModInfo> {
|
||||
Error operator()(StreamRef Stream, uint32_t &Length,
|
||||
pdb::ModInfo &Info) const {
|
||||
|
@ -73,7 +73,7 @@ template <> struct VarStreamArrayExtractor<pdb::ModInfo> {
|
|||
return Error::success();
|
||||
}
|
||||
};
|
||||
}
|
||||
} // end namespace msf
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
namespace llvm {
|
||||
|
@ -26,7 +26,8 @@ class ModInfo;
|
|||
|
||||
class ModStream {
|
||||
public:
|
||||
ModStream(const ModInfo &Module, std::unique_ptr<MappedBlockStream> Stream);
|
||||
ModStream(const ModInfo &Module,
|
||||
std::unique_ptr<msf::MappedBlockStream> Stream);
|
||||
~ModStream();
|
||||
|
||||
Error reload();
|
||||
|
@ -42,12 +43,12 @@ public:
|
|||
private:
|
||||
const ModInfo &Mod;
|
||||
|
||||
std::unique_ptr<MappedBlockStream> Stream;
|
||||
std::unique_ptr<msf::MappedBlockStream> Stream;
|
||||
|
||||
codeview::CVSymbolArray SymbolsSubstream;
|
||||
codeview::StreamRef LinesSubstream;
|
||||
codeview::StreamRef C13LinesSubstream;
|
||||
codeview::StreamRef GlobalRefsSubstream;
|
||||
msf::StreamRef LinesSubstream;
|
||||
msf::StreamRef C13LinesSubstream;
|
||||
msf::StreamRef GlobalRefsSubstream;
|
||||
|
||||
codeview::ModuleSubstreamArray LineInfo;
|
||||
};
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
class StreamReader;
|
||||
}
|
||||
namespace pdb {
|
||||
|
@ -29,7 +29,7 @@ class NameHashTable {
|
|||
public:
|
||||
NameHashTable();
|
||||
|
||||
Error load(codeview::StreamReader &Stream);
|
||||
Error load(msf::StreamReader &Stream);
|
||||
|
||||
uint32_t getNameCount() const { return NameCount; }
|
||||
uint32_t getHashVersion() const { return HashVersion; }
|
||||
|
@ -38,11 +38,11 @@ public:
|
|||
StringRef getStringForID(uint32_t ID) const;
|
||||
uint32_t getIDForString(StringRef Str) const;
|
||||
|
||||
codeview::FixedStreamArray<support::ulittle32_t> name_ids() const;
|
||||
msf::FixedStreamArray<support::ulittle32_t> name_ids() const;
|
||||
|
||||
private:
|
||||
codeview::StreamRef NamesBuffer;
|
||||
codeview::FixedStreamArray<support::ulittle32_t> IDs;
|
||||
msf::StreamRef NamesBuffer;
|
||||
msf::FixedStreamArray<support::ulittle32_t> IDs;
|
||||
uint32_t Signature;
|
||||
uint32_t HashVersion;
|
||||
uint32_t NameCount;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <cstdint>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
class StreamReader;
|
||||
class StreamWriter;
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ class NameMap {
|
|||
public:
|
||||
NameMap();
|
||||
|
||||
Error load(codeview::StreamReader &Stream);
|
||||
Error commit(codeview::StreamWriter &Writer);
|
||||
Error load(msf::StreamReader &Stream);
|
||||
Error commit(msf::StreamWriter &Writer);
|
||||
|
||||
bool tryGetValue(StringRef Name, uint32_t &Value) const;
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
#define LLVM_DEBUGINFO_PDB_RAW_PDBFILE_H
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IPDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfFile.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
@ -24,25 +24,25 @@
|
|||
|
||||
namespace llvm {
|
||||
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
class MappedBlockStream;
|
||||
class StreamInterface;
|
||||
}
|
||||
|
||||
namespace pdb {
|
||||
class DbiStream;
|
||||
class InfoStream;
|
||||
class MappedBlockStream;
|
||||
class NameHashTable;
|
||||
class PDBFileBuilder;
|
||||
class PublicsStream;
|
||||
class SymbolStream;
|
||||
class TpiStream;
|
||||
|
||||
class PDBFile : public IPDBFile {
|
||||
class PDBFile : public msf::IMsfFile {
|
||||
friend PDBFileBuilder;
|
||||
|
||||
public:
|
||||
explicit PDBFile(std::unique_ptr<codeview::StreamInterface> PdbFileBuffer);
|
||||
explicit PDBFile(std::unique_ptr<msf::StreamInterface> PdbFileBuffer);
|
||||
~PDBFile() override;
|
||||
|
||||
uint32_t getFreeBlockMapBlock() const;
|
||||
|
@ -91,7 +91,7 @@ private:
|
|||
|
||||
BumpPtrAllocator Allocator;
|
||||
|
||||
std::unique_ptr<codeview::StreamInterface> Buffer;
|
||||
std::unique_ptr<msf::StreamInterface> Buffer;
|
||||
const msf::SuperBlock *SB;
|
||||
ArrayRef<support::ulittle32_t> StreamSizes;
|
||||
ArrayRef<support::ulittle32_t> DirectoryBlocks;
|
||||
|
@ -103,8 +103,8 @@ private:
|
|||
std::unique_ptr<TpiStream> Ipi;
|
||||
std::unique_ptr<PublicsStream> Publics;
|
||||
std::unique_ptr<SymbolStream> Symbols;
|
||||
std::unique_ptr<MappedBlockStream> DirectoryStream;
|
||||
std::unique_ptr<MappedBlockStream> StringTableStream;
|
||||
std::unique_ptr<msf::MappedBlockStream> DirectoryStream;
|
||||
std::unique_ptr<msf::MappedBlockStream> StringTableStream;
|
||||
std::unique_ptr<NameHashTable> StringTable;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,17 +13,16 @@
|
|||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/MsfBuilder.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
class MsfBuilder;
|
||||
class StreamInterface;
|
||||
}
|
||||
namespace pdb {
|
||||
|
@ -33,14 +32,13 @@ class PDBFile;
|
|||
|
||||
class PDBFileBuilder {
|
||||
public:
|
||||
explicit PDBFileBuilder(
|
||||
std::unique_ptr<codeview::StreamInterface> FileBuffer);
|
||||
explicit PDBFileBuilder(std::unique_ptr<msf::StreamInterface> FileBuffer);
|
||||
PDBFileBuilder(const PDBFileBuilder &) = delete;
|
||||
PDBFileBuilder &operator=(const PDBFileBuilder &) = delete;
|
||||
|
||||
Error initialize(const msf::SuperBlock &Super);
|
||||
|
||||
MsfBuilder &getMsfBuilder();
|
||||
msf::MsfBuilder &getMsfBuilder();
|
||||
InfoStreamBuilder &getInfoBuilder();
|
||||
DbiStreamBuilder &getDbiBuilder();
|
||||
|
||||
|
@ -51,7 +49,7 @@ private:
|
|||
std::unique_ptr<DbiStreamBuilder> Dbi;
|
||||
|
||||
std::unique_ptr<PDBFile> File;
|
||||
std::unique_ptr<MsfBuilder> Msf;
|
||||
std::unique_ptr<msf::MsfBuilder> Msf;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
#ifndef LLVM_DEBUGINFO_PDB_RAW_PUBLICSSTREAM_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_PUBLICSSTREAM_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
|
||||
|
||||
|
@ -29,7 +29,7 @@ class PublicsStream {
|
|||
struct HeaderInfo;
|
||||
|
||||
public:
|
||||
PublicsStream(PDBFile &File, std::unique_ptr<MappedBlockStream> Stream);
|
||||
PublicsStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
|
||||
~PublicsStream();
|
||||
Error reload();
|
||||
|
||||
|
@ -38,16 +38,16 @@ public:
|
|||
uint32_t getNumBuckets() const { return NumBuckets; }
|
||||
iterator_range<codeview::CVSymbolArray::Iterator>
|
||||
getSymbols(bool *HadError) const;
|
||||
codeview::FixedStreamArray<support::ulittle32_t> getHashBuckets() const {
|
||||
msf::FixedStreamArray<support::ulittle32_t> getHashBuckets() const {
|
||||
return HashBuckets;
|
||||
}
|
||||
codeview::FixedStreamArray<support::ulittle32_t> getAddressMap() const {
|
||||
msf::FixedStreamArray<support::ulittle32_t> getAddressMap() const {
|
||||
return AddressMap;
|
||||
}
|
||||
codeview::FixedStreamArray<support::ulittle32_t> getThunkMap() const {
|
||||
msf::FixedStreamArray<support::ulittle32_t> getThunkMap() const {
|
||||
return ThunkMap;
|
||||
}
|
||||
codeview::FixedStreamArray<SectionOffset> getSectionOffsets() const {
|
||||
msf::FixedStreamArray<SectionOffset> getSectionOffsets() const {
|
||||
return SectionOffsets;
|
||||
}
|
||||
|
||||
|
@ -56,14 +56,14 @@ public:
|
|||
private:
|
||||
PDBFile &Pdb;
|
||||
|
||||
std::unique_ptr<MappedBlockStream> Stream;
|
||||
std::unique_ptr<msf::MappedBlockStream> Stream;
|
||||
uint32_t NumBuckets = 0;
|
||||
ArrayRef<uint8_t> Bitmap;
|
||||
codeview::FixedStreamArray<PSHashRecord> HashRecords;
|
||||
codeview::FixedStreamArray<support::ulittle32_t> HashBuckets;
|
||||
codeview::FixedStreamArray<support::ulittle32_t> AddressMap;
|
||||
codeview::FixedStreamArray<support::ulittle32_t> ThunkMap;
|
||||
codeview::FixedStreamArray<SectionOffset> SectionOffsets;
|
||||
msf::FixedStreamArray<PSHashRecord> HashRecords;
|
||||
msf::FixedStreamArray<support::ulittle32_t> HashBuckets;
|
||||
msf::FixedStreamArray<support::ulittle32_t> AddressMap;
|
||||
msf::FixedStreamArray<support::ulittle32_t> ThunkMap;
|
||||
msf::FixedStreamArray<SectionOffset> SectionOffsets;
|
||||
|
||||
const HeaderInfo *Header;
|
||||
const GSIHashHeader *HashHdr;
|
||||
|
|
|
@ -10,19 +10,20 @@
|
|||
#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBSYMBOLSTREAM_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_PDBSYMBOLSTREAM_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace msf {
|
||||
class MappedBlockStream;
|
||||
}
|
||||
namespace pdb {
|
||||
class PDBFile;
|
||||
|
||||
class SymbolStream {
|
||||
public:
|
||||
SymbolStream(std::unique_ptr<MappedBlockStream> Stream);
|
||||
SymbolStream(std::unique_ptr<msf::MappedBlockStream> Stream);
|
||||
~SymbolStream();
|
||||
Error reload();
|
||||
|
||||
|
@ -33,7 +34,7 @@ public:
|
|||
|
||||
private:
|
||||
codeview::CVSymbolArray SymbolRecords;
|
||||
std::unique_ptr<MappedBlockStream> Stream;
|
||||
std::unique_ptr<msf::MappedBlockStream> Stream;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,11 +10,9 @@
|
|||
#ifndef LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
|
||||
#define LLVM_DEBUGINFO_PDB_RAW_PDBTPISTREAM_H
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
@ -22,6 +20,9 @@
|
|||
#include "llvm/Support/Error.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace msf {
|
||||
class MappedBlockStream;
|
||||
}
|
||||
namespace pdb {
|
||||
class PDBFile;
|
||||
|
||||
|
@ -29,7 +30,8 @@ class TpiStream {
|
|||
struct HeaderInfo;
|
||||
|
||||
public:
|
||||
TpiStream(const PDBFile &File, std::unique_ptr<MappedBlockStream> Stream);
|
||||
TpiStream(const PDBFile &File,
|
||||
std::unique_ptr<msf::MappedBlockStream> Stream);
|
||||
~TpiStream();
|
||||
Error reload();
|
||||
|
||||
|
@ -43,9 +45,9 @@ public:
|
|||
|
||||
uint32_t getHashKeySize() const;
|
||||
uint32_t NumHashBuckets() const;
|
||||
codeview::FixedStreamArray<support::ulittle32_t> getHashValues() const;
|
||||
codeview::FixedStreamArray<TypeIndexOffset> getTypeIndexOffsets() const;
|
||||
codeview::FixedStreamArray<TypeIndexOffset> getHashAdjustments() const;
|
||||
msf::FixedStreamArray<support::ulittle32_t> getHashValues() const;
|
||||
msf::FixedStreamArray<TypeIndexOffset> getTypeIndexOffsets() const;
|
||||
msf::FixedStreamArray<TypeIndexOffset> getHashAdjustments() const;
|
||||
|
||||
iterator_range<codeview::CVTypeArray::Iterator> types(bool *HadError) const;
|
||||
|
||||
|
@ -55,14 +57,14 @@ private:
|
|||
Error verifyHashValues();
|
||||
|
||||
const PDBFile &Pdb;
|
||||
std::unique_ptr<MappedBlockStream> Stream;
|
||||
std::unique_ptr<msf::MappedBlockStream> Stream;
|
||||
|
||||
codeview::CVTypeArray TypeRecords;
|
||||
|
||||
std::unique_ptr<MappedBlockStream> HashStream;
|
||||
codeview::FixedStreamArray<support::ulittle32_t> HashValues;
|
||||
codeview::FixedStreamArray<TypeIndexOffset> TypeIndexOffsets;
|
||||
codeview::FixedStreamArray<TypeIndexOffset> HashAdjustments;
|
||||
std::unique_ptr<msf::MappedBlockStream> HashStream;
|
||||
msf::FixedStreamArray<support::ulittle32_t> HashValues;
|
||||
msf::FixedStreamArray<TypeIndexOffset> TypeIndexOffsets;
|
||||
msf::FixedStreamArray<TypeIndexOffset> HashAdjustments;
|
||||
|
||||
const HeaderInfo *Header;
|
||||
};
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "CodeViewDebug.h"
|
||||
#include "llvm/ADT/TinyPtrVector.h"
|
||||
#include "llvm/DebugInfo/CodeView/ByteStream.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/FieldListRecordBuilder.h"
|
||||
|
@ -23,6 +22,8 @@
|
|||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCSectionCOFF.h"
|
||||
|
@ -35,6 +36,7 @@
|
|||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
|
||||
CodeViewDebug::CodeViewDebug(AsmPrinter *AP)
|
||||
: DebugHandlerBase(AP), OS(*Asm->OutStreamer), CurFn(nullptr) {
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
type = Library
|
||||
name = AsmPrinter
|
||||
parent = Libraries
|
||||
required_libraries = Analysis CodeGen Core DebugInfoCodeView MC MCParser Support Target TransformUtils
|
||||
required_libraries = Analysis CodeGen Core DebugInfoCodeView DebugInfoMsf MC MCParser Support Target TransformUtils
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
add_subdirectory(CodeView)
|
||||
add_subdirectory(DWARF)
|
||||
add_subdirectory(Msf)
|
||||
add_subdirectory(CodeView)
|
||||
add_subdirectory(PDB)
|
||||
add_subdirectory(Symbolize)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
add_llvm_library(LLVMDebugInfoCodeView
|
||||
ByteStream.cpp
|
||||
CodeViewError.cpp
|
||||
CVTypeVisitor.cpp
|
||||
EnumTables.cpp
|
||||
|
@ -11,8 +10,6 @@ add_llvm_library(LLVMDebugInfoCodeView
|
|||
ModuleSubstream.cpp
|
||||
ModuleSubstreamVisitor.cpp
|
||||
RecordSerialization.cpp
|
||||
StreamReader.cpp
|
||||
StreamWriter.cpp
|
||||
SymbolDumper.cpp
|
||||
TypeDumper.cpp
|
||||
TypeRecord.cpp
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
type = Library
|
||||
name = DebugInfoCodeView
|
||||
parent = DebugInfo
|
||||
required_libraries = Support
|
||||
required_libraries = Support DebugInfoMsf
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
|
||||
#include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
|
||||
ModuleSubstream::ModuleSubstream() : Kind(ModuleSubstreamKind::None) {}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
|
||||
Error IModuleSubstreamVisitor::visitSymbols(StreamRef Data) {
|
||||
return visitUnknown(ModuleSubstreamKind::Symbols, Data);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/Support/ScopedPrinter.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
@ -681,9 +681,9 @@ Error CVTypeDumper::dump(const CVTypeArray &Types) {
|
|||
}
|
||||
|
||||
Error CVTypeDumper::dump(ArrayRef<uint8_t> Data) {
|
||||
ByteStream<> Stream(Data);
|
||||
msf::ByteStream<> Stream(Data);
|
||||
CVTypeArray Types;
|
||||
StreamReader Reader(Stream);
|
||||
msf::StreamReader Reader(Stream);
|
||||
if (auto EC = Reader.readArray(Types, Reader.getLength()))
|
||||
return EC;
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
|
||||
#include "llvm/DebugInfo/CodeView/FieldListRecordBuilder.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
;===------------------------------------------------------------------------===;
|
||||
|
||||
[common]
|
||||
subdirectories = CodeView DWARF PDB Symbolize
|
||||
subdirectories = DWARF Msf CodeView PDB Symbolize
|
||||
|
||||
[component_0]
|
||||
type = Group
|
||||
|
|
|
@ -7,26 +7,26 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/ByteStream.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include <cstring>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
|
||||
static Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Src,
|
||||
ArrayRef<uint8_t> Dest) {
|
||||
return make_error<CodeViewError>(cv_error_code::operation_unsupported,
|
||||
"ByteStream is immutable.");
|
||||
return make_error<MsfError>(msf_error_code::not_writable,
|
||||
"ByteStream is immutable.");
|
||||
}
|
||||
|
||||
static Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Src,
|
||||
MutableArrayRef<uint8_t> Dest) {
|
||||
if (Dest.size() < Src.size())
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
if (Offset > Src.size() - Dest.size())
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
::memcpy(Dest.data() + Offset, Src.data(), Src.size());
|
||||
return Error::success();
|
||||
|
@ -36,9 +36,9 @@ template <bool Writable>
|
|||
Error ByteStream<Writable>::readBytes(uint32_t Offset, uint32_t Size,
|
||||
ArrayRef<uint8_t> &Buffer) const {
|
||||
if (Offset > Data.size())
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
if (Data.size() < Size + Offset)
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
Buffer = Data.slice(Offset, Size);
|
||||
return Error::success();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ template <bool Writable>
|
|||
Error ByteStream<Writable>::readLongestContiguousChunk(
|
||||
uint32_t Offset, ArrayRef<uint8_t> &Buffer) const {
|
||||
if (Offset >= Data.size())
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
Buffer = Data.slice(Offset);
|
||||
return Error::success();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ template <bool Writable> StringRef ByteStream<Writable>::str() const {
|
|||
}
|
||||
|
||||
namespace llvm {
|
||||
namespace codeview {
|
||||
namespace msf {
|
||||
template class ByteStream<true>;
|
||||
template class ByteStream<false>;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
add_llvm_library(LLVMDebugInfoMsf
|
||||
ByteStream.cpp
|
||||
IndexedStreamData.cpp
|
||||
MappedBlockStream.cpp
|
||||
MsfBuilder.cpp
|
||||
MsfCommon.cpp
|
||||
MsfError.cpp
|
||||
StreamReader.cpp
|
||||
StreamWriter.cpp
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
"${LLVM_MAIN_INCLUDE_DIR}/llvm/DebugInfo/MSF"
|
||||
)
|
|
@ -7,13 +7,13 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IPDBFile.h"
|
||||
#include "llvm/DebugInfo/Msf/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfFile.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::pdb;
|
||||
using namespace llvm::msf;
|
||||
|
||||
IndexedStreamData::IndexedStreamData(uint32_t StreamIdx, const IPDBFile &File)
|
||||
IndexedStreamData::IndexedStreamData(uint32_t StreamIdx, const IMsfFile &File)
|
||||
: StreamIdx(StreamIdx), File(File) {}
|
||||
|
||||
uint32_t IndexedStreamData::getLength() {
|
|
@ -0,0 +1,22 @@
|
|||
;===- ./lib/DebugInfo/Msf/LLVMBuild.txt -------------------*- Conf -*--===;
|
||||
;
|
||||
; The LLVM Compiler Infrastructure
|
||||
;
|
||||
; This file is distributed under the University of Illinois Open Source
|
||||
; License. See LICENSE.TXT for details.
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
;
|
||||
; This is an LLVMBuild description file for the components in this subdirectory.
|
||||
;
|
||||
; For more information on the LLVMBuild system, please see:
|
||||
;
|
||||
; http://llvm.org/docs/LLVMBuild.html
|
||||
;
|
||||
;===------------------------------------------------------------------------===;
|
||||
|
||||
[component_0]
|
||||
type = Library
|
||||
name = DebugInfoMsf
|
||||
parent = DebugInfo
|
||||
required_libraries = Support
|
|
@ -1,4 +1,4 @@
|
|||
//===- MappedBlockStream.cpp - Reads stream data from a PDBFile -----------===//
|
||||
//===- MappedBlockStream.cpp - Reads stream data from an MSF file ---------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,24 +7,23 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DirectoryStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IPDBStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/DirectoryStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::pdb;
|
||||
using namespace llvm::msf;
|
||||
|
||||
namespace {
|
||||
// This exists so that we can use make_unique while still keeping the
|
||||
// constructor of MappedBlockStream private, forcing users to go through
|
||||
// the `create` interface.
|
||||
// This exists so that we can use make_unique (which requires a public default
|
||||
// constructor, while still keeping the constructor of MappedBlockStream
|
||||
// protected, forcing users to go through the `create` interface.
|
||||
class MappedBlockStreamImpl : public MappedBlockStream {
|
||||
public:
|
||||
MappedBlockStreamImpl(std::unique_ptr<IPDBStreamData> Data,
|
||||
const IPDBFile &File)
|
||||
MappedBlockStreamImpl(std::unique_ptr<IMsfStreamData> Data,
|
||||
const IMsfFile &File)
|
||||
: MappedBlockStream(std::move(Data), File) {}
|
||||
};
|
||||
}
|
||||
|
@ -35,17 +34,17 @@ static Interval intersect(const Interval &I1, const Interval &I2) {
|
|||
std::min(I1.second, I2.second));
|
||||
}
|
||||
|
||||
MappedBlockStream::MappedBlockStream(std::unique_ptr<IPDBStreamData> Data,
|
||||
const IPDBFile &Pdb)
|
||||
: Pdb(Pdb), Data(std::move(Data)) {}
|
||||
MappedBlockStream::MappedBlockStream(std::unique_ptr<IMsfStreamData> Data,
|
||||
const IMsfFile &File)
|
||||
: Msf(File), Data(std::move(Data)) {}
|
||||
|
||||
Error MappedBlockStream::readBytes(uint32_t Offset, uint32_t Size,
|
||||
ArrayRef<uint8_t> &Buffer) const {
|
||||
// Make sure we aren't trying to read beyond the end of the stream.
|
||||
if (Size > Data->getLength())
|
||||
return make_error<RawError>(raw_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
if (Offset > Data->getLength() - Size)
|
||||
return make_error<RawError>(raw_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
if (tryReadContiguously(Offset, Size, Buffer))
|
||||
return Error::success();
|
||||
|
@ -123,23 +122,23 @@ Error MappedBlockStream::readLongestContiguousChunk(
|
|||
uint32_t Offset, ArrayRef<uint8_t> &Buffer) const {
|
||||
// Make sure we aren't trying to read beyond the end of the stream.
|
||||
if (Offset >= Data->getLength())
|
||||
return make_error<RawError>(raw_error_code::insufficient_buffer);
|
||||
uint32_t First = Offset / Pdb.getBlockSize();
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
uint32_t First = Offset / Msf.getBlockSize();
|
||||
uint32_t Last = First;
|
||||
|
||||
auto BlockList = Data->getStreamBlocks();
|
||||
while (Last < Pdb.getBlockCount() - 1) {
|
||||
while (Last < Msf.getBlockCount() - 1) {
|
||||
if (BlockList[Last] != BlockList[Last + 1] - 1)
|
||||
break;
|
||||
++Last;
|
||||
}
|
||||
|
||||
uint32_t OffsetInFirstBlock = Offset % Pdb.getBlockSize();
|
||||
uint32_t BytesFromFirstBlock = Pdb.getBlockSize() - OffsetInFirstBlock;
|
||||
uint32_t OffsetInFirstBlock = Offset % Msf.getBlockSize();
|
||||
uint32_t BytesFromFirstBlock = Msf.getBlockSize() - OffsetInFirstBlock;
|
||||
uint32_t BlockSpan = Last - First + 1;
|
||||
uint32_t ByteSpan =
|
||||
BytesFromFirstBlock + (BlockSpan - 1) * Pdb.getBlockSize();
|
||||
auto Result = Pdb.getBlockData(BlockList[First], Pdb.getBlockSize());
|
||||
BytesFromFirstBlock + (BlockSpan - 1) * Msf.getBlockSize();
|
||||
auto Result = Msf.getBlockData(BlockList[First], Msf.getBlockSize());
|
||||
if (!Result)
|
||||
return Result.takeError();
|
||||
Buffer = Result->drop_front(OffsetInFirstBlock);
|
||||
|
@ -158,13 +157,13 @@ bool MappedBlockStream::tryReadContiguously(uint32_t Offset, uint32_t Size,
|
|||
// all subsequent blocks are contiguous. For example, a 10k read with a 4k
|
||||
// block size can be filled with a reference if, from the starting offset,
|
||||
// 3 blocks in a row are contiguous.
|
||||
uint32_t BlockNum = Offset / Pdb.getBlockSize();
|
||||
uint32_t OffsetInBlock = Offset % Pdb.getBlockSize();
|
||||
uint32_t BlockNum = Offset / Msf.getBlockSize();
|
||||
uint32_t OffsetInBlock = Offset % Msf.getBlockSize();
|
||||
uint32_t BytesFromFirstBlock =
|
||||
std::min(Size, Pdb.getBlockSize() - OffsetInBlock);
|
||||
std::min(Size, Msf.getBlockSize() - OffsetInBlock);
|
||||
uint32_t NumAdditionalBlocks =
|
||||
llvm::alignTo(Size - BytesFromFirstBlock, Pdb.getBlockSize()) /
|
||||
Pdb.getBlockSize();
|
||||
llvm::alignTo(Size - BytesFromFirstBlock, Msf.getBlockSize()) /
|
||||
Msf.getBlockSize();
|
||||
|
||||
auto BlockList = Data->getStreamBlocks();
|
||||
uint32_t RequiredContiguousBlocks = NumAdditionalBlocks + 1;
|
||||
|
@ -175,7 +174,7 @@ bool MappedBlockStream::tryReadContiguously(uint32_t Offset, uint32_t Size,
|
|||
}
|
||||
|
||||
uint32_t FirstBlockAddr = BlockList[BlockNum];
|
||||
auto Result = Pdb.getBlockData(FirstBlockAddr, Pdb.getBlockSize());
|
||||
auto Result = Msf.getBlockData(FirstBlockAddr, Msf.getBlockSize());
|
||||
if (!Result) {
|
||||
consumeError(Result.takeError());
|
||||
return false;
|
||||
|
@ -187,14 +186,14 @@ bool MappedBlockStream::tryReadContiguously(uint32_t Offset, uint32_t Size,
|
|||
|
||||
Error MappedBlockStream::readBytes(uint32_t Offset,
|
||||
MutableArrayRef<uint8_t> Buffer) const {
|
||||
uint32_t BlockNum = Offset / Pdb.getBlockSize();
|
||||
uint32_t OffsetInBlock = Offset % Pdb.getBlockSize();
|
||||
uint32_t BlockNum = Offset / Msf.getBlockSize();
|
||||
uint32_t OffsetInBlock = Offset % Msf.getBlockSize();
|
||||
|
||||
// Make sure we aren't trying to read beyond the end of the stream.
|
||||
if (Buffer.size() > Data->getLength())
|
||||
return make_error<RawError>(raw_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
if (Offset > Data->getLength() - Buffer.size())
|
||||
return make_error<RawError>(raw_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
uint32_t BytesLeft = Buffer.size();
|
||||
uint32_t BytesWritten = 0;
|
||||
|
@ -203,14 +202,14 @@ Error MappedBlockStream::readBytes(uint32_t Offset,
|
|||
while (BytesLeft > 0) {
|
||||
uint32_t StreamBlockAddr = BlockList[BlockNum];
|
||||
|
||||
auto Result = Pdb.getBlockData(StreamBlockAddr, Pdb.getBlockSize());
|
||||
auto Result = Msf.getBlockData(StreamBlockAddr, Msf.getBlockSize());
|
||||
if (!Result)
|
||||
return Result.takeError();
|
||||
|
||||
auto Data = *Result;
|
||||
const uint8_t *ChunkStart = Data.data() + OffsetInBlock;
|
||||
uint32_t BytesInChunk =
|
||||
std::min(BytesLeft, Pdb.getBlockSize() - OffsetInBlock);
|
||||
std::min(BytesLeft, Msf.getBlockSize() - OffsetInBlock);
|
||||
::memcpy(WriteBuffer + BytesWritten, ChunkStart, BytesInChunk);
|
||||
|
||||
BytesWritten += BytesInChunk;
|
||||
|
@ -226,13 +225,13 @@ Error MappedBlockStream::writeBytes(uint32_t Offset,
|
|||
ArrayRef<uint8_t> Buffer) const {
|
||||
// Make sure we aren't trying to write beyond the end of the stream.
|
||||
if (Buffer.size() > Data->getLength())
|
||||
return make_error<RawError>(raw_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
if (Offset > Data->getLength() - Buffer.size())
|
||||
return make_error<RawError>(raw_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
|
||||
uint32_t BlockNum = Offset / Pdb.getBlockSize();
|
||||
uint32_t OffsetInBlock = Offset % Pdb.getBlockSize();
|
||||
uint32_t BlockNum = Offset / Msf.getBlockSize();
|
||||
uint32_t OffsetInBlock = Offset % Msf.getBlockSize();
|
||||
|
||||
uint32_t BytesLeft = Buffer.size();
|
||||
auto BlockList = Data->getStreamBlocks();
|
||||
|
@ -240,11 +239,11 @@ Error MappedBlockStream::writeBytes(uint32_t Offset,
|
|||
while (BytesLeft > 0) {
|
||||
uint32_t StreamBlockAddr = BlockList[BlockNum];
|
||||
uint32_t BytesToWriteInChunk =
|
||||
std::min(BytesLeft, Pdb.getBlockSize() - OffsetInBlock);
|
||||
std::min(BytesLeft, Msf.getBlockSize() - OffsetInBlock);
|
||||
|
||||
const uint8_t *Chunk = Buffer.data() + BytesWritten;
|
||||
ArrayRef<uint8_t> ChunkData(Chunk, BytesToWriteInChunk);
|
||||
if (auto EC = Pdb.setBlockData(StreamBlockAddr, OffsetInBlock, ChunkData))
|
||||
if (auto EC = Msf.setBlockData(StreamBlockAddr, OffsetInBlock, ChunkData))
|
||||
return EC;
|
||||
|
||||
BytesLeft -= BytesToWriteInChunk;
|
||||
|
@ -295,16 +294,18 @@ uint32_t MappedBlockStream::getNumBytesCopied() const {
|
|||
|
||||
Expected<std::unique_ptr<MappedBlockStream>>
|
||||
MappedBlockStream::createIndexedStream(uint32_t StreamIdx,
|
||||
const IPDBFile &File) {
|
||||
const IMsfFile &File) {
|
||||
if (StreamIdx >= File.getNumStreams())
|
||||
return make_error<RawError>(raw_error_code::no_stream);
|
||||
return make_error<MsfError>(msf_error_code::no_stream);
|
||||
|
||||
auto Data = llvm::make_unique<IndexedStreamData>(StreamIdx, File);
|
||||
return llvm::make_unique<MappedBlockStreamImpl>(std::move(Data), File);
|
||||
}
|
||||
|
||||
Expected<std::unique_ptr<MappedBlockStream>>
|
||||
MappedBlockStream::createDirectoryStream(const PDBFile &File) {
|
||||
auto Data = llvm::make_unique<DirectoryStreamData>(File);
|
||||
MappedBlockStream::createDirectoryStream(uint32_t Length,
|
||||
ArrayRef<support::ulittle32_t> Blocks,
|
||||
const IMsfFile &File) {
|
||||
auto Data = llvm::make_unique<DirectoryStreamData>(Length, Blocks);
|
||||
return llvm::make_unique<MappedBlockStreamImpl>(std::move(Data), File);
|
||||
}
|
|
@ -7,12 +7,11 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/MsfBuilder.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfBuilder.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::pdb;
|
||||
using namespace llvm::pdb::msf;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::support;
|
||||
|
||||
namespace {
|
||||
|
@ -38,8 +37,8 @@ MsfBuilder::MsfBuilder(uint32_t BlockSize, uint32_t MinBlockCount, bool CanGrow,
|
|||
Expected<MsfBuilder> MsfBuilder::create(BumpPtrAllocator &Allocator,
|
||||
uint32_t BlockSize,
|
||||
uint32_t MinBlockCount, bool CanGrow) {
|
||||
if (!msf::isValidBlockSize(BlockSize))
|
||||
return make_error<RawError>(raw_error_code::unspecified,
|
||||
if (!isValidBlockSize(BlockSize))
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"The requested block size is unsupported");
|
||||
|
||||
return MsfBuilder(BlockSize,
|
||||
|
@ -53,14 +52,15 @@ Error MsfBuilder::setBlockMapAddr(uint32_t Addr) {
|
|||
|
||||
if (Addr >= FreeBlocks.size()) {
|
||||
if (!IsGrowable)
|
||||
return make_error<RawError>(raw_error_code::unspecified,
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer,
|
||||
"Cannot grow the number of blocks");
|
||||
FreeBlocks.resize(Addr + 1);
|
||||
}
|
||||
|
||||
if (!isBlockFree(Addr))
|
||||
return make_error<RawError>(raw_error_code::unspecified,
|
||||
"Attempt to reuse an allocated block");
|
||||
return make_error<MsfError>(
|
||||
msf_error_code::block_in_use,
|
||||
"Requested block map address is already in use");
|
||||
FreeBlocks[BlockMapAddr] = true;
|
||||
FreeBlocks[Addr] = false;
|
||||
BlockMapAddr = Addr;
|
||||
|
@ -76,7 +76,7 @@ Error MsfBuilder::setDirectoryBlocksHint(ArrayRef<uint32_t> DirBlocks) {
|
|||
FreeBlocks[B] = true;
|
||||
for (auto B : DirBlocks) {
|
||||
if (!isBlockFree(B)) {
|
||||
return make_error<RawError>(raw_error_code::unspecified,
|
||||
return make_error<MsfError>(msf_error_code::unspecified,
|
||||
"Attempt to reuse an allocated block");
|
||||
}
|
||||
FreeBlocks[B] = false;
|
||||
|
@ -94,7 +94,7 @@ Error MsfBuilder::allocateBlocks(uint32_t NumBlocks,
|
|||
uint32_t NumFreeBlocks = FreeBlocks.count();
|
||||
if (NumFreeBlocks < NumBlocks) {
|
||||
if (!IsGrowable)
|
||||
return make_error<RawError>(raw_error_code::unspecified,
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer,
|
||||
"There are no free Blocks in the file");
|
||||
uint32_t AllocBlocks = NumBlocks - NumFreeBlocks;
|
||||
FreeBlocks.resize(AllocBlocks + FreeBlocks.size(), true);
|
||||
|
@ -129,16 +129,16 @@ Error MsfBuilder::addStream(uint32_t Size, ArrayRef<uint32_t> Blocks) {
|
|||
// of bytes, and verify that all requested blocks are free.
|
||||
uint32_t ReqBlocks = bytesToBlocks(Size, BlockSize);
|
||||
if (ReqBlocks != Blocks.size())
|
||||
return make_error<RawError>(
|
||||
raw_error_code::unspecified,
|
||||
return make_error<MsfError>(
|
||||
msf_error_code::invalid_format,
|
||||
"Incorrect number of blocks for requested stream size");
|
||||
for (auto Block : Blocks) {
|
||||
if (Block >= FreeBlocks.size())
|
||||
FreeBlocks.resize(Block + 1, true);
|
||||
|
||||
if (!FreeBlocks.test(Block))
|
||||
return make_error<RawError>(
|
||||
raw_error_code::unspecified,
|
||||
return make_error<MsfError>(
|
||||
msf_error_code::unspecified,
|
||||
"Attempt to re-use an already allocated block");
|
||||
}
|
||||
// Mark all the blocks occupied by the new stream as not free.
|
||||
|
@ -249,8 +249,8 @@ Expected<Layout> MsfBuilder::build() {
|
|||
}
|
||||
|
||||
// Don't set the number of blocks in the file until after allocating Blocks
|
||||
// for
|
||||
// the directory, since the allocation might cause the file to need to grow.
|
||||
// for the directory, since the allocation might cause the file to need to
|
||||
// grow.
|
||||
L.SB->NumBlocks = FreeBlocks.size();
|
||||
|
||||
ulittle32_t *DirBlocks = Allocator.Allocate<ulittle32_t>(NumDirectoryBlocks);
|
|
@ -7,25 +7,25 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::pdb::msf;
|
||||
using namespace llvm::msf;
|
||||
|
||||
Error llvm::pdb::msf::validateSuperBlock(const SuperBlock &SB) {
|
||||
Error llvm::msf::validateSuperBlock(const SuperBlock &SB) {
|
||||
// Check the magic bytes.
|
||||
if (std::memcmp(SB.MagicBytes, Magic, sizeof(Magic)) != 0)
|
||||
return make_error<RawError>(raw_error_code::corrupt_file,
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"MSF magic header doesn't match");
|
||||
|
||||
if (!isValidBlockSize(SB.BlockSize))
|
||||
return make_error<RawError>(raw_error_code::corrupt_file,
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"Unsupported block size.");
|
||||
|
||||
// We don't support directories whose sizes aren't a multiple of four bytes.
|
||||
if (SB.NumDirectoryBytes % sizeof(support::ulittle32_t) != 0)
|
||||
return make_error<RawError>(raw_error_code::corrupt_file,
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"Directory size is not multiple of 4.");
|
||||
|
||||
// The number of blocks which comprise the directory is a simple function of
|
||||
|
@ -37,11 +37,11 @@ Error llvm::pdb::msf::validateSuperBlock(const SuperBlock &SB) {
|
|||
// block numbers. It is unclear what would happen if the number of blocks
|
||||
// couldn't fit on a single block.
|
||||
if (NumDirectoryBlocks > SB.BlockSize / sizeof(support::ulittle32_t))
|
||||
return make_error<RawError>(raw_error_code::corrupt_file,
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"Too many directory blocks.");
|
||||
|
||||
if (SB.BlockMapAddr == 0)
|
||||
return make_error<RawError>(raw_error_code::corrupt_file,
|
||||
return make_error<MsfError>(msf_error_code::invalid_format,
|
||||
"Block 0 is reserved");
|
||||
|
||||
return Error::success();
|
|
@ -0,0 +1,70 @@
|
|||
//===- MsfError.cpp - Error extensions for Msf files ------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/ManagedStatic.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
|
||||
namespace {
|
||||
// FIXME: This class is only here to support the transition to llvm::Error. It
|
||||
// will be removed once this transition is complete. Clients should prefer to
|
||||
// deal with the Error value directly, rather than converting to error_code.
|
||||
class MsfErrorCategory : public std::error_category {
|
||||
public:
|
||||
const char *name() const LLVM_NOEXCEPT override { return "llvm.msf"; }
|
||||
|
||||
std::string message(int Condition) const override {
|
||||
switch (static_cast<msf_error_code>(Condition)) {
|
||||
case msf_error_code::unspecified:
|
||||
return "An unknown error has occurred.";
|
||||
case msf_error_code::insufficient_buffer:
|
||||
return "The buffer is not large enough to read the requested number of "
|
||||
"bytes.";
|
||||
case msf_error_code::not_writable:
|
||||
return "The specified stream is not writable.";
|
||||
case msf_error_code::no_stream:
|
||||
return "The specified stream does not exist.";
|
||||
case msf_error_code::invalid_format:
|
||||
return "The data is in an unexpected format.";
|
||||
case msf_error_code::block_in_use:
|
||||
return "The block is already in use.";
|
||||
}
|
||||
llvm_unreachable("Unrecognized msf_error_code");
|
||||
}
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
static ManagedStatic<MsfErrorCategory> Category;
|
||||
|
||||
char MsfError::ID = 0;
|
||||
|
||||
MsfError::MsfError(msf_error_code C) : MsfError(C, "") {}
|
||||
|
||||
MsfError::MsfError(const std::string &Context)
|
||||
: MsfError(msf_error_code::unspecified, Context) {}
|
||||
|
||||
MsfError::MsfError(msf_error_code C, const std::string &Context) : Code(C) {
|
||||
ErrMsg = "Msf Error: ";
|
||||
std::error_code EC = convertToErrorCode();
|
||||
if (Code != msf_error_code::unspecified)
|
||||
ErrMsg += EC.message() + " ";
|
||||
if (!Context.empty())
|
||||
ErrMsg += Context;
|
||||
}
|
||||
|
||||
void MsfError::log(raw_ostream &OS) const { OS << ErrMsg << "\n"; }
|
||||
|
||||
const std::string &MsfError::getErrorMessage() const { return ErrMsg; }
|
||||
|
||||
std::error_code MsfError::convertToErrorCode() const {
|
||||
return std::error_code(static_cast<int>(Code), *Category);
|
||||
}
|
|
@ -7,13 +7,13 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
|
||||
StreamReader::StreamReader(StreamRef S) : Stream(S), Offset(0) {}
|
||||
|
||||
|
@ -86,7 +86,7 @@ Error StreamReader::readStreamRef(StreamRef &Ref) {
|
|||
|
||||
Error StreamReader::readStreamRef(StreamRef &Ref, uint32_t Length) {
|
||||
if (bytesRemaining() < Length)
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
Ref = Stream.slice(Offset, Length);
|
||||
Offset += Length;
|
||||
return Error::success();
|
|
@ -7,14 +7,14 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfError.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
|
||||
StreamWriter::StreamWriter(StreamRef S) : Stream(S), Offset(0) {}
|
||||
|
|
@ -32,14 +32,10 @@ add_pdb_impl_folder(Raw
|
|||
Raw/DbiStreamBuilder.cpp
|
||||
Raw/EnumTables.cpp
|
||||
Raw/Hash.cpp
|
||||
Raw/IndexedStreamData.cpp
|
||||
Raw/InfoStream.cpp
|
||||
Raw/InfoStreamBuilder.cpp
|
||||
Raw/MappedBlockStream.cpp
|
||||
Raw/ModInfo.cpp
|
||||
Raw/ModStream.cpp
|
||||
Raw/MsfBuilder.cpp
|
||||
Raw/MsfCommon.cpp
|
||||
Raw/NameHashTable.cpp
|
||||
Raw/NameMap.cpp
|
||||
Raw/NameMapBuilder.cpp
|
||||
|
|
|
@ -19,5 +19,5 @@
|
|||
type = Library
|
||||
name = DebugInfoPDB
|
||||
parent = DebugInfo
|
||||
required_libraries = Object Support DebugInfoCodeView
|
||||
required_libraries = Object Support DebugInfoCodeView DebugInfoMsf
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
|
||||
|
@ -25,6 +25,7 @@
|
|||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
using namespace llvm::support;
|
||||
|
||||
|
@ -204,17 +205,16 @@ PDB_Machine DbiStream::getMachineType() const {
|
|||
return static_cast<PDB_Machine>(Machine);
|
||||
}
|
||||
|
||||
codeview::FixedStreamArray<object::coff_section>
|
||||
DbiStream::getSectionHeaders() {
|
||||
msf::FixedStreamArray<object::coff_section> DbiStream::getSectionHeaders() {
|
||||
return SectionHeaders;
|
||||
}
|
||||
|
||||
codeview::FixedStreamArray<object::FpoData> DbiStream::getFpoRecords() {
|
||||
msf::FixedStreamArray<object::FpoData> DbiStream::getFpoRecords() {
|
||||
return FpoRecords;
|
||||
}
|
||||
|
||||
ArrayRef<ModuleInfoEx> DbiStream::modules() const { return ModuleInfos; }
|
||||
codeview::FixedStreamArray<SecMapEntry> DbiStream::getSectionMap() const {
|
||||
msf::FixedStreamArray<SecMapEntry> DbiStream::getSectionMap() const {
|
||||
return SectionMap;
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ Error DbiStream::initializeSectionHeadersData() {
|
|||
"Corrupted section header stream.");
|
||||
|
||||
size_t NumSections = StreamLen / sizeof(object::coff_section);
|
||||
codeview::StreamReader Reader(**SHS);
|
||||
msf::StreamReader Reader(**SHS);
|
||||
if (auto EC = Reader.readArray(SectionHeaders, NumSections))
|
||||
return make_error<RawError>(raw_error_code::corrupt_file,
|
||||
"Could not read a bitmap.");
|
||||
|
@ -316,7 +316,7 @@ Error DbiStream::initializeFpoRecords() {
|
|||
"Corrupted New FPO stream.");
|
||||
|
||||
size_t NumRecords = StreamLen / sizeof(object::FpoData);
|
||||
codeview::StreamReader Reader(**FS);
|
||||
msf::StreamReader Reader(**FS);
|
||||
if (auto EC = Reader.readArray(FpoRecords, NumRecords))
|
||||
return make_error<RawError>(raw_error_code::corrupt_file,
|
||||
"Corrupted New FPO stream.");
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -10,22 +10,23 @@
|
|||
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
InfoStream::InfoStream(std::unique_ptr<MappedBlockStream> Stream)
|
||||
: Stream(std::move(Stream)) {}
|
||||
|
||||
Error InfoStream::reload() {
|
||||
codeview::StreamReader Reader(*Stream);
|
||||
StreamReader Reader(*Stream);
|
||||
|
||||
const HeaderInfo *H;
|
||||
if (auto EC = Reader.readObject(H))
|
||||
|
|
|
@ -9,13 +9,14 @@
|
|||
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStreamBuilder.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
InfoStreamBuilder::InfoStreamBuilder() {}
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
using namespace llvm::support;
|
||||
|
||||
|
@ -26,8 +27,8 @@ ModInfo::ModInfo(const ModInfo &Info)
|
|||
|
||||
ModInfo::~ModInfo() {}
|
||||
|
||||
Error ModInfo::initialize(codeview::StreamRef Stream, ModInfo &Info) {
|
||||
codeview::StreamReader Reader(Stream);
|
||||
Error ModInfo::initialize(StreamRef Stream, ModInfo &Info) {
|
||||
StreamReader Reader(Stream);
|
||||
if (auto EC = Reader.readObject(Info.Layout))
|
||||
return EC;
|
||||
|
||||
|
|
|
@ -9,14 +9,15 @@
|
|||
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModStream.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
ModStream::ModStream(const ModInfo &Module,
|
||||
|
@ -26,7 +27,7 @@ ModStream::ModStream(const ModInfo &Module,
|
|||
ModStream::~ModStream() {}
|
||||
|
||||
Error ModStream::reload() {
|
||||
codeview::StreamReader Reader(*Stream);
|
||||
StreamReader Reader(*Stream);
|
||||
|
||||
uint32_t SymbolSize = Mod.getSymbolDebugInfoByteSize();
|
||||
uint32_t C11Size = Mod.getLineInfoByteSize();
|
||||
|
@ -36,7 +37,7 @@ Error ModStream::reload() {
|
|||
return llvm::make_error<RawError>(raw_error_code::corrupt_file,
|
||||
"Module has both C11 and C13 line info");
|
||||
|
||||
codeview::StreamRef S;
|
||||
StreamRef S;
|
||||
|
||||
uint32_t SymbolSubstreamSig = 0;
|
||||
if (auto EC = Reader.readInteger(SymbolSubstreamSig))
|
||||
|
@ -49,7 +50,7 @@ Error ModStream::reload() {
|
|||
if (auto EC = Reader.readStreamRef(C13LinesSubstream, C13Size))
|
||||
return EC;
|
||||
|
||||
codeview::StreamReader LineReader(C13LinesSubstream);
|
||||
StreamReader LineReader(C13LinesSubstream);
|
||||
if (auto EC = LineReader.readArray(LineInfo, LineReader.bytesRemaining()))
|
||||
return EC;
|
||||
|
||||
|
|
|
@ -10,18 +10,19 @@
|
|||
#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/Hash.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::support;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
NameHashTable::NameHashTable() : Signature(0), HashVersion(0), NameCount(0) {}
|
||||
|
||||
Error NameHashTable::load(codeview::StreamReader &Stream) {
|
||||
Error NameHashTable::load(StreamReader &Stream) {
|
||||
struct Header {
|
||||
support::ulittle32_t Signature;
|
||||
support::ulittle32_t HashVersion;
|
||||
|
@ -72,7 +73,7 @@ StringRef NameHashTable::getStringForID(uint32_t ID) const {
|
|||
// the starting offset of the string we're looking for. So just seek into
|
||||
// the desired offset and a read a null terminated stream from that offset.
|
||||
StringRef Result;
|
||||
codeview::StreamReader NameReader(NamesBuffer);
|
||||
StreamReader NameReader(NamesBuffer);
|
||||
NameReader.setOffset(ID);
|
||||
if (auto EC = NameReader.readZeroString(Result))
|
||||
consumeError(std::move(EC));
|
||||
|
@ -98,7 +99,6 @@ uint32_t NameHashTable::getIDForString(StringRef Str) const {
|
|||
return IDs[0];
|
||||
}
|
||||
|
||||
codeview::FixedStreamArray<support::ulittle32_t>
|
||||
NameHashTable::name_ids() const {
|
||||
FixedStreamArray<support::ulittle32_t> NameHashTable::name_ids() const {
|
||||
return IDs;
|
||||
}
|
||||
|
|
|
@ -9,17 +9,17 @@
|
|||
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameMap.h"
|
||||
#include "llvm/ADT/SparseBitVector.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
NameMap::NameMap() {}
|
||||
|
||||
Error NameMap::load(codeview::StreamReader &Stream) {
|
||||
Error NameMap::load(StreamReader &Stream) {
|
||||
|
||||
// This is some sort of weird string-set/hash table encoded in the stream.
|
||||
// It starts with the number of bytes in the table.
|
||||
|
@ -145,7 +145,7 @@ Error NameMap::load(codeview::StreamReader &Stream) {
|
|||
return Error::success();
|
||||
}
|
||||
|
||||
Error NameMap::commit(codeview::StreamWriter &Writer) {
|
||||
Error NameMap::commit(StreamWriter &Writer) {
|
||||
// The first field is the number of bytes of string data. So add
|
||||
// up the length of all strings plus a null terminator for each
|
||||
// one.
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamArray.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/DirectoryStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamArray.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DirectoryStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PublicsStream.h"
|
||||
|
@ -29,6 +29,7 @@
|
|||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
namespace {
|
||||
|
@ -130,7 +131,8 @@ Error PDBFile::parseStreamData() {
|
|||
// is exactly what we are attempting to parse. By specifying a custom
|
||||
// subclass of IPDBStreamData which only accesses the fields that have already
|
||||
// been parsed, we can avoid this and reuse MappedBlockStream.
|
||||
auto DS = MappedBlockStream::createDirectoryStream(*this);
|
||||
auto DS = MappedBlockStream::createDirectoryStream(
|
||||
SB->NumDirectoryBytes, getDirectoryBlockArray(), *this);
|
||||
if (!DS)
|
||||
return DS.takeError();
|
||||
StreamReader Reader(**DS);
|
||||
|
@ -315,7 +317,8 @@ Error PDBFile::commit() {
|
|||
if (auto EC = Writer.writeArray(DirectoryBlocks))
|
||||
return EC;
|
||||
|
||||
auto DS = MappedBlockStream::createDirectoryStream(*this);
|
||||
auto DS = MappedBlockStream::createDirectoryStream(
|
||||
SB->NumDirectoryBytes, getDirectoryBlockArray(), *this);
|
||||
if (!DS)
|
||||
return DS.takeError();
|
||||
auto DirStream = std::move(*DS);
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfBuilder.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStreamBuilder.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
|
||||
|
@ -21,11 +22,11 @@
|
|||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
using namespace llvm::support;
|
||||
|
||||
PDBFileBuilder::PDBFileBuilder(
|
||||
std::unique_ptr<codeview::StreamInterface> FileBuffer)
|
||||
PDBFileBuilder::PDBFileBuilder(std::unique_ptr<msf::StreamInterface> FileBuffer)
|
||||
: File(llvm::make_unique<PDBFile>(std::move(FileBuffer))) {}
|
||||
|
||||
Error PDBFileBuilder::initialize(const msf::SuperBlock &Super) {
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
#include "llvm/DebugInfo/PDB/Raw/PublicsStream.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
@ -40,6 +40,7 @@
|
|||
#include "llvm/Support/MathExtras.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::support;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
|
@ -86,7 +87,7 @@ uint32_t PublicsStream::getAddrMap() const { return Header->AddrMap; }
|
|||
// we skip over the hash table which we believe contains information about
|
||||
// public symbols.
|
||||
Error PublicsStream::reload() {
|
||||
codeview::StreamReader Reader(*Stream);
|
||||
StreamReader Reader(*Stream);
|
||||
|
||||
// Check stream size.
|
||||
if (Reader.bytesRemaining() < sizeof(HeaderInfo) + sizeof(GSIHashHeader))
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawSession.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/ByteStream.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamInterface.h"
|
||||
#include "llvm/DebugInfo/PDB/GenericError.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
|
||||
|
@ -23,13 +23,14 @@
|
|||
#include "llvm/Support/MemoryBuffer.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
namespace {
|
||||
// We need a class which behaves like an immutable ByteStream, but whose data
|
||||
// is backed by an llvm::MemoryBuffer. It also needs to own the underlying
|
||||
// MemoryBuffer, so this simple adapter is a good way to achieve that.
|
||||
class InputByteStream : public codeview::ByteStream<false> {
|
||||
class InputByteStream : public ByteStream<false> {
|
||||
public:
|
||||
explicit InputByteStream(std::unique_ptr<MemoryBuffer> Buffer)
|
||||
: ByteStream(ArrayRef<uint8_t>(Buffer->getBuffer().bytes_begin(),
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
#include "llvm/DebugInfo/PDB/Raw/SymbolStream.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
@ -21,6 +21,7 @@
|
|||
#include "llvm/Support/Endian.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::support;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
|
@ -30,7 +31,7 @@ SymbolStream::SymbolStream(std::unique_ptr<MappedBlockStream> Stream)
|
|||
SymbolStream::~SymbolStream() {}
|
||||
|
||||
Error SymbolStream::reload() {
|
||||
codeview::StreamReader Reader(*Stream);
|
||||
StreamReader Reader(*Stream);
|
||||
|
||||
if (auto EC = Reader.readArray(SymbolRecords, Stream->getLength()))
|
||||
return EC;
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
|
||||
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/Msf/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/Hash.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawError.h"
|
||||
|
@ -27,6 +27,7 @@
|
|||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::support;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
set(LLVM_LINK_COMPONENTS
|
||||
DebugInfoCodeView
|
||||
DebugInfoMsf
|
||||
DebugInfoPDB
|
||||
Object
|
||||
Support
|
||||
|
|
|
@ -19,5 +19,5 @@
|
|||
type = Tool
|
||||
name = llvm-pdbdump
|
||||
parent = Tools
|
||||
required_libraries = DebugInfoPDB
|
||||
required_libraries = DebugInfoMsf DebugInfoPDB
|
||||
|
||||
|
|
|
@ -13,11 +13,13 @@
|
|||
#include "llvm/DebugInfo/CodeView/EnumTables.h"
|
||||
#include "llvm/DebugInfo/CodeView/ModuleSubstreamVisitor.h"
|
||||
#include "llvm/DebugInfo/CodeView/SymbolDumper.h"
|
||||
#include "llvm/DebugInfo/Msf/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBExtras.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/EnumTables.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/ModStream.h"
|
||||
|
@ -31,6 +33,7 @@
|
|||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
static void printSectionOffset(llvm::raw_ostream &OS,
|
||||
|
@ -260,7 +263,7 @@ Error LLVMOutputStyle::dumpStreamData() {
|
|||
auto S = MappedBlockStream::createIndexedStream(DumpStreamNum, File);
|
||||
if (!S)
|
||||
return S.takeError();
|
||||
codeview::StreamReader R(**S);
|
||||
StreamReader R(**S);
|
||||
while (R.bytesRemaining() > 0) {
|
||||
ArrayRef<uint8_t> Data;
|
||||
uint32_t BytesToReadInBlock = std::min(
|
||||
|
@ -313,7 +316,7 @@ Error LLVMOutputStyle::dumpNamedStream() {
|
|||
MappedBlockStream::createIndexedStream(NameStreamIndex, File);
|
||||
if (!NameStream)
|
||||
return NameStream.takeError();
|
||||
codeview::StreamReader Reader(**NameStream);
|
||||
StreamReader Reader(**NameStream);
|
||||
|
||||
NameHashTable NameTable;
|
||||
if (auto EC = NameTable.load(Reader))
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::yaml;
|
||||
using namespace llvm::pdb;
|
||||
using namespace llvm::pdb::yaml;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include "OutputStyle.h"
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/PDB/PDBTypes.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
|
@ -91,8 +91,8 @@ template <> struct MappingTraits<pdb::yaml::MsfHeaders> {
|
|||
static void mapping(IO &IO, pdb::yaml::MsfHeaders &Obj);
|
||||
};
|
||||
|
||||
template <> struct MappingTraits<pdb::msf::SuperBlock> {
|
||||
static void mapping(IO &IO, pdb::msf::SuperBlock &SB);
|
||||
template <> struct MappingTraits<msf::SuperBlock> {
|
||||
static void mapping(IO &IO, msf::SuperBlock &SB);
|
||||
};
|
||||
|
||||
template <> struct MappingTraits<pdb::yaml::StreamBlockList> {
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Config/config.h"
|
||||
#include "llvm/DebugInfo/CodeView/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfBuilder.h"
|
||||
#include "llvm/DebugInfo/PDB/GenericError.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
|
||||
|
@ -65,6 +66,7 @@
|
|||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
|
|||
Object
|
||||
Support
|
||||
DebugInfoCodeView
|
||||
DebugInfoMsf
|
||||
)
|
||||
|
||||
add_llvm_tool(llvm-readobj
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/DebugInfo/CodeView/ByteStream.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/Line.h"
|
||||
#include "llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h"
|
||||
|
@ -34,6 +33,7 @@
|
|||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/Object/COFF.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
|
@ -53,6 +53,7 @@
|
|||
using namespace llvm;
|
||||
using namespace llvm::object;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::msf;
|
||||
using namespace llvm::support;
|
||||
using namespace llvm::Win64EH;
|
||||
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
type = Tool
|
||||
name = llvm-readobj
|
||||
parent = Tools
|
||||
required_libraries = all-targets BitReader Object
|
||||
required_libraries = all-targets BitReader Object DebugInfoCodeView DebugInfoMsf
|
||||
|
|
|
@ -9,28 +9,27 @@
|
|||
|
||||
#include "ErrorChecking.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/ByteStream.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamReader.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/StreamWriter.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IPDBFile.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IPDBStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/ByteStream.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfFile.h"
|
||||
#include "llvm/DebugInfo/Msf/IMsfStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/IndexedStreamData.h"
|
||||
#include "llvm/DebugInfo/Msf/MappedBlockStream.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamReader.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamRef.h"
|
||||
#include "llvm/DebugInfo/Msf/StreamWriter.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
using namespace llvm::pdb;
|
||||
using namespace llvm::msf;
|
||||
|
||||
namespace {
|
||||
|
||||
static const uint32_t BlocksAry[] = {0, 1, 2, 5, 4, 3, 6, 7, 8, 9};
|
||||
static uint8_t DataAry[] = {'A', 'B', 'C', 'F', 'E', 'D', 'G', 'H', 'I', 'J'};
|
||||
|
||||
class DiscontiguousFile : public IPDBFile {
|
||||
class DiscontiguousFile : public IMsfFile {
|
||||
public:
|
||||
DiscontiguousFile(ArrayRef<uint32_t> Blocks, MutableArrayRef<uint8_t> Data)
|
||||
: Blocks(Blocks.begin(), Blocks.end()), Data(Data.begin(), Data.end()) {}
|
||||
|
@ -55,9 +54,9 @@ public:
|
|||
Error setBlockData(uint32_t BlockIndex, uint32_t Offset,
|
||||
ArrayRef<uint8_t> SrcData) const override {
|
||||
if (BlockIndex >= Blocks.size())
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
if (Offset > getBlockSize() - SrcData.size())
|
||||
return make_error<CodeViewError>(cv_error_code::insufficient_buffer);
|
||||
return make_error<MsfError>(msf_error_code::insufficient_buffer);
|
||||
::memcpy(&Data[BlockIndex] + Offset, SrcData.data(), SrcData.size());
|
||||
return Error::success();
|
||||
}
|
||||
|
@ -69,8 +68,8 @@ private:
|
|||
|
||||
class MappedBlockStreamImpl : public MappedBlockStream {
|
||||
public:
|
||||
MappedBlockStreamImpl(std::unique_ptr<IPDBStreamData> Data,
|
||||
const IPDBFile &File)
|
||||
MappedBlockStreamImpl(std::unique_ptr<IMsfStreamData> Data,
|
||||
const IMsfFile &File)
|
||||
: MappedBlockStream(std::move(Data), File) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -9,14 +9,13 @@
|
|||
|
||||
#include "ErrorChecking.h"
|
||||
|
||||
#include "llvm/DebugInfo/PDB/Raw/MsfBuilder.h"
|
||||
#include "llvm/DebugInfo/PDB/Raw/MsfCommon.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfBuilder.h"
|
||||
#include "llvm/DebugInfo/Msf/MsfCommon.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace llvm;
|
||||
using namespace llvm::pdb;
|
||||
using namespace llvm::pdb::msf;
|
||||
using namespace llvm::msf;
|
||||
|
||||
namespace {
|
||||
class MsfBuilderTest : public testing::Test {
|
||||
|
|
Loading…
Reference in New Issue