* 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.
This commit is contained in:
Jim Kingdon 1994-05-17 20:13:50 +00:00
parent ee8b834600
commit 9c036bd836
6 changed files with 44 additions and 15 deletions

View 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):

View 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"
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 ("-");
}
void
breakpoints_changed ()
{

View 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

View 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

View 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. */

View 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);