[PDB] Write FPO Data to the PDB.
llvm-svn: 342003
This commit is contained in:
1 parent
697d6cb8ee
commit
42e7cc1b0f
12 files changed
+634
-26
No files matched your search
@@ -14,8 +14,11 @@ 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) {
|
||||
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!");
|
||||
@@ -26,15 +29,30 @@ Error DebugFrameDataSubsectionRef::initialize(BinaryStreamReader Reader) {
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Error DebugFrameDataSubsectionRef::initialize(BinaryStreamRef Section) {
|
||||
BinaryStreamReader Reader(Section);
|
||||
return initialize(Reader);
|
||||
}
|
||||
|
||||
uint32_t DebugFrameDataSubsection::calculateSerializedSize() const {
|
||||
return 4 + sizeof(FrameData) * Frames.size();
|
||||
uint32_t Size = sizeof(FrameData) * Frames.size();
|
||||
if (IncludeRelocPtr)
|
||||
Size += sizeof(uint32_t);
|
||||
return Size;
|
||||
}
|
||||
|
||||
Error DebugFrameDataSubsection::commit(BinaryStreamWriter &Writer) const {
|
||||
if (auto EC = Writer.writeInteger<uint32_t>(0))
|
||||
return EC;
|
||||
if (IncludeRelocPtr) {
|
||||
if (auto EC = Writer.writeInteger<uint32_t>(0))
|
||||
return EC;
|
||||
}
|
||||
|
||||
if (auto EC = Writer.writeArray(makeArrayRef(Frames)))
|
||||
std::vector<FrameData> SortedFrames(Frames.begin(), Frames.end());
|
||||
std::sort(SortedFrames.begin(), SortedFrames.end(),
|
||||
[](const FrameData &LHS, const FrameData &RHS) {
|
||||
return LHS.RvaStart < RHS.RvaStart;
|
||||
});
|
||||
if (auto EC = Writer.writeArray(makeArrayRef(SortedFrames)))
|
||||
return EC;
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user