aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-05-30 17:13:33 +0000
committerZachary Turner <zturner@google.com>2017-05-30 17:13:33 +0000
commit591312c5c1a133949285dde012d8cf373ab31b12 (patch)
tree018149cd6fdc99281c57823add5f228604dbaa93 /llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp
parent5fd588be34ce1fe53e88590c8a8781ec973f45a0 (diff)
downloadllvm-591312c5c1a133949285dde012d8cf373ab31b12.zip
llvm-591312c5c1a133949285dde012d8cf373ab31b12.tar.gz
llvm-591312c5c1a133949285dde012d8cf373ab31b12.tar.bz2
[CodeView] Add more DebugSubsection implementations.
This adds implementations for Symbols and FrameData, and renames the existing codeview::StringTable class to conform to the DebugSectionStringTable convention. llvm-svn: 304222
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp')
-rw-r--r--llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp
new file mode 100644
index 0000000..fd558aa
--- /dev/null
+++ b/llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp
@@ -0,0 +1,44 @@
+//===- DebugFrameDataSubsection.cpp -----------------------------*- 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/CodeView/DebugFrameDataSubsection.h"
+#include "llvm/DebugInfo/CodeView/CodeViewError.h"
+
+using namespace llvm;
+using namespace llvm::codeview;
+
+Error DebugFrameDataSubsectionRef::initialize(BinaryStreamReader Reader) {
+ if (auto EC = Reader.readObject(RelocPtr))
+ return EC;
+ if (Reader.bytesRemaining() % sizeof(FrameData) != 0)
+ return make_error<CodeViewError>(cv_error_code::corrupt_record,
+ "Invalid frame data record format!");
+
+ uint32_t Count = Reader.bytesRemaining() / sizeof(FrameData);
+ if (auto EC = Reader.readArray(Frames, Count))
+ return EC;
+ return Error::success();
+}
+
+uint32_t DebugFrameDataSubsection::calculateSerializedSize() const {
+ return 4 + sizeof(FrameData) * Frames.size();
+}
+
+Error DebugFrameDataSubsection::commit(BinaryStreamWriter &Writer) const {
+ if (auto EC = Writer.writeInteger<uint32_t>(0))
+ return EC;
+
+ if (auto EC = Writer.writeArray(makeArrayRef(Frames)))
+ return EC;
+ return Error::success();
+}
+
+void DebugFrameDataSubsection::addFrameData(const FrameData &Frame) {
+ Frames.push_back(Frame);
+}