* cp-valprint.c (cp_print_value_fields): Catch errors from
authorTom Tromey <tromey@redhat.com>
Tue, 17 May 2011 19:29:10 +0000 (19:29 +0000)
committerTom Tromey <tromey@redhat.com>
Tue, 17 May 2011 19:29:10 +0000 (19:29 +0000)
value_static_field.

gdb/ChangeLog
gdb/cp-valprint.c

index 0e8a04f687aba435a7d42235bd83659424b1803b..5165b86685a1693d78afacb91996456fea93671d 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-17  Tom Tromey  <tromey@redhat.com>
+
+       * cp-valprint.c (cp_print_value_fields): Catch errors from
+       value_static_field.
+
 2011-05-17  Tom Tromey  <tromey@redhat.com>
 
        * dwarf2read.c (dwarf2_get_die_type): Call
index 255e9ce22361efade6caf9de6aa78f799a4d6121..f8516d5e1c41c1533cd092d5d639dfb4192224ca 100644 (file)
@@ -340,9 +340,19 @@ cp_print_value_fields (struct type *type, struct type *real_type,
                }
              else if (field_is_static (&TYPE_FIELD (type, i)))
                {
-                 struct value *v = value_static_field (type, i);
-
-                 if (v == NULL)
+                 volatile struct gdb_exception ex;
+                 struct value *v = NULL;
+
+                 TRY_CATCH (ex, RETURN_MASK_ERROR)
+                   {
+                     v = value_static_field (type, i);
+                   }
+
+                 if (ex.reason < 0)
+                   fprintf_filtered (stream,
+                                     _("<error reading variable: %s>"),
+                                     ex.message);
+                 else if (v == NULL)
                    val_print_optimized_out (stream);
                  else
                    cp_print_static_field (TYPE_FIELD_TYPE (type, i),