Use XVS field type instead of doing a parallel lookup.
authorJoel Brobecker <brobecker@gnat.com>
Mon, 18 Jan 2010 10:26:02 +0000 (10:26 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Mon, 18 Jan 2010 10:26:02 +0000 (10:26 +0000)
        * ada-lang.c (ada_get_base_type): Follow the XVS field type
        if it is a reference type instead of doing a type lookup using
        the XVS field name.

gdb/ChangeLog
gdb/ada-lang.c

index 505b09736955c523b085d7916ec4db0d0d2844f7..2eb2297be1325e4e77db812a68dc7417bf9be7fe 100644 (file)
@@ -1,3 +1,10 @@
+2010-01-18  Joel Brobecker  <brobecker@adacore.com>
+
+       Use XVS field type instead of doing a parallel lookup.
+       * ada-lang.c (ada_get_base_type): Follow the XVS field type
+       if it is a reference type instead of doing a type lookup using
+       the XVS field name.
+
 2010-01-18  Joel Brobecker  <brobecker@adacore.com>
 
        Trust PAD types instead of using PAD___XVS.
index e63cf88074232c9524a9833860a18f99403b9c19..4f77600383b8c926fa5abefb0c96f9a44a5ecaec 100644 (file)
@@ -7788,11 +7788,20 @@ ada_get_base_type (struct type *raw_type)
       || TYPE_NFIELDS (real_type_namer) != 1)
     return raw_type;
 
-  raw_real_type = ada_find_any_type (TYPE_FIELD_NAME (real_type_namer, 0));
-  if (raw_real_type == NULL)
-    return raw_type;
-  else
-    return raw_real_type;
+  if (TYPE_CODE (TYPE_FIELD_TYPE (real_type_namer, 0)) != TYPE_CODE_REF)
+    {
+      /* This is an older encoding form where the base type needs to be
+        looked up by name.  We prefer the newer enconding because it is
+        more efficient.  */
+      raw_real_type = ada_find_any_type (TYPE_FIELD_NAME (real_type_namer, 0));
+      if (raw_real_type == NULL)
+       return raw_type;
+      else
+       return raw_real_type;
+    }
+
+  /* The field in our XVS type is a reference to the base type.  */
+  return TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (real_type_namer, 0));
 }
 
 /* The type of value designated by TYPE, with all aligners removed.  */
This page took 0.034021 seconds and 4 git commands to generate.