[llvm-pdbdump] Don't crash when displaying padding.

We have a lot of complicated logic to determine where padding
is in a record, and the debug info doesn't always provide enough
information to figure it out with laser precision.  In this case
we were putting the padding in the wrong place causing an
out of bounds access on a BitVector.

Right now we decide that any trailing padding of a child type
will be truncated during record layout, but this is only true
insofar as the class still is sized properly to end on an
alignment boundary, which the algorithm doesn't yet know about.

For now, just don't crash, even though we display padding twice
in this case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303946 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Zachary Turner 2017-05-26 00:15:15 +00:00
parent f9ebd6114b
commit 03783217a0

View File

@ -80,7 +80,8 @@ bool PrettyClassLayoutGraphicalDumper::start(const UDTLayoutBase &Layout) {
if (Item->getLayoutSize() > 0) {
uint32_t Prev = RelativeOffset + Item->getLayoutSize() - 1;
NextPaddingByte = UseMap.find_next_unset(Prev);
if (Prev < UseMap.size())
NextPaddingByte = UseMap.find_next_unset(Prev);
}
}