2010-06-24 Phil Muldoon <pmuldoon@redhat.com>
authorPhil Muldoon <pmuldoon@redhat.com>
Fri, 25 Jun 2010 15:13:52 +0000 (15:13 +0000)
committerPhil Muldoon <pmuldoon@redhat.com>
Fri, 25 Jun 2010 15:13:52 +0000 (15:13 +0000)
* printcmd.c (print_variable_and_value): Print error message on
caught exception.

gdb/ChangeLog
gdb/printcmd.c

index 53c6145c7e2e5712561c9d2ce2278842bbc5bfa8..d99913c132d495a3f23a6ea52278093d43af561d 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-25  Phil Muldoon  <pmuldoon@redhat.com>
+
+       * printcmd.c (print_variable_and_value): Print error message on
+       caught exception.
+
 2010-06-25  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * dwarf2expr.h (struct dwarf_value_location): Use ULONGEST as type
index 430ccee91ac77c4e7c6b31c3c34ede89fcb536c8..5ffa099d87e6fe3cad4218ba89e1b7082feb3a3a 100644 (file)
@@ -1942,17 +1942,24 @@ print_variable_and_value (const char *name, struct symbol *var,
                          struct frame_info *frame,
                          struct ui_file *stream, int indent)
 {
-  struct value *val;
-  struct value_print_options opts;
+  volatile struct gdb_exception except;
 
   if (!name)
     name = SYMBOL_PRINT_NAME (var);
 
   fprintf_filtered (stream, "%s%s = ", n_spaces (2 * indent), name);
+  TRY_CATCH (except, RETURN_MASK_ERROR)
+    {
+      struct value *val;
+      struct value_print_options opts;
 
-  val = read_var_value (var, frame);
-  get_user_print_options (&opts);
-  common_val_print (val, stream, indent, &opts, current_language);
+      val = read_var_value (var, frame);
+      get_user_print_options (&opts);
+      common_val_print (val, stream, indent, &opts, current_language);
+    }
+  if (except.reason < 0)
+    fprintf_filtered(stream, "<error reading variable %s (%s)>", name,
+                    except.message);
   fprintf_filtered (stream, "\n");
 }