summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Raw
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-09-15 18:22:31 +0000
committerZachary Turner <zturner@google.com>2016-09-15 18:22:31 +0000
commitde9ba155115dc56c97e34bf1452bcfaf7b75a6ea (patch)
tree0dbb237f6c403a934c5b832fb839c42bc30a6986 /llvm/lib/DebugInfo/PDB/Raw
parentd93c4c013736fe8e7d3264ac056c55c3e7450e47 (diff)
downloadbcm5719-llvm-de9ba155115dc56c97e34bf1452bcfaf7b75a6ea.tar.gz
bcm5719-llvm-de9ba155115dc56c97e34bf1452bcfaf7b75a6ea.zip
[pdb] Write the IPI stream.
The IPI stream is structurally identical to the TPI stream, but it contains different record types. So we just re-use the TPI writing code. llvm-svn: 281638
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp24
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp13
2 files changed, 30 insertions, 7 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp b/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp
index 40e3c7901a9..165b03cf370 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/PDBFileBuilder.cpp
@@ -62,10 +62,16 @@ DbiStreamBuilder &PDBFileBuilder::getDbiBuilder() {
TpiStreamBuilder &PDBFileBuilder::getTpiBuilder() {
if (!Tpi)
- Tpi = llvm::make_unique<TpiStreamBuilder>(*Msf);
+ Tpi = llvm::make_unique<TpiStreamBuilder>(*Msf, StreamTPI);
return *Tpi;
}
+TpiStreamBuilder &PDBFileBuilder::getIpiBuilder() {
+ if (!Ipi)
+ Ipi = llvm::make_unique<TpiStreamBuilder>(*Msf, StreamIPI);
+ return *Ipi;
+}
+
Expected<msf::MSFLayout> PDBFileBuilder::finalizeMsfLayout() const {
if (Info) {
if (auto EC = Info->finalizeMsfLayout())
@@ -79,6 +85,10 @@ Expected<msf::MSFLayout> PDBFileBuilder::finalizeMsfLayout() const {
if (auto EC = Tpi->finalizeMsfLayout())
return std::move(EC);
}
+ if (Ipi) {
+ if (auto EC = Ipi->finalizeMsfLayout())
+ return std::move(EC);
+ }
return Msf->build();
}
@@ -113,6 +123,13 @@ PDBFileBuilder::build(std::unique_ptr<msf::WritableStream> PdbFileBuffer) {
File->Tpi = std::move(*ExpectedTpi);
}
+ if (Ipi) {
+ auto ExpectedIpi = Ipi->build(*File, *PdbFileBuffer);
+ if (!ExpectedIpi)
+ return ExpectedIpi.takeError();
+ File->Ipi = std::move(*ExpectedIpi);
+ }
+
if (File->Info && File->Dbi && File->Info->getAge() != File->Dbi->getAge())
return llvm::make_error<RawError>(
raw_error_code::corrupt_file,
@@ -166,5 +183,10 @@ Error PDBFileBuilder::commit(const msf::WritableStream &Buffer) {
return EC;
}
+ if (Ipi) {
+ if (auto EC = Ipi->commit(Layout, Buffer))
+ return EC;
+ }
+
return Buffer.commit();
} \ No newline at end of file
diff --git a/llvm/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp
index aa059387f6b..733efe882a2 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/TpiStreamBuilder.cpp
@@ -15,8 +15,9 @@ using namespace llvm::msf;
using namespace llvm::pdb;
using namespace llvm::support;
-TpiStreamBuilder::TpiStreamBuilder(MSFBuilder &Msf)
- : Msf(Msf), Allocator(Msf.getAllocator()), Header(nullptr) {}
+TpiStreamBuilder::TpiStreamBuilder(MSFBuilder &Msf, uint32_t StreamIdx)
+ : Msf(Msf), Allocator(Msf.getAllocator()), Header(nullptr), Idx(StreamIdx) {
+}
TpiStreamBuilder::~TpiStreamBuilder() {}
@@ -75,7 +76,7 @@ uint32_t TpiStreamBuilder::calculateHashBufferSize() const {
Error TpiStreamBuilder::finalizeMsfLayout() {
uint32_t Length = calculateSerializedLength();
- if (auto EC = Msf.setStreamSize(StreamTPI, Length))
+ if (auto EC = Msf.setStreamSize(Idx, Length))
return EC;
uint32_t HashBufferSize = calculateHashBufferSize();
@@ -106,8 +107,8 @@ TpiStreamBuilder::build(PDBFile &File, const msf::WritableStream &Buffer) {
if (auto EC = finalize())
return std::move(EC);
- auto StreamData = MappedBlockStream::createIndexedStream(File.getMsfLayout(),
- Buffer, StreamTPI);
+ auto StreamData =
+ MappedBlockStream::createIndexedStream(File.getMsfLayout(), Buffer, Idx);
auto Tpi = llvm::make_unique<TpiStream>(File, std::move(StreamData));
Tpi->Header = Header;
Tpi->TypeRecords = VarStreamArray<codeview::CVType>(TypeRecordStream);
@@ -126,7 +127,7 @@ Error TpiStreamBuilder::commit(const msf::MSFLayout &Layout,
return EC;
auto InfoS =
- WritableMappedBlockStream::createIndexedStream(Layout, Buffer, StreamTPI);
+ WritableMappedBlockStream::createIndexedStream(Layout, Buffer, Idx);
StreamWriter Writer(*InfoS);
if (auto EC = Writer.writeObject(*Header))
OpenPOWER on IntegriCloud