]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* valprint.c: Include "exceptions.h".
authorDaniel Jacobowitz <drow@false.org>
Mon, 15 May 2006 16:53:38 +0000 (16:53 +0000)
committerDaniel Jacobowitz <drow@false.org>
Mon, 15 May 2006 16:53:38 +0000 (16:53 +0000)
(val_print): If something goes wrong while printing, supply an
error message.

gdb/ChangeLog
gdb/Makefile.in
gdb/valprint.c

index fce57b44e4ab34c29c0fab7cb5b1c8b4ec96661a..5770bf1b36d7adf23227c59e31b227b75d105000 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-15  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * valprint.c: Include "exceptions.h".
+       (val_print): If something goes wrong while printing, supply an
+       error message.
+
 2006-05-15  Peter O'Gorman  <gdb-patches@mlists.thewrittenword.com>
 
        * source.c (get_current_source_symtab_and_line)
index e8cd87ada60d3ca2834320b327c88d0db151bfa4..ab251487a4751f85bb6caac4c0ab99f621268636 100644 (file)
@@ -2773,7 +2773,8 @@ valops.o: valops.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(value_h) $(frame_h) \
        $(cp_support_h) $(observer_h)
 valprint.o: valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(value_h) $(gdbcore_h) $(gdbcmd_h) $(target_h) $(language_h) \
-       $(annotate_h) $(valprint_h) $(floatformat_h) $(doublest_h)
+       $(annotate_h) $(valprint_h) $(floatformat_h) $(doublest_h) \
+       $(exceptions_h)
 value.o: value.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \
        $(value_h) $(gdbcore_h) $(command_h) $(gdbcmd_h) $(target_h) \
        $(language_h) $(scm_lang_h) $(demangle_h) $(doublest_h) \
index b3a411a1f08158f2967ff5880319b6913ffc4065..d730917a08dae72c651192807214219da16248b6 100644 (file)
@@ -34,6 +34,7 @@
 #include "valprint.h"
 #include "floatformat.h"
 #include "doublest.h"
+#include "exceptions.h"
 
 #include <errno.h>
 
@@ -205,6 +206,9 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
           CORE_ADDR address, struct ui_file *stream, int format,
           int deref_ref, int recurse, enum val_prettyprint pretty)
 {
+  volatile struct gdb_exception except;
+  int ret = 0;
+
   struct type *real_type = check_typedef (type);
   if (pretty == Val_pretty_default)
     {
@@ -224,8 +228,15 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       return (0);
     }
 
-  return (LA_VAL_PRINT (type, valaddr, embedded_offset, address,
-                       stream, format, deref_ref, recurse, pretty));
+  TRY_CATCH (except, RETURN_MASK_ERROR)
+    {
+      ret = LA_VAL_PRINT (type, valaddr, embedded_offset, address,
+                         stream, format, deref_ref, recurse, pretty);
+    }
+  if (except.reason < 0)
+    fprintf_filtered (stream, _("<error reading variable>"));
+
+  return ret;
 }
 
 /* Check whether the value VAL is printable.  Return 1 if it is;