ValueLocation::SetTo() normally tries to resolve size and offset differences
versus the passed in base location. In the case of a union we don't want this behavior since all members start at offset 0. Fixes union values showing up incorrectly in various circumstances. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39797 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -691,7 +691,13 @@ DwarfCompoundType::_ResolveDataMemberLocation(DwarfType* memberType,
|
|||||||
if (fEntry->Tag() != DW_TAG_union_type)
|
if (fEntry->Tag() != DW_TAG_union_type)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
if (!location->SetTo(parentLocation, 0, memberType->ByteSize() * 8))
|
// since all members start at the same location, set up
|
||||||
|
// the location by hand since we don't want the size difference
|
||||||
|
// between the overall union and the member being
|
||||||
|
// factored into the assigned address.
|
||||||
|
ValuePieceLocation piece = parentLocation.PieceAt(0);
|
||||||
|
piece.SetSize(memberType->ByteSize());
|
||||||
|
if (!location->AddPiece(piece))
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user