diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1994-05-17 20:13:50 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1994-05-17 20:13:50 +0000 |
commit | 9c036bd836f66747ccd35f6a21a2758f0f2cb8fc (patch) | |
tree | 70899574fb9676d917fe7ce6b6a24f3ffca34ab5 /gdb | |
parent | ee8b83460016b61902117b463dfdd6d0323ce3ac (diff) | |
download | gdb-9c036bd836f66747ccd35f6a21a2758f0f2cb8fc.zip gdb-9c036bd836f66747ccd35f6a21a2758f0f2cb8fc.tar.gz gdb-9c036bd836f66747ccd35f6a21a2758f0f2cb8fc.tar.bz2 |
* 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/annotate.c | 13 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 11 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 2 | ||||
-rw-r--r-- | gdb/printcmd.c | 13 | ||||
-rw-r--r-- | gdb/utils.c | 10 |
6 files changed, 44 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 150258b..61af1ce 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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): diff --git a/gdb/annotate.c b/gdb/annotate.c index 73612aa..4276b84 100644 --- a/gdb/annotate.c +++ b/gdb/annotate.c @@ -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 () { diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 06bada5..b891237 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -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 diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index acd21c0..62fe1ab 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -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 diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 2060024..467b0ae 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -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. */ diff --git a/gdb/utils.c b/gdb/utils.c index 1956984..de02160 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -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); |