ada_evaluate_subexp<OP_VAR_VALUE>: Avoid static fixing when possible.
authorJoel Brobecker <brobecker@adacore.com>
Thu, 14 Aug 2014 21:00:02 +0000 (14:00 -0700)
committerJoel Brobecker <brobecker@adacore.com>
Mon, 18 Aug 2014 15:10:39 +0000 (17:10 +0200)
Now that the OP_VAR_VALUE section of this function has been reorganized
a bit, we can fall-back on standard evaluation when static fixing is
not required. This patch does that, but being exclusive about when
static fixing has to be used, rather than doing it all the time when
noside is EVAL_AVOID_SIDE_EFFECTS.

This will pave the way for later when we want to evaluate entities
that have no GNAT encodings related to them but dynamic properties
instead. In that case, we expect the standard evaluation to resolve
those dynamic properties for us, even in no-side-effect mode.

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>:
        When noside is EVAL_AVOID_SIDE_EFFECTS, only return a statically
        fixed value for records and unions for which some GNAT encodings
        are present.

gdb/ChangeLog
gdb/ada-lang.c

index 23bc2149728a510efdb274199c20ac7dd7bdcb19..4ca5ea8b4819b84ba48c57f7ea54f0f1cb9561c8 100644 (file)
@@ -1,3 +1,10 @@
+2014-08-18  Joel Brobecker  <brobecker@adacore.com>
+
+       * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>:
+       When noside is EVAL_AVOID_SIDE_EFFECTS, only return a statically
+       fixed value for records and unions for which some GNAT encodings
+       are present.
+
 2014-08-18  Joel Brobecker  <brobecker@adacore.com>
 
        * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>: Slight code
index a9b5e6f2f80a95f7458a23f83b35908a67af925a..c4e85d20386b2feb9bb6a902cdf8a74c77b2ea78 100644 (file)
@@ -10185,8 +10185,22 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
                }
            }
 
-          *pos += 4;
-          return value_zero (to_static_fixed_type (type), not_lval);
+         /* Records and unions for which GNAT encodings have been
+            generated need to be statically fixed as well.
+            Otherwise, non-static fixing produces a type where
+            all dynamic properties are removed, which prevents "ptype"
+            from being able to completely describe the type.
+            For instance, a case statement in a variant record would be
+            replaced by the relevant components based on the actual
+            value of the discriminants.  */
+         if ((TYPE_CODE (type) == TYPE_CODE_STRUCT
+              && dynamic_template_type (type) != NULL)
+             || (TYPE_CODE (type) == TYPE_CODE_UNION
+                 && ada_find_parallel_type (type, "___XVU") != NULL))
+           {
+             *pos += 4;
+             return value_zero (to_static_fixed_type (type), not_lval);
+           }
         }
 
       arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside);
This page took 0.036814 seconds and 4 git commands to generate.