]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gdbtypes.c (make_reference_type): Preserve the type chain
authorJoel Brobecker <brobecker@gnat.com>
Thu, 17 May 2007 20:15:37 +0000 (20:15 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Thu, 17 May 2007 20:15:37 +0000 (20:15 +0000)
        and set the length of all the variants of the pointer type.

gdb/ChangeLog
gdb/gdbtypes.c

index 00656aa991ebd19bf2f2d42ee09c95f663dd8eee..884b3373f1088d28f6a9a72e6402b21e5db6c4ce 100644 (file)
@@ -1,3 +1,8 @@
+2007-05-17  Joel Brobecker  <brobecker@adacore.com>
+
+       * gdbtypes.c (make_reference_type): Preserve the type chain
+       and set the length of all the variants of the pointer type.
+
 2007-05-17  Joel Brobecker  <brobecker@adacore.com>
 
        * gdbtypes.c (make_pointer_type): Preserve the pointer type chain
index f43983a072aecc0b80ae44166c8eb944ddb31434..db4a85ab352a47de85a406f3bde59b115fda0285 100644 (file)
@@ -354,6 +354,7 @@ make_reference_type (struct type *type, struct type **typeptr)
 {
   struct type *ntype;  /* New type */
   struct objfile *objfile;
+  struct type *chain;
 
   ntype = TYPE_REFERENCE_TYPE (type);
 
@@ -379,7 +380,9 @@ make_reference_type (struct type *type, struct type **typeptr)
     {
       ntype = *typeptr;
       objfile = TYPE_OBJFILE (ntype);
+      chain = TYPE_CHAIN (ntype);
       smash_type (ntype);
+      TYPE_CHAIN (ntype) = chain;
       TYPE_OBJFILE (ntype) = objfile;
     }
 
@@ -395,6 +398,14 @@ make_reference_type (struct type *type, struct type **typeptr)
   if (!TYPE_REFERENCE_TYPE (type))     /* Remember it, if don't have one.  */
     TYPE_REFERENCE_TYPE (type) = ntype;
 
+  /* Update the length of all the other variants of this type.  */
+  chain = TYPE_CHAIN (ntype);
+  while (chain != ntype)
+    {
+      TYPE_LENGTH (chain) = TYPE_LENGTH (ntype);
+      chain = TYPE_CHAIN (chain);
+    }
+
   return ntype;
 }