From ee86786cdd9394af5814ada95f5093a13e33c83c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 May 2011 19:29:10 +0000 Subject: [PATCH] * cp-valprint.c (cp_print_value_fields): Catch errors from value_static_field. --- gdb/ChangeLog | 5 +++++ gdb/cp-valprint.c | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0e8a04f687a..5165b86685a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2011-05-17 Tom Tromey + + * cp-valprint.c (cp_print_value_fields): Catch errors from + value_static_field. + 2011-05-17 Tom Tromey * dwarf2read.c (dwarf2_get_die_type): Call diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 255e9ce2236..f8516d5e1c4 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -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, + _(""), + ex.message); + else if (v == NULL) val_print_optimized_out (stream); else cp_print_static_field (TYPE_FIELD_TYPE (type, i), -- 2.30.2