bryanpkc created this revision.
bryanpkc added a reviewer: uweigand.
bryanpkc added a subscriber: lldb-commits.
One of the cases handled by ValueObjectChild::UpdateValue() uses the entire
width of the parent's scalar value as the size of the child, and extracts the
child by calling Scalar::ExtractBitfield(). This seems valid but
APInt::trunc(), APInt::sext() and APInt::zext() assert that the bit field must
not have the same size as the parent scalar. Replacing those calls with
sextOrTrunc(), zextOrTrunc(), sextOrSelf() and zextOrSelf() fixes the assertion
failures.
http://reviews.llvm.org/D20355
Files:
source/Core/Scalar.cpp
Index: source/Core/Scalar.cpp
===================================================================
--- source/Core/Scalar.cpp
+++ source/Core/Scalar.cpp
@@ -2788,15 +2788,15 @@
case Scalar::e_slonglong:
case Scalar::e_sint128:
case Scalar::e_sint256:
- m_integer = m_integer.ashr(bit_offset).trunc(bit_size).sext(8 *
GetByteSize());
+ m_integer =
m_integer.ashr(bit_offset).sextOrTrunc(bit_size).sextOrSelf(8 * GetByteSize());
return true;
case Scalar::e_uint:
case Scalar::e_ulong:
case Scalar::e_ulonglong:
case Scalar::e_uint128:
case Scalar::e_uint256:
- m_integer = m_integer.lshr(bit_offset).trunc(bit_size).zext(8 *
GetByteSize());
+ m_integer =
m_integer.lshr(bit_offset).zextOrTrunc(bit_size).zextOrSelf(8 * GetByteSize());
return true;
}
return false;
Index: source/Core/Scalar.cpp
===================================================================
--- source/Core/Scalar.cpp
+++ source/Core/Scalar.cpp
@@ -2788,15 +2788,15 @@
case Scalar::e_slonglong:
case Scalar::e_sint128:
case Scalar::e_sint256:
- m_integer = m_integer.ashr(bit_offset).trunc(bit_size).sext(8 * GetByteSize());
+ m_integer = m_integer.ashr(bit_offset).sextOrTrunc(bit_size).sextOrSelf(8 * GetByteSize());
return true;
case Scalar::e_uint:
case Scalar::e_ulong:
case Scalar::e_ulonglong:
case Scalar::e_uint128:
case Scalar::e_uint256:
- m_integer = m_integer.lshr(bit_offset).trunc(bit_size).zext(8 * GetByteSize());
+ m_integer = m_integer.lshr(bit_offset).zextOrTrunc(bit_size).zextOrSelf(8 * GetByteSize());
return true;
}
return false;
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits