[PATCH] D41734: [DebugInfo][PDB] Fix too many FPM blocks being written in some cases
Zachary Turner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 4 13:25:12 PST 2018
zturner added a comment.
No worries on the repro, I actually got one myself, and I now actually understand what's causing the problem.
Honestly the repro is trivial. All you need to do is edit `MappedBlockStreamTest.cpp` line 512 to look like this:
constexpr uint32_t NumFileBlocks = 4096 + 1;
And it will crash. No other number works except +1, so -1 doesn't work. But because of this I now think I know *why* it is crashing. At every stride there are **two** FPMs. So basically FPM0 starts at block 1 and has a new piece every 4096 blocks. FPM1 starts at block 2 and has a new piece every 4096 blocks. So this means FPM0 has a piece at 4097 and FPM1 has a piece at 4098. I think this is what's causing the problem. We create an MSF file that only has 4097 blocks *total*, and then we try to "initialize" the FPM page at block 4098.
I think the fix is probably as simple as
if (TotalFileBlocks - 1 % BlockSize == 0)
++TotalFileBlocks;
I'm playing around with this locally in the meantime.
Repository:
rL LLVM
https://reviews.llvm.org/D41734
More information about the llvm-commits
mailing list