* gdb.base/jit-so.exp (one_jit_test): Remove spurious backslash.
[deliverable/binutils-gdb.git] / gdb / printcmd.c
index f3765955f60e745d33e7665b6da1601a77b469d9..ad6993e5ad08ad1d23b71b9806077090c9755d2b 100644 (file)
@@ -129,7 +129,7 @@ show_print_symbol_filename (struct ui_file *file, int from_tty,
 }
 
 /* Number of auto-display expression currently being displayed.
-   So that we can disable it if we get an error or a signal within it.
+   So that we can disable it if we get a signal within it.
    -1 when not doing one.  */
 
 int current_display_number;
@@ -1656,14 +1656,6 @@ undisplay_command (char *args, int from_tty)
   dont_repeat ();
 }
 
-/* Cleanup that just disables the current display.  */
-
-static void
-disable_current_display_cleanup (void *arg)
-{
-  disable_current_display ();
-}
-
 /* Display a single auto-display.  
    Do nothing if the display cannot be printed in the current context,
    or if the display is disabled.  */
@@ -1723,8 +1715,8 @@ do_one_display (struct display *d)
   if (!within_current_scope)
     return;
 
+  old_chain = make_cleanup_restore_integer (&current_display_number);
   current_display_number = d->number;
-  old_chain = make_cleanup (disable_current_display_cleanup, NULL);
 
   annotate_display_begin ();
   printf_filtered ("%d", d->number);
@@ -1732,8 +1724,7 @@ do_one_display (struct display *d)
   printf_filtered (": ");
   if (d->format.size)
     {
-      CORE_ADDR addr;
-      struct value *val;
+      volatile struct gdb_exception ex;
 
       annotate_display_format ();
 
@@ -1755,18 +1746,26 @@ do_one_display (struct display *d)
       else
        printf_filtered ("  ");
 
-      val = evaluate_expression (d->exp);
-      addr = value_as_address (val);
-      if (d->format.format == 'i')
-       addr = gdbarch_addr_bits_remove (d->exp->gdbarch, addr);
-
       annotate_display_value ();
 
-      do_examine (d->format, d->exp->gdbarch, addr);
+      TRY_CATCH (ex, RETURN_MASK_ERROR)
+        {
+         struct value *val;
+         CORE_ADDR addr;
+
+         val = evaluate_expression (d->exp);
+         addr = value_as_address (val);
+         if (d->format.format == 'i')
+           addr = gdbarch_addr_bits_remove (d->exp->gdbarch, addr);
+         do_examine (d->format, d->exp->gdbarch, addr);
+       }
+      if (ex.reason < 0)
+       fprintf_filtered (gdb_stdout, _("<error: %s>\n"), ex.message);
     }
   else
     {
       struct value_print_options opts;
+      volatile struct gdb_exception ex;
 
       annotate_display_format ();
 
@@ -1784,16 +1783,23 @@ do_one_display (struct display *d)
 
       get_formatted_print_options (&opts, d->format.format);
       opts.raw = d->format.raw;
-      print_formatted (evaluate_expression (d->exp),
-                      d->format.size, &opts, gdb_stdout);
+
+      TRY_CATCH (ex, RETURN_MASK_ERROR)
+        {
+         struct value *val;
+
+         val = evaluate_expression (d->exp);
+         print_formatted (val, d->format.size, &opts, gdb_stdout);
+       }
+      if (ex.reason < 0)
+       fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
       printf_filtered ("\n");
     }
 
   annotate_display_end ();
 
   gdb_flush (gdb_stdout);
-  discard_cleanups (old_chain);
-  current_display_number = -1;
+  do_cleanups (old_chain);
 }
 
 /* Display all of the values on the auto-display chain which can be
@@ -1970,6 +1976,7 @@ print_variable_and_value (const char *name, struct symbol *var,
 
       val = read_var_value (var, frame);
       get_user_print_options (&opts);
+      opts.deref_ref = 1;
       common_val_print (val, stream, indent, &opts, current_language);
     }
   if (except.reason < 0)
This page took 0.02415 seconds and 4 git commands to generate.