[haiku-commits] r39797 - haiku/trunk/src/apps/debugger/debug_info

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 10 Dec 2010 02:02:04 +0100 (CET)

Author: anevilyak
Date: 2010-12-10 02:02:04 +0100 (Fri, 10 Dec 2010)
New Revision: 39797
Changeset: http://dev.haiku-os.org/changeset/39797

Modified:
   haiku/trunk/src/apps/debugger/debug_info/DwarfTypes.cpp
Log:
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.



Modified: haiku/trunk/src/apps/debugger/debug_info/DwarfTypes.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/debug_info/DwarfTypes.cpp     2010-12-09 
23:56:22 UTC (rev 39796)
+++ haiku/trunk/src/apps/debugger/debug_info/DwarfTypes.cpp     2010-12-10 
01:02:04 UTC (rev 39797)
@@ -691,7 +691,13 @@
                        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;


Other related posts:

  • » [haiku-commits] r39797 - haiku/trunk/src/apps/debugger/debug_info - anevilyak