Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp
Show First 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | void ExplainOutputStyle::explainPdbFpmBlockOffset() { | ||||
if (DescribedBlockStart > File.pdb().getBlockCount()) { | if (DescribedBlockStart > File.pdb().getBlockCount()) { | ||||
P.printLine("Address is in extraneous FPM space."); | P.printLine("Address is in extraneous FPM space."); | ||||
return; | return; | ||||
} | } | ||||
P.formatLine("Address describes the allocation status of blocks [{0},{1})", | P.formatLine("Address describes the allocation status of blocks [{0},{1})", | ||||
DescribedBlockStart, DescribedBlockStart + 8); | DescribedBlockStart, DescribedBlockStart + 8); | ||||
ArrayRef<uint8_t> Bytes; | ArrayRef<uint8_t> Bytes; | ||||
cantFail(File.pdb().getMsfBuffer().readBytes(FileOffset, 1, Bytes)); | llvm_cantFail(File.pdb().getMsfBuffer().readBytes(FileOffset, 1, Bytes)); | ||||
P.formatLine("Status = {0} (Note: 0 = allocated, 1 = free)", | P.formatLine("Status = {0} (Note: 0 = allocated, 1 = free)", | ||||
toBinaryString(Bytes[0])); | toBinaryString(Bytes[0])); | ||||
} | } | ||||
void ExplainOutputStyle::explainPdbBlockMapOffset() { | void ExplainOutputStyle::explainPdbBlockMapOffset() { | ||||
uint64_t BlockMapOffset = File.pdb().getBlockMapOffset(); | uint64_t BlockMapOffset = File.pdb().getBlockMapOffset(); | ||||
uint32_t OffsetInBlock = FileOffset - BlockMapOffset; | uint32_t OffsetInBlock = FileOffset - BlockMapOffset; | ||||
P.formatLine("Address is at offset {0} of the directory block list", | P.formatLine("Address is at offset {0} of the directory block list", | ||||
Show All 20 Lines | void ExplainOutputStyle::explainPdbStreamOffset(uint32_t Stream) { | ||||
const auto &Layout = File.pdb().getStreamLayout(Stream); | const auto &Layout = File.pdb().getStreamLayout(Stream); | ||||
uint32_t StreamOff = | uint32_t StreamOff = | ||||
getOffsetInStream(Layout.Blocks, FileOffset, File.pdb().getBlockSize()); | getOffsetInStream(Layout.Blocks, FileOffset, File.pdb().getBlockSize()); | ||||
P.formatLine("Address is at offset {0}/{1} of Stream {2} ({3}){4}.", | P.formatLine("Address is at offset {0}/{1} of Stream {2} ({3}){4}.", | ||||
StreamOff, Layout.Length, Stream, S.getLongName(), | StreamOff, Layout.Length, Stream, S.getLongName(), | ||||
(StreamOff > Layout.Length) ? " in unused space" : ""); | (StreamOff > Layout.Length) ? " in unused space" : ""); | ||||
switch (S.getPurpose()) { | switch (S.getPurpose()) { | ||||
case StreamPurpose::DBI: { | case StreamPurpose::DBI: { | ||||
DbiStream &Dbi = cantFail(File.pdb().getPDBDbiStream()); | DbiStream &Dbi = llvm_cantFail(File.pdb().getPDBDbiStream()); | ||||
explainStreamOffset(Dbi, StreamOff); | explainStreamOffset(Dbi, StreamOff); | ||||
break; | break; | ||||
} | } | ||||
case StreamPurpose::PDB: { | case StreamPurpose::PDB: { | ||||
InfoStream &Info = cantFail(File.pdb().getPDBInfoStream()); | InfoStream &Info = llvm_cantFail(File.pdb().getPDBInfoStream()); | ||||
explainStreamOffset(Info, StreamOff); | explainStreamOffset(Info, StreamOff); | ||||
break; | break; | ||||
} | } | ||||
case StreamPurpose::IPI: | case StreamPurpose::IPI: | ||||
case StreamPurpose::TPI: | case StreamPurpose::TPI: | ||||
case StreamPurpose::ModuleStream: | case StreamPurpose::ModuleStream: | ||||
case StreamPurpose::NamedStream: | case StreamPurpose::NamedStream: | ||||
default: | default: | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static void explainDbiModiSubstreamOffset(LinePrinter &P, DbiStream &Dbi, | static void explainDbiModiSubstreamOffset(LinePrinter &P, DbiStream &Dbi, | ||||
uint32_t Offset) { | uint32_t Offset) { | ||||
VarStreamArray<DbiModuleDescriptor> ModuleDescriptors; | VarStreamArray<DbiModuleDescriptor> ModuleDescriptors; | ||||
BinaryStreamRef ModiSubstreamData = Dbi.getModiSubstreamData().StreamData; | BinaryStreamRef ModiSubstreamData = Dbi.getModiSubstreamData().StreamData; | ||||
BinaryStreamReader Reader(ModiSubstreamData); | BinaryStreamReader Reader(ModiSubstreamData); | ||||
cantFail(Reader.readArray(ModuleDescriptors, ModiSubstreamData.getLength())); | llvm_cantFail(Reader.readArray(ModuleDescriptors, ModiSubstreamData.getLength())); | ||||
auto Prev = ModuleDescriptors.begin(); | auto Prev = ModuleDescriptors.begin(); | ||||
assert(Prev.offset() == 0); | assert(Prev.offset() == 0); | ||||
auto Current = Prev; | auto Current = Prev; | ||||
uint32_t Index = 0; | uint32_t Index = 0; | ||||
while (true) { | while (true) { | ||||
Prev = Current; | Prev = Current; | ||||
++Current; | ++Current; | ||||
if (Current == ModuleDescriptors.end() || Offset < Current.offset()) | if (Current == ModuleDescriptors.end() || Offset < Current.offset()) | ||||
▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines |