From a4943027ae8e5703640bb2a30372b99772a1e190 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 10 Dec 2010 01:02:04 +0000 Subject: [PATCH] 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 --- src/apps/debugger/debug_info/DwarfTypes.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/apps/debugger/debug_info/DwarfTypes.cpp b/src/apps/debugger/debug_info/DwarfTypes.cpp index dff27bb625..bda81c7a7f 100644 --- a/src/apps/debugger/debug_info/DwarfTypes.cpp +++ b/src/apps/debugger/debug_info/DwarfTypes.cpp @@ -691,7 +691,13 @@ DwarfCompoundType::_ResolveDataMemberLocation(DwarfType* memberType, if (fEntry->Tag() != DW_TAG_union_type) 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; break;