summaryrefslogtreecommitdiff
path: root/gdb/cp-valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-05-17 19:29:10 +0000
committerTom Tromey <tromey@redhat.com>2011-05-17 19:29:10 +0000
commitee86786cdd9394af5814ada95f5093a13e33c83c (patch)
tree2f4e7d975e72aa9a31019dcfbb7defd0f10c4ebf /gdb/cp-valprint.c
parent9ff3b74fdb6c74f814fa23abc12dbcb62bbb3028 (diff)
downloadbinutils-gdb-ee86786cdd9394af5814ada95f5093a13e33c83c.tar.gz
* cp-valprint.c (cp_print_value_fields): Catch errors from
value_static_field.
Diffstat (limited to 'gdb/cp-valprint.c')
-rw-r--r--gdb/cp-valprint.c16
1 files changed, 13 insertions, 3 deletions
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,
+ _("<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),