summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-06-09 00:28:08 +0000
committerZachary Turner <zturner@google.com>2017-06-09 00:28:08 +0000
commitdeb391309c9861dcdc995b2c70c2d64189611c3b (patch)
tree10fcd1c2eaef9f3a7c3fc6ce3693cc5c756ea3db /llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
parent4fcdaa9423daa465a40bacfe21846276f96059bc (diff)
downloadbcm5719-llvm-deb391309c9861dcdc995b2c70c2d64189611c3b.tar.gz
bcm5719-llvm-deb391309c9861dcdc995b2c70c2d64189611c3b.zip
[CodeView] Support remaining debug subsection types
This adds support for Symbols, StringTable, and FrameData subsection types. Even though these subsections rarely if ever appear in a PDB file (they are usually in object files), there's no theoretical reason why they *couldn't* appear in a PDB. The real issue though is that in order to add support for dumping and writing them (which will be useful for object files), we need a way to test them. And since there is no support for reading and writing them to / from object files yet, making PDB support them is the best way to both add support for the underlying format and add support for tests at the same time. Later, when we go to add support for reading / writing them from object files, we'll need only minimal changes in the underlying read/write code. llvm-svn: 305037
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp')
-rw-r--r--llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
index 7b972a1a277..6e647c4b976 100644
--- a/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
+++ b/llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
@@ -24,7 +24,7 @@ Error DebugStringTableSubsectionRef::initialize(BinaryStreamRef Contents) {
return Error::success();
}
Error DebugStringTableSubsectionRef::initialize(BinaryStreamReader &Reader) {
- return Reader.readStreamRef(Stream, Reader.bytesRemaining());
+ return Reader.readStreamRef(Stream);
}
Expected<StringRef>
@@ -55,20 +55,19 @@ uint32_t DebugStringTableSubsection::calculateSerializedSize() const {
}
Error DebugStringTableSubsection::commit(BinaryStreamWriter &Writer) const {
- assert(Writer.bytesRemaining() == StringSize);
- uint32_t MaxOffset = 1;
+ uint32_t Begin = Writer.getOffset();
+ uint32_t End = Begin + StringSize;
for (auto &Pair : Strings) {
StringRef S = Pair.getKey();
- uint32_t Offset = Pair.getValue();
+ uint32_t Offset = Begin + Pair.getValue();
Writer.setOffset(Offset);
if (auto EC = Writer.writeCString(S))
return EC;
- MaxOffset = std::max<uint32_t>(MaxOffset, Offset + S.size() + 1);
+ assert(Writer.getOffset() <= End);
}
- Writer.setOffset(MaxOffset);
- assert(Writer.bytesRemaining() == 0);
+ Writer.setOffset(End);
return Error::success();
}
OpenPOWER on IntegriCloud