diff options
author | Zachary Turner <zturner@google.com> | 2018-03-23 18:43:39 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2018-03-23 18:43:39 +0000 |
commit | a6fb536e5b5c98d3ca46fbd7ea21893f633d21d8 (patch) | |
tree | 22feb2546ff1053532b77fcb19a75f1aeab58d00 /llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp | |
parent | 1a3f3a2d14946b41d176454a4f1843ef8e914a9e (diff) | |
download | bcm5719-llvm-a6fb536e5b5c98d3ca46fbd7ea21893f633d21d8.tar.gz bcm5719-llvm-a6fb536e5b5c98d3ca46fbd7ea21893f633d21d8.zip |
[PDB] Make our PDBs look more like MS PDBs.
When investigating bugs in PDB generation, the first step is
often to do the same link with link.exe and then compare PDBs.
But comparing PDBs is hard because two completely different byte
sequences can both be correct, so it hampers the investigation when
you also have to spend time figuring out not just which bytes are
different, but also if the difference is meaningful.
This patch fixes a couple of cases related to string table emission,
hash table emission, and the order in which we emit strings that
makes more of our bytes the same as the bytes generated by MS PDBs.
Differential Revision: https://reviews.llvm.org/D44810
llvm-svn: 328348
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp index c731b68625c..127868005de 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp @@ -86,6 +86,15 @@ Error DebugStringTableSubsection::commit(BinaryStreamWriter &Writer) const { uint32_t DebugStringTableSubsection::size() const { return StringToId.size(); } +std::vector<uint32_t> DebugStringTableSubsection::sortedIds() const { + std::vector<uint32_t> Result; + Result.reserve(IdToString.size()); + for (const auto &Entry : IdToString) + Result.push_back(Entry.first); + std::sort(Result.begin(), Result.end()); + return Result; +} + uint32_t DebugStringTableSubsection::getIdForString(StringRef S) const { auto Iter = StringToId.find(S); assert(Iter != StringToId.end()); |