Print nonexisting/optimized out static fields gracefully.
[deliverable/binutils-gdb.git] / gdb / cp-valprint.c
index 1d7147cdd23e4cfb94efeca5532166e692d1193c..4b625d1c4ae57b56938ee72eb76c0c7fc10c91aa 100644 (file)
@@ -333,12 +333,9 @@ cp_print_value_fields (struct type *type, struct type *real_type,
                    fprintf_filtered (stream,
                                      _("<error reading variable: %s>"),
                                      ex.message);
-                 else if (v == NULL)
-                   val_print_optimized_out (NULL, stream);
-                 else
-                   cp_print_static_field (TYPE_FIELD_TYPE (type, i),
-                                          v, stream, recurse + 1,
-                                          options);
+                 cp_print_static_field (TYPE_FIELD_TYPE (type, i),
+                                        v, stream, recurse + 1,
+                                        options);
                }
              else if (i == vptr_fieldno && type == vptr_basetype)
                {
@@ -640,7 +637,13 @@ cp_print_static_field (struct type *type,
                       const struct value_print_options *options)
 {
   struct value_print_options opts;
-  
+
+  if (value_entirely_optimized_out (val))
+    {
+      val_print_optimized_out (val, stream);
+      return;
+    }
+
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
     {
       CORE_ADDR *first_dont_print;
This page took 0.02553 seconds and 4 git commands to generate.