summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/test/tools/llvm-pdbdump/explain.test8
-rw-r--r--llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp18
2 files changed, 14 insertions, 12 deletions
diff --git a/llvm/test/tools/llvm-pdbdump/explain.test b/llvm/test/tools/llvm-pdbdump/explain.test
index 9926eb01e35..e65027bdabb 100644
--- a/llvm/test/tools/llvm-pdbdump/explain.test
+++ b/llvm/test/tools/llvm-pdbdump/explain.test
@@ -33,17 +33,17 @@
ZERO: Block:Offset = 0:0000.
ZERO-NEXT: Address is in block 0 (allocated).
-ZERO-NEXT: This corresponds to offset 0 of MSF super block,
+ZERO-NEXT: This corresponds to offset 0 of the MSF super block,
ZERO-NEXT: which is part of the MSF file magic.
FORTY: Block:Offset = 0:0028.
FORTY-NEXT: Address is in block 0 (allocated).
-FORTY-NEXT: This corresponds to offset 40 of MSF super block,
-FORTY-NEXT: which contains the number of bytes in the stream directory.
+FORTY-NEXT: This corresponds to offset 40 of the MSF super block,
+FORTY-NEXT: which contains the number of blocks in the file.
SIXTY: Block:Offset = 0:003C.
SIXTY-NEXT: Address is in block 0 (allocated).
-SIXTY-NEXT: This corresponds to offset 60 of MSF super block,
+SIXTY-NEXT: This corresponds to offset 60 of the MSF super block,
SIXTY-NEXT: which is outside the range of valid data for the super block.
FPM1: Block:Offset = 1:0000.
diff --git a/llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp b/llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp
index 48e8e1ee374..229cf9f9ffb 100644
--- a/llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp
+++ b/llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp
@@ -96,22 +96,24 @@ bool ExplainOutputStyle::explainBlockStatus() {
return !IsFree;
}
+#define endof(Class, Field) (offsetof(Class, Field) + sizeof(Class::Field))
+
void ExplainOutputStyle::explainSuperBlockOffset() {
- P.formatLine("This corresponds to offset {0} of MSF super block, ",
+ P.formatLine("This corresponds to offset {0} of the MSF super block, ",
OffsetInBlock);
- if (OffsetInBlock < sizeof(msf::Magic))
+ if (OffsetInBlock < endof(SuperBlock, MagicBytes))
P.printLine("which is part of the MSF file magic.");
- else if (OffsetInBlock < offsetof(SuperBlock, BlockSize))
+ else if (OffsetInBlock < endof(SuperBlock, BlockSize))
P.printLine("which contains the block size of the file.");
- else if (OffsetInBlock < offsetof(SuperBlock, FreeBlockMapBlock))
+ else if (OffsetInBlock < endof(SuperBlock, FreeBlockMapBlock))
P.printLine("which contains the index of the FPM block (e.g. 1 or 2).");
- else if (OffsetInBlock < offsetof(SuperBlock, NumBlocks))
+ else if (OffsetInBlock < endof(SuperBlock, NumBlocks))
P.printLine("which contains the number of blocks in the file.");
- else if (OffsetInBlock < offsetof(SuperBlock, NumDirectoryBytes))
+ else if (OffsetInBlock < endof(SuperBlock, NumDirectoryBytes))
P.printLine("which contains the number of bytes in the stream directory.");
- else if (OffsetInBlock < offsetof(SuperBlock, Unknown1))
+ else if (OffsetInBlock < endof(SuperBlock, Unknown1))
P.printLine("whose purpose is unknown.");
- else if (OffsetInBlock < offsetof(SuperBlock, BlockMapAddr))
+ else if (OffsetInBlock < endof(SuperBlock, BlockMapAddr))
P.printLine("which contains the file offset of the block map.");
else {
assert(OffsetInBlock > sizeof(SuperBlock));
OpenPOWER on IntegriCloud