diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
| commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
| tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /lib/DebugInfo/MSF/MSFCommon.cpp | |
| parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) | |
Notes
Diffstat (limited to 'lib/DebugInfo/MSF/MSFCommon.cpp')
| -rw-r--r-- | lib/DebugInfo/MSF/MSFCommon.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/DebugInfo/MSF/MSFCommon.cpp b/lib/DebugInfo/MSF/MSFCommon.cpp index 1facf5efb4bbb..d7e1dcf31a3a4 100644 --- a/lib/DebugInfo/MSF/MSFCommon.cpp +++ b/lib/DebugInfo/MSF/MSFCommon.cpp @@ -59,3 +59,27 @@ Error llvm::msf::validateSuperBlock(const SuperBlock &SB) { return Error::success(); } + +MSFStreamLayout llvm::msf::getFpmStreamLayout(const MSFLayout &Msf, + bool IncludeUnusedFpmData, + bool AltFpm) { + MSFStreamLayout FL; + uint32_t NumFpmIntervals = getNumFpmIntervals(Msf, IncludeUnusedFpmData); + support::ulittle32_t FpmBlock = Msf.SB->FreeBlockMapBlock; + assert(FpmBlock == 1 || FpmBlock == 2); + if (AltFpm) { + // If they requested the alternate FPM, then 2 becomes 1 and 1 becomes 2. + FpmBlock = 3U - FpmBlock; + } + for (uint32_t I = 0; I < NumFpmIntervals; ++I) { + FL.Blocks.push_back(FpmBlock); + FpmBlock += msf::getFpmIntervalLength(Msf); + } + + if (IncludeUnusedFpmData) + FL.Length = NumFpmIntervals * Msf.SB->BlockSize; + else + FL.Length = divideCeil(Msf.SB->NumBlocks, 8); + + return FL; +} |
