* utils.c (vfprintf_maybe_filtered, vfprintf_unfiltered): Call
authorJim Kingdon <jkingdon@engr.sgi.com>
Tue, 17 May 1994 20:13:50 +0000 (20:13 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Tue, 17 May 1994 20:13:50 +0000 (20:13 +0000)
fputs_unfiltered and exit directly, rather than fatal.  The latter
calls vfprintf_unfiltered!

* gdbtypes.h, gdbtypes.c (can_dereference): New function.
* value.h, printcmd.c (print_value_flags): Move from here...
* annotate.c: ...to here, and make it use can_dereference.

gdb/ChangeLog
gdb/annotate.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/printcmd.c
gdb/utils.c

index 150258b..61af1ce 100644 (file)
@@ -1,3 +1,13 @@
+Tue May 17 11:08:22 1994  Jim Kingdon  (kingdon@lioth.cygnus.com)
+
+       * utils.c (vfprintf_maybe_filtered, vfprintf_unfiltered): Call
+       fputs_unfiltered and exit directly, rather than fatal.  The latter
+       calls vfprintf_unfiltered!
+
+       * gdbtypes.h, gdbtypes.c (can_dereference): New function.
+       * value.h, printcmd.c (print_value_flags): Move from here...
+       * annotate.c: ...to here, and make it use can_dereference.
+
 Sat May 14 15:13:52 1994  Stan Shebs  (shebs@andros.cygnus.com)
 
        * inflow.c (job_control, attach_flag, generic_mourn_inferior):
index 73612aa..4276b84 100644 (file)
@@ -21,7 +21,20 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "annotate.h"
 #include "value.h"
 #include "target.h"
+#include "gdbtypes.h"
+\f
+static void print_value_flags PARAMS ((struct type *));
 
+static void
+print_value_flags (t)
+     struct type *t;
+{
+  if (can_dereference (t))
+    printf_filtered ("*");
+  else
+    printf_filtered ("-");
+}
+\f
 void
 breakpoints_changed ()
 {
index 06bada5..b891237 100644 (file)
@@ -1146,6 +1146,17 @@ lookup_fundamental_type (objfile, typeid)
   return (*typep);
 }
 
+int
+can_dereference (t)
+     struct type *t;
+{
+  /* FIXME: Should we return true for references as well as pointers?  */
+  return
+    (t != NULL
+     && TYPE_CODE (t) == TYPE_CODE_PTR
+     && TYPE_CODE (TYPE_TARGET_TYPE (t)) != TYPE_CODE_VOID);
+}
+
 #if MAINTENANCE_CMDS
 
 static void
index acd21c0..62fe1ab 100644 (file)
@@ -726,6 +726,8 @@ extern void recursive_dump_type PARAMS ((struct type *, int));
 extern void
 print_scalar_formatted PARAMS ((char *, struct type *, int, int, GDB_FILE *));
 
+extern int can_dereference PARAMS ((struct type *));
+
 #if MAINTENANCE_CMDS
 extern void maintenance_print_type PARAMS ((char *, int));
 #endif
index 2060024..467b0ae 100644 (file)
@@ -88,19 +88,6 @@ int current_display_number;
 
 int inspect_it = 0;
 
-void
-print_value_flags (t)
-     struct type *t;
-{
-  /* FIXME: Should we be printing * for references as well as pointers?  */
-  if (t != NULL
-      && TYPE_CODE (t) == TYPE_CODE_PTR
-      && TYPE_CODE (TYPE_TARGET_TYPE (t)) != TYPE_CODE_VOID)
-    printf_filtered ("*");
-  else
-    printf_filtered ("-");
-}
-
 struct display
 {
   /* Chain link to next auto-display item.  */
index 1956984..de02160 100644 (file)
@@ -1389,7 +1389,10 @@ vfprintf_maybe_filtered (stream, format, args, filter)
 
   vasprintf (&linebuffer, format, args);
   if (linebuffer == NULL)
-    fatal ("virtual memory exhausted.");
+    {
+      fputs_unfiltered ("\ngdb: virtual memory exhausted.\n", gdb_stderr);
+      exit (1);
+    }
   old_cleanups = make_cleanup (free, linebuffer);
   fputs_maybe_filtered (linebuffer, stream, filter);
   do_cleanups (old_cleanups);
@@ -1416,7 +1419,10 @@ vfprintf_unfiltered (stream, format, args)
 
   vasprintf (&linebuffer, format, args);
   if (linebuffer == NULL)
-    fatal ("virtual memory exhausted.");
+    {
+      fputs_unfiltered ("\ngdb: virtual memory exhausted.\n", gdb_stderr);
+      exit (1);
+    }
   old_cleanups = make_cleanup (free, linebuffer);
   fputs_unfiltered (linebuffer, stream);
   do_cleanups (old_cleanups);