Skip to content

Commit 013ee58

Browse files
authored
Revert "Reapply "[PDB][llvm-pdbutil] Add DXContainer support for pdb2yaml and yaml2pdb"" (llvm#200588)
Reverts llvm#200413 Breaks build bots: https://lab.llvm.org/buildbot/#/builders/169/builds/23142 https://lab.llvm.org/buildbot/#/builders/25/builds/18082
1 parent b771021 commit 013ee58

13 files changed

Lines changed: 35 additions & 314 deletions

File tree

llvm/include/llvm/DebugInfo/PDB/Native/PDBFile.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
#include "llvm/DebugInfo/MSF/IMSFFile.h"
1313
#include "llvm/DebugInfo/MSF/MSFCommon.h"
14-
#include "llvm/Object/DXContainer.h"
1514
#include "llvm/Support/Allocator.h"
1615
#include "llvm/Support/BinaryStreamRef.h"
1716
#include "llvm/Support/Compiler.h"
@@ -106,7 +105,6 @@ class LLVM_ABI PDBFile : public msf::IMSFFile {
106105
Expected<SymbolStream &> getPDBSymbolStream();
107106
Expected<PDBStringTable &> getStringTable();
108107
Expected<InjectedSourceStream &> getInjectedSourceStream();
109-
Expected<object::DXContainer &> getDXContainerStream();
110108

111109
BumpPtrAllocator &getAllocator() { return Allocator; }
112110

@@ -135,7 +133,6 @@ class LLVM_ABI PDBFile : public msf::IMSFFile {
135133
std::unique_ptr<DbiStream> Dbi;
136134
std::unique_ptr<TpiStream> Tpi;
137135
std::unique_ptr<TpiStream> Ipi;
138-
std::unique_ptr<object::DXContainer> Dxc;
139136
std::unique_ptr<PublicsStream> Publics;
140137
std::unique_ptr<SymbolStream> Symbols;
141138
std::unique_ptr<msf::MappedBlockStream> DirectoryStream;

llvm/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class PDBFileBuilder {
5353
LLVM_ABI TpiStreamBuilder &getIpiBuilder();
5454
LLVM_ABI PDBStringTableBuilder &getStringTableBuilder();
5555
LLVM_ABI GSIStreamBuilder &getGsiBuilder();
56-
LLVM_ABI std::unique_ptr<SmallVector<char>> &getDXContainerData();
5756

5857
// If HashPDBContentsToGUID is true on the InfoStreamBuilder, Guid is filled
5958
// with the computed PDB GUID on return.
@@ -97,9 +96,8 @@ class PDBFileBuilder {
9796
std::unique_ptr<GSIStreamBuilder> Gsi;
9897
std::unique_ptr<TpiStreamBuilder> Tpi;
9998
std::unique_ptr<TpiStreamBuilder> Ipi;
100-
std::unique_ptr<SmallVector<char>> Dxc;
10199

102-
std::unique_ptr<PDBStringTableBuilder> Strings;
100+
PDBStringTableBuilder Strings;
103101
StringTableHashTraits InjectedSourceHashTraits;
104102
HashTable<SrcHeaderBlockEntry> InjectedSourceTable;
105103

llvm/include/llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class PDBStringTableBuilder;
3535
struct StringTableHashTraits {
3636
PDBStringTableBuilder *Table;
3737

38-
LLVM_ABI StringTableHashTraits() = default;
3938
LLVM_ABI explicit StringTableHashTraits(PDBStringTableBuilder &Table);
4039
LLVM_ABI uint32_t hashLookupKey(StringRef S) const;
4140
LLVM_ABI StringRef storageKeyToLookupKey(uint32_t Offset) const;

llvm/include/llvm/DebugInfo/PDB/Native/RawConstants.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ enum SpecialStream : uint32_t {
8080
StreamDBI = 3,
8181
StreamIPI = 4,
8282

83-
kSpecialStreamCount = 5,
84-
// Fixed index of DXContainer stream, but it's not one of the special
85-
// streams and is produced only by DirectX tools.
86-
StreamDXContainer = 5
83+
kSpecialStreamCount
8784
};
8885

8986
enum class DbgHeaderType : uint16_t {

llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -398,28 +398,6 @@ Expected<InjectedSourceStream &> PDBFile::getInjectedSourceStream() {
398398
return *InjectedSources;
399399
}
400400

401-
llvm::Expected<object::DXContainer &> PDBFile::getDXContainerStream() {
402-
if (!Dxc) {
403-
auto MBS = safelyCreateIndexedStream(StreamDXContainer);
404-
if (!MBS)
405-
return MBS.takeError();
406-
auto StreamSize = getStreamByteSize(StreamDXContainer);
407-
ArrayRef<uint8_t> StreamData;
408-
auto Error = MBS->get()->readBytes(0, StreamSize, StreamData);
409-
if (Error)
410-
return Error;
411-
412-
StringRef Ref(reinterpret_cast<const char *>(StreamData.data()),
413-
StreamSize);
414-
MemoryBufferRef MemBuf(Ref, "DXContainerStream");
415-
auto DXC = object::DXContainer::create(MemBuf);
416-
if (!DXC)
417-
return DXC.takeError();
418-
Dxc = std::make_unique<object::DXContainer>(std::move(*DXC));
419-
}
420-
return *Dxc;
421-
}
422-
423401
uint32_t PDBFile::getPointerSize() {
424402
auto DbiS = getPDBDbiStream();
425403
if (!DbiS)
@@ -473,9 +451,7 @@ bool PDBFile::hasPDBSymbolStream() {
473451
return DbiS->getSymRecordStreamIndex() < getNumStreams();
474452
}
475453

476-
bool PDBFile::hasPDBTpiStream() const {
477-
return StreamTPI < getNumStreams() && getStreamByteSize(StreamTPI) != 0;
478-
}
454+
bool PDBFile::hasPDBTpiStream() const { return StreamTPI < getNumStreams(); }
479455

480456
bool PDBFile::hasPDBStringTable() {
481457
auto IS = getPDBInfoStream();

llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp

Lines changed: 22 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class WritableBinaryStream;
4040
}
4141

4242
PDBFileBuilder::PDBFileBuilder(BumpPtrAllocator &Allocator)
43-
: Allocator(Allocator), InjectedSourceTable(2) {}
43+
: Allocator(Allocator), InjectedSourceHashTraits(Strings),
44+
InjectedSourceTable(2) {}
4445

4546
PDBFileBuilder::~PDBFileBuilder() = default;
4647

@@ -79,11 +80,7 @@ TpiStreamBuilder &PDBFileBuilder::getIpiBuilder() {
7980
}
8081

8182
PDBStringTableBuilder &PDBFileBuilder::getStringTableBuilder() {
82-
if (!Strings) {
83-
Strings = std::make_unique<PDBStringTableBuilder>();
84-
InjectedSourceHashTraits = StringTableHashTraits(*Strings);
85-
}
86-
return *Strings;
83+
return Strings;
8784
}
8885

8986
GSIStreamBuilder &PDBFileBuilder::getGsiBuilder() {
@@ -92,12 +89,6 @@ GSIStreamBuilder &PDBFileBuilder::getGsiBuilder() {
9289
return *Gsi;
9390
}
9491

95-
std::unique_ptr<SmallVector<char>> &PDBFileBuilder::getDXContainerData() {
96-
if (!Dxc)
97-
Dxc = std::make_unique<SmallVector<char>>();
98-
return Dxc;
99-
}
100-
10192
Expected<uint32_t> PDBFileBuilder::allocateNamedStream(StringRef Name,
10293
uint32_t Size) {
10394
auto ExpectedStream = Msf->addStream(Size);
@@ -149,14 +140,11 @@ Error PDBFileBuilder::finalizeMsfLayout() {
149140
Info.addFeature(PdbRaw_FeatureSig::VC140);
150141
}
151142

152-
if (Dxc) {
153-
if (auto EC = Msf->setStreamSize(StreamDXContainer, Dxc->size()))
154-
return EC;
155-
} else {
156-
Expected<uint32_t> SN = allocateNamedStream("/LinkInfo", 0);
157-
if (!SN)
158-
return SN.takeError();
159-
}
143+
uint32_t StringsLen = Strings.calculateSerializedSize();
144+
145+
Expected<uint32_t> SN = allocateNamedStream("/LinkInfo", 0);
146+
if (!SN)
147+
return SN.takeError();
160148

161149
if (Gsi) {
162150
if (auto EC = Gsi->finalizeMsfLayout())
@@ -175,12 +163,10 @@ Error PDBFileBuilder::finalizeMsfLayout() {
175163
if (auto EC = Dbi->finalizeMsfLayout())
176164
return EC;
177165
}
178-
if (Strings) {
179-
uint32_t StringsLen = Strings->calculateSerializedSize();
180-
Expected<uint32_t> SN = allocateNamedStream("/names", StringsLen);
181-
if (!SN)
182-
return SN.takeError();
183-
}
166+
SN = allocateNamedStream("/names", StringsLen);
167+
if (!SN)
168+
return SN.takeError();
169+
184170
if (Ipi) {
185171
if (auto EC = Ipi->finalizeMsfLayout())
186172
return EC;
@@ -217,8 +203,7 @@ Error PDBFileBuilder::finalizeMsfLayout() {
217203
uint32_t SrcHeaderBlockSize =
218204
sizeof(SrcHeaderBlockHeader) +
219205
InjectedSourceTable.calculateSerializedLength();
220-
Expected<uint32_t> SN =
221-
allocateNamedStream("/src/headerblock", SrcHeaderBlockSize);
206+
SN = allocateNamedStream("/src/headerblock", SrcHeaderBlockSize);
222207
if (!SN)
223208
return SN.takeError();
224209
for (const auto &IS : InjectedSources) {
@@ -297,17 +282,16 @@ Error PDBFileBuilder::commit(StringRef Filename, codeview::GUID *Guid) {
297282
return ExpectedMsfBuffer.takeError();
298283
FileBufferByteStream Buffer = std::move(*ExpectedMsfBuffer);
299284

300-
if (Strings) {
301-
auto ExpectedSN = getNamedStreamIndex("/names");
302-
if (!ExpectedSN)
303-
return ExpectedSN.takeError();
285+
auto ExpectedSN = getNamedStreamIndex("/names");
286+
if (!ExpectedSN)
287+
return ExpectedSN.takeError();
288+
289+
auto NS = WritableMappedBlockStream::createIndexedStream(
290+
Layout, Buffer, *ExpectedSN, Allocator);
291+
BinaryStreamWriter NSWriter(*NS);
292+
if (auto EC = Strings.commit(NSWriter))
293+
return EC;
304294

305-
auto NS = WritableMappedBlockStream::createIndexedStream(
306-
Layout, Buffer, *ExpectedSN, Allocator);
307-
BinaryStreamWriter NSWriter(*NS);
308-
if (auto EC = Strings->commit(NSWriter))
309-
return EC;
310-
}
311295
{
312296
llvm::TimeTraceScope timeScope("Named stream data");
313297
for (const auto &NSE : NamedStreamData) {
@@ -347,17 +331,6 @@ Error PDBFileBuilder::commit(StringRef Filename, codeview::GUID *Guid) {
347331
return EC;
348332
}
349333

350-
if (Dxc) {
351-
llvm::TimeTraceScope timeScope("DXContainer stream");
352-
auto DxcS = WritableMappedBlockStream::createIndexedStream(
353-
Layout, Buffer, StreamDXContainer, Allocator);
354-
BinaryStreamWriter Writer(*DxcS);
355-
llvm::ArrayRef<uint8_t> DataRef(reinterpret_cast<uint8_t *>(Dxc->data()),
356-
Dxc->size());
357-
if (auto EC = Writer.writeBytes(DataRef))
358-
return EC;
359-
}
360-
361334
auto InfoStreamBlocks = Layout.StreamMap[StreamPDB];
362335
assert(!InfoStreamBlocks.empty());
363336
uint64_t InfoStreamFileOffset =

llvm/test/tools/llvm-pdbutil/dxcontainer.test

Lines changed: 0 additions & 143 deletions
This file was deleted.

llvm/tools/llvm-pdbutil/PdbYaml.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ void MappingTraits<PdbObject>::mapping(IO &IO, PdbObject &Obj) {
112112
IO.mapOptional("TpiStream", Obj.TpiStream);
113113
IO.mapOptional("IpiStream", Obj.IpiStream);
114114
IO.mapOptional("PublicsStream", Obj.PublicsStream);
115-
IO.mapOptional("DXContainerStream", Obj.DXContainerStream);
116115
}
117116

118117
void MappingTraits<MSFHeaders>::mapping(IO &IO, MSFHeaders &Obj) {
@@ -240,8 +239,3 @@ void MappingTraits<PdbDbiModuleInfo>::mapping(IO &IO, PdbDbiModuleInfo &Obj) {
240239
IO.mapOptional("Subsections", Obj.Subsections);
241240
IO.mapOptional("Modi", Obj.Modi);
242241
}
243-
244-
void MappingTraits<PdbDXContainerStream>::mapping(
245-
IO &IO, pdb::yaml::PdbDXContainerStream &Obj) {
246-
IO.mapRequired("DXContainer", Obj.DXC);
247-
}

0 commit comments

Comments
 (0)