From d9fcf2fb1c12d48f657c974dc5b6898022bf9ccf Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Wed, 2 Feb 2000 00:21:19 +0000 Subject: [PATCH] import gdb-2000-02-01 snapshot --- gdb/ChangeLog | 32 ++ gdb/Makefile.in | 12 +- gdb/ax-gdb.c | 6 +- gdb/ax-general.c | 4 +- gdb/ax.h | 4 +- gdb/buildsym.c | 4 +- gdb/c-lang.c | 10 +- gdb/c-lang.h | 47 ++- gdb/c-typeprint.c | 38 +-- gdb/c-valprint.c | 6 +- gdb/ch-lang.c | 14 +- gdb/ch-lang.h | 18 +- gdb/ch-typeprint.c | 9 +- gdb/ch-valprint.c | 29 +- gdb/command.c | 16 +- gdb/command.h | 15 +- gdb/config/mn10300/tm-mn10300.h | 1 + gdb/config/pa/tm-hppa.h | 5 +- gdb/convex-tdep.c | 4 +- gdb/corefile.c | 6 +- gdb/cp-valprint.c | 34 ++- gdb/d10v-tdep.c | 4 +- gdb/d30v-tdep.c | 4 +- gdb/defs.h | 63 ++-- gdb/expprint.c | 18 +- gdb/expression.h | 16 +- gdb/f-lang.c | 20 +- gdb/f-lang.h | 12 +- gdb/f-typeprint.c | 30 +- gdb/f-valprint.c | 26 +- gdb/frame.h | 2 +- gdb/gdb-events.sh | 4 +- gdb/gdbcmd.h | 6 +- gdb/gdbtypes.h | 9 +- gdb/hppa-tdep.c | 13 +- gdb/jv-lang.c | 6 +- gdb/jv-lang.h | 18 +- gdb/jv-typeprint.c | 16 +- gdb/jv-valprint.c | 14 +- gdb/language.c | 38 ++- gdb/language.h | 24 +- gdb/m2-lang.c | 16 +- gdb/m2-lang.h | 13 +- gdb/m2-typeprint.c | 7 +- gdb/m2-valprint.c | 10 +- gdb/m3-nat.c | 4 +- gdb/main.c | 18 +- gdb/monitor.c | 5 +- gdb/printcmd.c | 31 +- gdb/pyr-tdep.c | 4 +- gdb/remote-mips.c | 6 +- gdb/remote-sim.c | 4 +- gdb/remote-udi.c | 4 +- gdb/remote.c | 31 +- gdb/scm-lang.c | 10 +- gdb/scm-lang.h | 35 ++- gdb/scm-valprint.c | 30 +- gdb/ser-e7kpc.c | 4 +- gdb/ser-go32.c | 6 +- gdb/ser-mac.c | 4 +- gdb/ser-ocd.c | 4 +- gdb/ser-unix.c | 8 +- gdb/ser-unix.h | 4 +- gdb/serial.c | 12 +- gdb/serial.h | 6 +- gdb/stack.c | 39 ++- gdb/symfile.c | 5 +- gdb/symmisc.c | 41 ++- gdb/tahoe-tdep.c | 6 +- gdb/target.c | 6 +- gdb/target.h | 4 +- gdb/top.c | 7 +- gdb/top.h | 5 +- gdb/tui/ChangeLog | 6 + gdb/tui/tui-file.c | 89 +++--- gdb/tui/tui-file.h | 12 +- gdb/tui/tuiDisassem.c | 6 +- gdb/tui/tuiIO.c | 4 +- gdb/tui/tuiIO.h | 2 +- gdb/tui/tuiRegs.c | 4 +- gdb/typeprint.c | 6 +- gdb/typeprint.h | 9 +- gdb/ui-file.c | 511 ++++++++++++++++++++++++++++++++ gdb/ui-file.h | 93 ++++++ gdb/utils.c | 81 +++-- gdb/v850ice.c | 4 +- gdb/valprint.c | 33 ++- gdb/valprint.h | 26 +- gdb/value.h | 53 ++-- 89 files changed, 1329 insertions(+), 656 deletions(-) create mode 100644 gdb/ui-file.c create mode 100644 gdb/ui-file.h diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dbe6edc2c06..00fd900fc81 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,35 @@ +2000-02-01 Elena Zannoni + + * remote.c (getpkt_sane): New function. It is the old getpkt(), + which now returns a timeout indication. + (getpkt): New function. Wrapper for getpkt_sane(), so that return + value can still be ignored. + +Tue Feb 1 00:17:12 2000 Andrew Cagney + + * ui-file.c, ui-file.h: Rename gdb-file.h, gdb-file.c. Rename + ``struct gdb_file'' to ``struct ui_file''. Delete typedef + GDB_FILE. + + * Makefile.in: Update. + + * ax-gdb.c, ax-general.c, ax.h, buildsym.c, c-lang.c, c-lang.h, + c-typeprint.c, c-valprint.c, ch-lang.c, ch-lang.h, ch-typeprint.c, + ch-valprint.c, command.c, command.h, convex-tdep.c, corefile.c, + cp-valprint.c, d10v-tdep.c, d30v-tdep.c, defs.h, expprint.c, + expression.h, f-lang.c, f-lang.h, f-typeprint.c, f-valprint.c, + frame.h, gdb-events.sh, gdb-file.c, gdb-file.h, gdbcmd.h, + gdbtypes.h, hppa-tdep.c, jv-lang.c, jv-lang.h, jv-typeprint.c, + jv-valprint.c, language.c, language.h, m2-lang.c, m2-lang.h, + m2-typeprint.c, m2-valprint.c, m3-nat.c, main.c, monitor.c, + printcmd.c, pyr-tdep.c, remote-mips.c, remote-sim.c, remote-udi.c, + remote.c, scm-lang.c, scm-lang.h, scm-valprint.c, ser-e7kpc.c, + ser-go32.c, ser-mac.c, ser-ocd.c, ser-unix.c, ser-unix.h, + serial.c, serial.h, stack.c, symfile.c, symmisc.c, tahoe-tdep.c, + target.c, target.h, top.c, top.h, typeprint.c, typeprint.h, + utils.c, v850ice.c, valprint.c, valprint.h, value.h, + config/pa/tm-hppa.h: Update. + 2000-01-31 Jason Molenda (jsm@bugshack.cygnus.com) * config/alpha/alpha-osf2.mh, config/alpha/alpha-osf3.mh, diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 9de1d830ca6..a97df49f9ff 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1,4 +1,4 @@ -# Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 +# Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 # Free Software Foundation, Inc. # This file is part of GDB. @@ -229,7 +229,7 @@ CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \ ADD_FILES = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) ADD_DEPS = $(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) -VERSION = 20000131 +VERSION = 20000201 DIST=gdb LINT=/usr/5bin/lint @@ -404,7 +404,7 @@ SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \ tui/tuiSource.h tui/tuiSourceWin.c tui/tuiSourceWin.h \ tui/tuiStack.c tui/tuiStack.h tui/tuiWin.c tui/tuiWin.h \ tui/tui-file.h tui/tui-file.c \ - gdb-file.h gdb-file.c + ui-file.h ui-file.c LINTFILES = $(SFILES) $(YYFILES) @CONFIG_SRCS@ init.c @@ -453,7 +453,7 @@ command_h = command.h gdbcmd_h = gdbcmd.h $(command_h) call_cmds_h = call-cmds.h -defs_h = defs.h xm.h tm.h nm.h config.status config.h gdbarch.h gdb-file.h +defs_h = defs.h xm.h tm.h nm.h config.status config.h gdbarch.h ui-file.h top_h = top.h inferior_h = inferior.h $(breakpoint_h) @@ -535,7 +535,7 @@ COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o stack.o thread.o \ c-typeprint.o ch-typeprint.o f-typeprint.o m2-typeprint.o \ c-valprint.o cp-valprint.o ch-valprint.o f-valprint.o m2-valprint.o \ nlmread.o serial.o mdebugread.o os9kread.o top.o utils.o \ - gdb-file.o tui-file.o + ui-file.o tui-file.o OBS = $(COMMON_OBS) $(ANNOTATE_OBS) @@ -1605,7 +1605,7 @@ stabsread.o: stabsread.c $(bfd_h) $(INCLUDE_DIR)/aout/stab.def \ stack.o: stack.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) $(inferior_h) \ language.h target.h gdb_string.h -gdb-file.o: gdb-file.c $(defs_h) gdb-file.h +ui-file.o: ui-file.c $(defs_h) ui-file.h tui-file.o: $(srcdir)/tui/tui-file.c $(defs_h) $(srcdir)/tui/tui-file.h $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-file.c diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 218dd6e7345..51fe5b6d54c 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -1,5 +1,5 @@ /* GDB-specific functions for operating on agent expressions - Copyright 1998 Free Software Foundation, Inc. + Copyright 1998, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -149,7 +149,7 @@ static void gen_expr PARAMS ((union exp_element ** pc, struct agent_expr * ax, struct axs_value * value)); -static void print_axs_value PARAMS ((GDB_FILE * f, struct axs_value * value)); +static void print_axs_value (struct ui_file *f, struct axs_value * value); static void agent_command PARAMS ((char *exp, int from_tty)); @@ -1879,7 +1879,7 @@ gen_trace_for_expr (scope, expr) static void print_axs_value (f, value) - GDB_FILE *f; + struct ui_file *f; struct axs_value *value; { switch (value->kind) diff --git a/gdb/ax-general.c b/gdb/ax-general.c index 6020ed7da1a..34ec3b3071e 100644 --- a/gdb/ax-general.c +++ b/gdb/ax-general.c @@ -1,5 +1,5 @@ /* Functions for manipulating expressions designed to be executed on the agent - Copyright 1998 Free Software Foundation, Inc. + Copyright 1998, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -350,7 +350,7 @@ struct aop_map aop_map[] = /* Disassemble the expression EXPR, writing to F. */ void ax_print (f, x) - GDB_FILE *f; + struct ui_file *f; struct agent_expr *x; { int i; diff --git a/gdb/ax.h b/gdb/ax.h index 0467626aeb2..bf1fd2c8622 100644 --- a/gdb/ax.h +++ b/gdb/ax.h @@ -1,5 +1,5 @@ /* Definitions for expressions designed to be executed on the agent - Copyright 1998 Free Software Foundation, Inc. + Copyright 1998, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -186,7 +186,7 @@ extern void ax_reg PARAMS ((struct agent_expr * EXPR, int REG)); things. */ /* Disassemble the expression EXPR, writing to F. */ -extern void ax_print PARAMS ((GDB_FILE * f, struct agent_expr * EXPR)); +extern void ax_print (struct ui_file *f, struct agent_expr * EXPR); /* An entry in the opcode map. */ struct aop_map diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 5668afc482d..867a5db7bcd 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1,5 +1,5 @@ /* Support routines for building symbol tables in GDB's internal format. - Copyright 1986-1999 Free Software Foundation, Inc. + Copyright 1986-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -492,7 +492,7 @@ make_blockvector (struct objfile *objfile) long. Possible solutions include a version of complain which takes a callback, a sprintf_address_numeric to match - print_address_numeric, or a way to set up a GDB_FILE + print_address_numeric, or a way to set up a UI_FILE which causes sprintf rather than fprintf to be called. */ diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 16046cf016a..35f86a89391 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -1,5 +1,5 @@ /* C language support routines for GDB, the GNU debugger. - Copyright 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -27,7 +27,7 @@ #include "c-lang.h" extern void _initialize_c_language PARAMS ((void)); -static void c_emit_char PARAMS ((int c, GDB_FILE * stream, int quoter)); +static void c_emit_char (int c, struct ui_file * stream, int quoter); /* Print the character C on STREAM as part of the contents of a literal string whose delimiter is QUOTER. Note that that format for printing @@ -36,7 +36,7 @@ static void c_emit_char PARAMS ((int c, GDB_FILE * stream, int quoter)); static void c_emit_char (c, stream, quoter) register int c; - GDB_FILE *stream; + struct ui_file *stream; int quoter; { c &= 0xFF; /* Avoid sign bit follies */ @@ -84,7 +84,7 @@ c_emit_char (c, stream, quoter) void c_printchar (c, stream) int c; - GDB_FILE *stream; + struct ui_file *stream; { fputc_filtered ('\'', stream); LA_EMIT_CHAR (c, stream, '\''); @@ -99,7 +99,7 @@ c_printchar (c, stream) void c_printstr (stream, string, length, width, force_ellipses) - GDB_FILE *stream; + struct ui_file *stream; char *string; unsigned int length; int width; diff --git a/gdb/c-lang.h b/gdb/c-lang.h index 62b5880b294..6cae708d3fd 100644 --- a/gdb/c-lang.h +++ b/gdb/c-lang.h @@ -1,5 +1,5 @@ /* C language support definitions for GDB, the GNU debugger. - Copyright 1992, 1996 Free Software Foundation, Inc. + Copyright 1992, 1996, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -31,23 +31,24 @@ c_parse PARAMS ((void)); /* Defined in c-exp.y */ extern void c_error PARAMS ((char *)); /* Defined in c-exp.y */ -extern void /* Defined in c-typeprint.c */ -c_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int)); +/* Defined in c-typeprint.c */ +extern void c_print_type (struct type *, char *, struct ui_file *, int, + int); -extern int -c_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, int, int, - int, enum val_prettyprint)); +extern int c_val_print (struct type *, char *, int, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); -extern int -c_value_print PARAMS ((struct value *, GDB_FILE *, int, enum val_prettyprint)); +extern int c_value_print (struct value *, struct ui_file *, int, + enum val_prettyprint); /* These are in c-lang.c: */ -extern void c_printchar PARAMS ((int, GDB_FILE *)); +extern void c_printchar (int, struct ui_file *); -extern void c_printstr PARAMS ((GDB_FILE * stream, char *string, - unsigned int length, int width, - int force_ellipses)); +extern void c_printstr (struct ui_file * stream, char *string, + unsigned int length, int width, + int force_ellipses); extern struct type *c_create_fundamental_type PARAMS ((struct objfile *, int)); @@ -55,11 +56,10 @@ extern struct type **CONST_PTR (c_builtin_types[]); /* These are in c-typeprint.c: */ -extern void -c_type_print_base PARAMS ((struct type *, GDB_FILE *, int, int)); +extern void c_type_print_base (struct type *, struct ui_file *, int, int); -extern void -c_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, int, int)); +extern void c_type_print_varspec_prefix (struct type *, struct ui_file *, + int, int); /* These are in cp-valprint.c */ @@ -67,16 +67,15 @@ extern int vtblprint; /* Controls printing of vtbl's */ extern int static_field_print; -extern void -cp_print_class_member PARAMS ((char *, struct type *, GDB_FILE *, char *)); +extern void cp_print_class_member (char *, struct type *, struct ui_file *, + char *); -extern void -cp_print_class_method PARAMS ((char *, struct type *, GDB_FILE *)); +extern void cp_print_class_method (char *, struct type *, struct ui_file *); -extern void -cp_print_value_fields PARAMS ((struct type *, struct type *, char *, int, CORE_ADDR, - GDB_FILE *, int, int, enum val_prettyprint, - struct type **, int)); +extern void cp_print_value_fields (struct type *, struct type *, char *, + int, CORE_ADDR, struct ui_file *, int, + int, enum val_prettyprint, + struct type **, int); extern int cp_is_vtbl_ptr_type PARAMS ((struct type *)); diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 90b626d8a95..bdcc61f0e43 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -1,5 +1,5 @@ /* Support for printing C and C++ types for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1998, 1999 + Copyright 1986, 1988, 1989, 1991, 1993-1996, 1998-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -42,19 +42,19 @@ /* Flag indicating target was compiled by HP compiler */ extern int hp_som_som_object_present; -static void cp_type_print_method_args PARAMS ((struct type ** args, char *prefix, char *varstring, int staticp, GDB_FILE * stream)); +static void cp_type_print_method_args (struct type ** args, char *prefix, + char *varstring, int staticp, + struct ui_file *stream); -static void -c_type_print_args PARAMS ((struct type *, GDB_FILE *)); +static void c_type_print_args (struct type *, struct ui_file *); -static void -cp_type_print_derivation_info PARAMS ((GDB_FILE *, struct type *)); +static void cp_type_print_derivation_info (struct ui_file *, struct type *); -void -c_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, int, int)); +void c_type_print_varspec_prefix (struct type *, struct ui_file *, int, + int); -static void -c_type_print_cv_qualifier PARAMS ((struct type *, GDB_FILE *, int, int)); +static void c_type_print_cv_qualifier (struct type *, struct ui_file *, + int, int); @@ -66,7 +66,7 @@ void c_typedef_print (type, new, stream) struct type *type; struct symbol *new; - GDB_FILE *stream; + struct ui_file *stream; { CHECK_TYPEDEF (type); switch (current_language->la_language) @@ -116,7 +116,7 @@ void c_print_type (type, varstring, stream, show, level) struct type *type; char *varstring; - GDB_FILE *stream; + struct ui_file *stream; int show; int level; { @@ -183,7 +183,7 @@ c_print_type (type, varstring, stream, show, level) static void cp_type_print_derivation_info (stream, type) - GDB_FILE *stream; + struct ui_file *stream; struct type *type; { char *name; @@ -212,7 +212,7 @@ cp_type_print_method_args (args, prefix, varstring, staticp, stream) char *prefix; char *varstring; int staticp; - GDB_FILE *stream; + struct ui_file *stream; { int i; @@ -258,7 +258,7 @@ cp_type_print_method_args (args, prefix, varstring, staticp, stream) void c_type_print_varspec_prefix (type, stream, show, passed_a_ptr) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; int show; int passed_a_ptr; { @@ -356,7 +356,7 @@ c_type_print_varspec_prefix (type, stream, show, passed_a_ptr) static void c_type_print_cv_qualifier (type, stream, need_pre_space, need_post_space) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; int need_pre_space; int need_post_space; { @@ -388,7 +388,7 @@ c_type_print_cv_qualifier (type, stream, need_pre_space, need_post_space) static void c_type_print_args (type, stream) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; { int i; struct type **args; @@ -440,7 +440,7 @@ c_type_print_args (type, stream) void c_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; int show; int passed_a_ptr; int demangled_args; @@ -563,7 +563,7 @@ c_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args) void c_type_print_base (type, stream, show, level) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; int show; int level; { diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index bc3666ab027..10bcda7eb87 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -1,5 +1,5 @@ /* Support for printing C values for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997 + Copyright 1986, 1988, 1989, 1991-1997, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -50,7 +50,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref, char *valaddr; int embedded_offset; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; @@ -453,7 +453,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref, int c_value_print (val, stream, format, pretty) value_ptr val; - GDB_FILE *stream; + struct ui_file *stream; int format; enum val_prettyprint pretty; { diff --git a/gdb/ch-lang.c b/gdb/ch-lang.c index c3a3d90719e..d56a2dcb201 100644 --- a/gdb/ch-lang.c +++ b/gdb/ch-lang.c @@ -1,5 +1,5 @@ /* Chill language support routines for GDB, the GNU debugger. - Copyright 1992, 1995, 1996 Free Software Foundation, Inc. + Copyright 1992, 1995, 1996, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -44,11 +44,11 @@ static value_ptr static struct type * chill_create_fundamental_type PARAMS ((struct objfile *, int)); -static void -chill_printstr PARAMS ((GDB_FILE * stream, char *string, unsigned int length, int width, int force_ellipses)); +static void chill_printstr (struct ui_file * stream, char *string, + unsigned int length, int width, + int force_ellipses); -static void -chill_printchar PARAMS ((int, GDB_FILE *)); +static void chill_printchar (int, struct ui_file *); /* For now, Chill uses a simple mangling algorithm whereby you simply discard everything after the occurance of two successive CPLUS_MARKER @@ -85,7 +85,7 @@ chill_demangle (mangled) static void chill_printchar (c, stream) register int c; - GDB_FILE *stream; + struct ui_file *stream; { c &= 0xFF; /* Avoid sign bit follies */ @@ -115,7 +115,7 @@ chill_printchar (c, stream) static void chill_printstr (stream, string, length, width, force_ellipses) - GDB_FILE *stream; + struct ui_file *stream; char *string; unsigned int length; int width; diff --git a/gdb/ch-lang.h b/gdb/ch-lang.h index 2957872323f..8df180422b7 100644 --- a/gdb/ch-lang.h +++ b/gdb/ch-lang.h @@ -1,5 +1,5 @@ /* Chill language support definitions for GDB, the GNU debugger. - Copyright 1992 Free Software Foundation, Inc. + Copyright 1992, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -27,16 +27,16 @@ chill_parse PARAMS ((void)); /* Defined in ch-exp.y */ extern void chill_error PARAMS ((char *)); /* Defined in ch-exp.y */ -extern void /* Defined in ch-typeprint.c */ -chill_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int)); +/* Defined in ch-typeprint.c */ +extern void chill_print_type (struct type *, char *, struct ui_file *, int, + int); -extern int -chill_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, int, int, - int, enum val_prettyprint)); +extern int chill_val_print (struct type *, char *, int, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); -extern int -chill_value_print PARAMS ((struct value *, GDB_FILE *, - int, enum val_prettyprint)); +extern int chill_value_print (struct value *, struct ui_file *, + int, enum val_prettyprint); extern LONGEST type_lower_upper PARAMS ((enum exp_opcode, struct type *, struct type **)); diff --git a/gdb/ch-typeprint.c b/gdb/ch-typeprint.c index b088ddea7f1..2a655abbf65 100644 --- a/gdb/ch-typeprint.c +++ b/gdb/ch-typeprint.c @@ -1,5 +1,5 @@ /* Support for printing Chill types for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc. + Copyright 1986, 1988, 1989, 1991, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -37,14 +37,13 @@ #include "gdb_string.h" #include -static void -chill_type_print_base PARAMS ((struct type *, GDB_FILE *, int, int)); +static void chill_type_print_base (struct type *, struct ui_file *, int, int); void chill_print_type (type, varstring, stream, show, level) struct type *type; char *varstring; - GDB_FILE *stream; + struct ui_file *stream; int show; int level; { @@ -71,7 +70,7 @@ chill_print_type (type, varstring, stream, show, level) static void chill_type_print_base (type, stream, show, level) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; int show; int level; { diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c index 77f9018d0d6..6fc3985a2c9 100644 --- a/gdb/ch-valprint.c +++ b/gdb/ch-valprint.c @@ -1,5 +1,5 @@ /* Support for printing Chill values for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994 + Copyright 1986, 1988, 1989, 1991-1994, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -33,16 +33,17 @@ #include "ch-lang.h" #include "annotate.h" -static void -chill_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int, - enum val_prettyprint, struct type **)); +static void chill_print_value_fields (struct type *, char *, + struct ui_file *, int, int, + enum val_prettyprint, struct type **); -static void -chill_print_type_scalar PARAMS ((struct type *, LONGEST, GDB_FILE *)); +static void chill_print_type_scalar (struct type *, LONGEST, + struct ui_file *); -static void -chill_val_print_array_elements PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *, - int, int, int, enum val_prettyprint)); +static void chill_val_print_array_elements (struct type *, char *, + CORE_ADDR, struct ui_file *, + int, int, int, + enum val_prettyprint); /* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM. @@ -55,7 +56,7 @@ static void chill_print_type_scalar (type, val, stream) struct type *type; LONGEST val; - GDB_FILE *stream; + struct ui_file *stream; { switch (TYPE_CODE (type)) { @@ -103,7 +104,7 @@ chill_val_print_array_elements (type, valaddr, address, stream, struct type *type; char *valaddr; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; @@ -204,7 +205,7 @@ chill_val_print (type, valaddr, embedded_offset, address, char *valaddr; int embedded_offset; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; @@ -517,7 +518,7 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty, dont_print) struct type *type; char *valaddr; - GDB_FILE *stream; + struct ui_file *stream; int format; int recurse; enum val_prettyprint pretty; @@ -587,7 +588,7 @@ chill_print_value_fields (type, valaddr, stream, format, recurse, pretty, int chill_value_print (val, stream, format, pretty) value_ptr val; - GDB_FILE *stream; + struct ui_file *stream; int format; enum val_prettyprint pretty; { diff --git a/gdb/command.c b/gdb/command.c index 94acb357da9..76c98e6a8eb 100644 --- a/gdb/command.c +++ b/gdb/command.c @@ -1,5 +1,5 @@ /* Handle lists of commands, their decoding and documentation, for GDB. - Copyright 1986, 1989, 1990, 1991, 1998 Free Software Foundation, Inc. + Copyright 1986, 1989, 1990, 1991, 1998, 2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ static void undef_cmd_error PARAMS ((char *, char *)); static void show_user PARAMS ((char *, int)); -static void show_user_1 PARAMS ((struct cmd_list_element *, GDB_FILE *)); +static void show_user_1 (struct cmd_list_element *, struct ui_file *); static void make_command PARAMS ((char *, int)); @@ -50,7 +50,7 @@ static void shell_escape PARAMS ((char *, int)); static int parse_binary_operation PARAMS ((char *)); -static void print_doc_line PARAMS ((GDB_FILE *, char *)); +static void print_doc_line (struct ui_file *, char *); static struct cmd_list_element *find_cmd PARAMS ((char *command, int len, @@ -388,7 +388,7 @@ delete_cmd (name, list) void help_cmd (command, stream) char *command; - GDB_FILE *stream; + struct ui_file *stream; { struct cmd_list_element *c; extern struct cmd_list_element *cmdlist; @@ -453,7 +453,7 @@ help_list (list, cmdtype, class, stream) struct cmd_list_element *list; char *cmdtype; enum command_class class; - GDB_FILE *stream; + struct ui_file *stream; { int len; char *cmdtype1, *cmdtype2; @@ -494,7 +494,7 @@ Command name abbreviations are allowed if unambiguous.\n", /* Print only the first line of STR on STREAM. */ static void print_doc_line (stream, str) - GDB_FILE *stream; + struct ui_file *stream; char *str; { static char *line_buffer = 0; @@ -545,7 +545,7 @@ help_cmd_list (list, class, prefix, recurse, stream) enum command_class class; char *prefix; int recurse; - GDB_FILE *stream; + struct ui_file *stream; { register struct cmd_list_element *c; @@ -1530,7 +1530,7 @@ make_command (arg, from_tty) static void show_user_1 (c, stream) struct cmd_list_element *c; - GDB_FILE *stream; + struct ui_file *stream; { register struct command_line *cmdlines; diff --git a/gdb/command.h b/gdb/command.h index 29484a561b3..fcff84533fa 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -1,5 +1,5 @@ /* Header file for command-reading library command.c. - Copyright (C) 1986, 1989, 1990 Free Software Foundation, Inc. + Copyright (C) 1986, 1989, 1990, 2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -230,16 +230,13 @@ extern char ** extern void delete_cmd PARAMS ((char *, struct cmd_list_element **)); -extern void -help_cmd PARAMS ((char *, GDB_FILE *)); +extern void help_cmd (char *, struct ui_file *); -extern void -help_list PARAMS ((struct cmd_list_element *, char *, enum command_class, - GDB_FILE *)); +extern void help_list (struct cmd_list_element *, char *, + enum command_class, struct ui_file *); -extern void -help_cmd_list PARAMS ((struct cmd_list_element *, enum command_class, char *, - int, GDB_FILE *)); +extern void help_cmd_list (struct cmd_list_element *, enum command_class, + char *, int, struct ui_file *); extern struct cmd_list_element * add_set_cmd PARAMS ((char *, enum command_class, var_types, char *, char *, diff --git a/gdb/config/mn10300/tm-mn10300.h b/gdb/config/mn10300/tm-mn10300.h index 7969679bac4..682df858947 100644 --- a/gdb/config/mn10300/tm-mn10300.h +++ b/gdb/config/mn10300/tm-mn10300.h @@ -51,6 +51,7 @@ extern char *mn10300_register_name PARAMS ((int regnr)); #define PSW_REGNUM 11 #define LIR_REGNUM 12 #define LAR_REGNUM 13 +#define E0_REGNUM 14 /* Pseudo register that contains true address of executing stack frame */ #define FP_REGNUM 31 diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index 94cb6ba9caa..a5a70646e10 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -1,6 +1,5 @@ /* Parameters for execution on any Hewlett-Packard PA-RISC machine. - Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1995, 1999 - Free Software Foundation, Inc. + Copyright 1986, 1987, 1989-1993, 1995, 1999, 2000 Free Software Foundation, Inc. Contributed by the Center for Software Science at the University of Utah (pa-gdb-bugs@cs.utah.edu). @@ -263,7 +262,7 @@ extern void pa_do_registers_info PARAMS ((int, int)); #if 0 #define STRCAT_REGISTER(regnum, fpregs, stream, precision) pa_do_strcat_registers_info (regnum, fpregs, stream, precision) -extern void pa_do_strcat_registers_info PARAMS ((int, int, GDB_FILE *, enum precision_type)); +extern void pa_do_strcat_registers_info (int, int, struct ui_file *, enum precision_type); #endif /* PA specific macro to see if the current instruction is nullified. */ diff --git a/gdb/convex-tdep.c b/gdb/convex-tdep.c index f37af52d8e4..a71def35a46 100644 --- a/gdb/convex-tdep.c +++ b/gdb/convex-tdep.c @@ -1,5 +1,5 @@ /* OBSOLETE /* Convex stuff for GDB. */ -/* OBSOLETE Copyright (C) 1990, 1991, 1996 Free Software Foundation, Inc. */ +/* OBSOLETE Copyright (C) 1990, 1991, 1996, 2000 Free Software Foundation, Inc. */ /* OBSOLETE */ /* OBSOLETE This file is part of GDB. */ /* OBSOLETE */ @@ -491,7 +491,7 @@ /* OBSOLETE If it looks like an address, print it in hex instead. *x/ */ /* OBSOLETE */ /* OBSOLETE decout (stream, type, val) */ -/* OBSOLETE GDB_FILE *stream; */ +/* OBSOLETE struct ui_file *stream; */ /* OBSOLETE struct type *type; */ /* OBSOLETE LONGEST val; */ /* OBSOLETE { */ diff --git a/gdb/corefile.c b/gdb/corefile.c index ea9ce8550d2..93e23743124 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -1,5 +1,5 @@ /* Core dump and executable file functions above target vector, for GDB. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994 + Copyright 1986, 1987, 1989, 1991-1994, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -236,8 +236,8 @@ memory_error (status, memaddr) int status; CORE_ADDR memaddr; { - struct gdb_file *tmp_stream = mem_fileopen (); - make_cleanup_gdb_file_delete (tmp_stream); + struct ui_file *tmp_stream = mem_fileopen (); + make_cleanup_ui_file_delete (tmp_stream); if (status == EIO) { diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 4ec0853d70e..b70ef219d6c 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -1,5 +1,5 @@ /* Support for printing C++ values for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1994, 1995, 1996 + Copyright 1986, 1988, 1989, 1991, 1994-1996, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -47,24 +47,26 @@ static struct obstack dont_print_statmem_obstack; extern void _initialize_cp_valprint PARAMS ((void)); -static void -cp_print_static_field PARAMS ((struct type *, value_ptr, GDB_FILE *, int, int, - enum val_prettyprint)); +static void cp_print_static_field (struct type *, value_ptr, + struct ui_file *, int, int, + enum val_prettyprint); -static void -cp_print_value PARAMS ((struct type *, struct type *, char *, int, CORE_ADDR, GDB_FILE *, - int, int, enum val_prettyprint, struct type **)); +static void cp_print_value (struct type *, struct type *, char *, int, + CORE_ADDR, struct ui_file *, int, int, + enum val_prettyprint, struct type **); -static void -cp_print_hpacc_virtual_table_entries PARAMS ((struct type *, int *, value_ptr, GDB_FILE *, - int, int, enum val_prettyprint)); +static void cp_print_hpacc_virtual_table_entries (struct type *, int *, + value_ptr, + struct ui_file *, int, + int, + enum val_prettyprint); void cp_print_class_method (valaddr, type, stream) char *valaddr; struct type *type; - GDB_FILE *stream; + struct ui_file *stream; { struct type *domain; struct fn_field *f = NULL; @@ -237,7 +239,7 @@ cp_print_value_fields (type, real_type, valaddr, offset, address, stream, format char *valaddr; int offset; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int recurse; enum val_prettyprint pretty; @@ -500,7 +502,7 @@ cp_print_value (type, real_type, valaddr, offset, address, stream, format, recur char *valaddr; int offset; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int recurse; enum val_prettyprint pretty; @@ -628,7 +630,7 @@ static void cp_print_static_field (type, val, stream, format, recurse, pretty) struct type *type; value_ptr val; - GDB_FILE *stream; + struct ui_file *stream; int format; int recurse; enum val_prettyprint pretty; @@ -669,7 +671,7 @@ void cp_print_class_member (valaddr, domain, stream, prefix) char *valaddr; struct type *domain; - GDB_FILE *stream; + struct ui_file *stream; char *prefix; { @@ -748,7 +750,7 @@ cp_print_hpacc_virtual_table_entries (type, vfuncs, v, stream, format, recurse, struct type *type; int *vfuncs; value_ptr v; - GDB_FILE *stream; + struct ui_file *stream; int format; int recurse; enum val_prettyprint pretty; diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 93e3c6e05a3..68afb8c7d88 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -1,5 +1,5 @@ /* Target-dependent code for Mitsubishi D10V, for GDB. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -1334,7 +1334,7 @@ trace_info (args, from_tty) static int print_insn (memaddr, stream) CORE_ADDR memaddr; - GDB_FILE *stream; + struct ui_file *stream; { /* If there's no disassembler, something is very wrong. */ if (tm_print_insn == NULL) diff --git a/gdb/d30v-tdep.c b/gdb/d30v-tdep.c index 00e0c025c92..94a1362b3fe 100644 --- a/gdb/d30v-tdep.c +++ b/gdb/d30v-tdep.c @@ -1,5 +1,5 @@ /* Target-dependent code for Mitsubishi D30V, for GDB. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -1183,7 +1183,7 @@ trace_info (args, from_tty) static int print_insn (memaddr, stream) CORE_ADDR memaddr; - GDB_FILE *stream; + struct ui_file *stream; { /* If there's no disassembler, something is very wrong. */ if (tm_print_insn == NULL) diff --git a/gdb/defs.h b/gdb/defs.h index 8a400984935..47e9dfec9e5 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -1,6 +1,6 @@ /* *INDENT-OFF* */ /* ATTR_FORMAT confuses indent, avoid running it for now */ /* Basic, host-specific, and target-specific definitions for GDB. - Copyright (C) 1986, 89, 91, 92, 93, 94, 95, 96, 98, 1999 + Copyright (C) 1986, 1989, 1991-1996, 1998-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -299,8 +299,8 @@ extern struct cleanup *make_cleanup (make_cleanup_func, void *); extern struct cleanup *make_cleanup_freeargv (char **); -struct gdb_file; -extern struct cleanup *make_cleanup_gdb_file_delete (struct gdb_file *); +struct ui_file; +extern struct cleanup *make_cleanup_ui_file_delete (struct ui_file *); extern struct cleanup *make_final_cleanup (make_cleanup_func, void *); @@ -359,23 +359,20 @@ extern void wrap_here (char *); extern void reinitialize_more_filter (void); -struct gdb_file; -typedef struct gdb_file GDB_FILE; /* deprecated */ - /* Normal results */ -extern GDB_FILE *gdb_stdout; +extern struct ui_file *gdb_stdout; /* Serious error notifications */ -extern GDB_FILE *gdb_stderr; +extern struct ui_file *gdb_stderr; /* Log/debug/trace messages that should bypass normal stdout/stderr filtering. For momement, always call this stream using *_unfiltered. In the very near future that restriction shall be removed - either call shall be unfiltered. (cagney 1999-06-13). */ -extern GDB_FILE *gdb_stdlog; +extern struct ui_file *gdb_stdlog; /* Target output that should bypass normal stdout/stderr filtering. For momement, always call this stream using *_unfiltered. In the very near future that restriction shall be removed - either call shall be unfiltered. (cagney 1999-07-02). */ -extern GDB_FILE *gdb_stdtarg; +extern struct ui_file *gdb_stdtarg; #if defined(TUI) #include "tui.h" @@ -386,17 +383,17 @@ extern GDB_FILE *gdb_stdtarg; #include "tuiWin.h" #endif -#include "gdb-file.h" +#include "ui-file.h" /* More generic printf like operations */ -extern void fputs_filtered (const char *, GDB_FILE *); +extern void fputs_filtered (const char *, struct ui_file *); -extern void fputs_unfiltered (const char *, GDB_FILE *); +extern void fputs_unfiltered (const char *, struct ui_file *); -extern int fputc_filtered (int c, GDB_FILE *); +extern int fputc_filtered (int c, struct ui_file *); -extern int fputc_unfiltered (int c, GDB_FILE *); +extern int fputc_unfiltered (int c, struct ui_file *); extern int putchar_unfiltered (int c); @@ -408,11 +405,11 @@ extern void puts_debug (char *prefix, char *string, char *suffix); extern void vprintf_filtered (const char *, va_list) ATTR_FORMAT (printf, 1, 0); -extern void vfprintf_filtered (GDB_FILE *, const char *, va_list) ATTR_FORMAT (printf, 2, 0); +extern void vfprintf_filtered (struct ui_file *, const char *, va_list) ATTR_FORMAT (printf, 2, 0); -extern void fprintf_filtered (GDB_FILE *, const char *, ...) ATTR_FORMAT (printf, 2, 3); +extern void fprintf_filtered (struct ui_file *, const char *, ...) ATTR_FORMAT (printf, 2, 3); -extern void fprintfi_filtered (int, GDB_FILE *, const char *, ...) ATTR_FORMAT (printf, 3, 4); +extern void fprintfi_filtered (int, struct ui_file *, const char *, ...) ATTR_FORMAT (printf, 3, 4); extern void printf_filtered (const char *, ...) ATTR_FORMAT (printf, 1, 2); @@ -420,26 +417,26 @@ extern void printfi_filtered (int, const char *, ...) ATTR_FORMAT (printf, 2, 3) extern void vprintf_unfiltered (const char *, va_list) ATTR_FORMAT (printf, 1, 0); -extern void vfprintf_unfiltered (GDB_FILE *, const char *, va_list) ATTR_FORMAT (printf, 2, 0); +extern void vfprintf_unfiltered (struct ui_file *, const char *, va_list) ATTR_FORMAT (printf, 2, 0); -extern void fprintf_unfiltered (GDB_FILE *, const char *, ...) ATTR_FORMAT (printf, 2, 3); +extern void fprintf_unfiltered (struct ui_file *, const char *, ...) ATTR_FORMAT (printf, 2, 3); extern void printf_unfiltered (const char *, ...) ATTR_FORMAT (printf, 1, 2); -extern void print_spaces (int, GDB_FILE *); +extern void print_spaces (int, struct ui_file *); -extern void print_spaces_filtered (int, GDB_FILE *); +extern void print_spaces_filtered (int, struct ui_file *); extern char *n_spaces (int); -extern void fputstr_filtered (const char *str, int quotr, GDB_FILE * stream); +extern void fputstr_filtered (const char *str, int quotr, struct ui_file * stream); -extern void fputstr_unfiltered (const char *str, int quotr, GDB_FILE * stream); +extern void fputstr_unfiltered (const char *str, int quotr, struct ui_file * stream); -extern void fputstrn_unfiltered (const char *str, int n, int quotr, GDB_FILE * stream); +extern void fputstrn_unfiltered (const char *str, int n, int quotr, struct ui_file * stream); /* Display the host ADDR on STREAM formatted as ``0x%x''. */ -extern void gdb_print_host_address (void *addr, struct gdb_file *stream); +extern void gdb_print_host_address (void *addr, struct ui_file *stream); /* Convert a CORE_ADDR into a HEX string. paddr() is like %08lx. paddr_nz() is like %lx. paddr_u() is like %lu. paddr_width() is @@ -454,7 +451,7 @@ typedef bfd_vma t_reg; extern char *preg (t_reg reg); extern char *preg_nz (t_reg reg); -extern void fprintf_symbol_filtered (GDB_FILE *, char *, +extern void fprintf_symbol_filtered (struct ui_file *, char *, enum language, int); extern NORETURN void perror_with_name (char *) ATTR_NORETURN; @@ -475,7 +472,7 @@ extern void symbol_file_command (char *, int); extern void generic_load (char *name, int from_tty); /* Summarise a download */ -extern void print_transfer_performance (struct gdb_file *stream, +extern void print_transfer_performance (struct ui_file *stream, unsigned long data_count, unsigned long write_count, unsigned long time_count); @@ -500,12 +497,12 @@ extern int info_verbose; extern void set_next_address (CORE_ADDR); -extern void print_address_symbolic (CORE_ADDR, GDB_FILE *, int, +extern void print_address_symbolic (CORE_ADDR, struct ui_file *, int, char *); -extern void print_address_numeric (CORE_ADDR, int, GDB_FILE *); +extern void print_address_numeric (CORE_ADDR, int, struct ui_file *); -extern void print_address (CORE_ADDR, GDB_FILE *); +extern void print_address (CORE_ADDR, struct ui_file *); /* From source.c */ @@ -784,7 +781,7 @@ extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN; /* DEPRECATED: Use error(), verror() or error_stream(). */ extern NORETURN void error_begin (void); -extern NORETURN void error_stream (GDB_FILE *) ATTR_NORETURN; +extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN; /* Returns a freshly allocate buffer containing the last error message. */ @@ -1136,7 +1133,7 @@ extern void (*print_frame_info_listing_hook) (struct symtab * s, extern struct frame_info *parse_frame_specification (char *frame_exp); extern int (*query_hook) (const char *, va_list); extern void (*warning_hook) (const char *, va_list); -extern void (*flush_hook) (GDB_FILE * stream); +extern void (*flush_hook) (struct ui_file * stream); extern void (*create_breakpoint_hook) (struct breakpoint * b); extern void (*delete_breakpoint_hook) (struct breakpoint * bpt); extern void (*modify_breakpoint_hook) (struct breakpoint * bpt); diff --git a/gdb/expprint.c b/gdb/expprint.c index c4d578803f8..8c0fe4f736f 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -1,5 +1,5 @@ /* Print in infix form a struct expression. - Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc. + Copyright (C) 1986, 1989, 1991, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -32,13 +32,13 @@ /* Prototypes for local functions */ -static void -print_subexp PARAMS ((struct expression *, int *, GDB_FILE *, enum precedence)); +static void print_subexp (struct expression *, int *, struct ui_file *, + enum precedence); void print_expression (exp, stream) struct expression *exp; - GDB_FILE *stream; + struct ui_file *stream; { int pc = 0; print_subexp (exp, &pc, stream, PREC_NULL); @@ -53,7 +53,7 @@ static void print_subexp (exp, pos, stream, prec) register struct expression *exp; register int *pos; - GDB_FILE *stream; + struct ui_file *stream; enum precedence prec; { register unsigned tem; @@ -695,7 +695,7 @@ op_name (opcode) void dump_prefix_expression (exp, stream, note) struct expression *exp; - GDB_FILE *stream; + struct ui_file *stream; char *note; { int elt; @@ -736,12 +736,12 @@ dump_prefix_expression (exp, stream, note) } } -static int dump_subexp PARAMS ((struct expression * exp, GDB_FILE * stream, int elt)); +static int dump_subexp PARAMS ((struct expression * exp, struct ui_file * stream, int elt)); static int dump_subexp (exp, stream, elt) struct expression *exp; - GDB_FILE *stream; + struct ui_file *stream; int elt; { static int indent = 0; @@ -974,7 +974,7 @@ dump_subexp (exp, stream, elt) void dump_postfix_expression (exp, stream, note) struct expression *exp; - GDB_FILE *stream; + struct ui_file *stream; char *note; { int elt; diff --git a/gdb/expression.h b/gdb/expression.h index a91442c124c..16dbb154500 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -1,5 +1,5 @@ /* Definitions for expressions stored in reversed prefix form, for GDB. - Copyright 1986, 1989, 1992, 1994 Free Software Foundation, Inc. + Copyright 1986, 1989, 1992, 1994, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -366,15 +366,15 @@ extern struct value *evaluate_subexp_standard /* From expprint.c */ -extern void print_expression PARAMS ((struct expression *, GDB_FILE *)); +extern void print_expression (struct expression *, struct ui_file *); extern char *op_string PARAMS ((enum exp_opcode)); -extern void dump_prefix_expression PARAMS ((struct expression *, - GDB_FILE *, - char *)); -extern void dump_postfix_expression PARAMS ((struct expression *, - GDB_FILE *, - char *)); +extern void dump_prefix_expression (struct expression *, + struct ui_file *, + char *); +extern void dump_postfix_expression (struct expression *, + struct ui_file *, + char *); #endif /* !defined (EXPRESSION_H) */ diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 1a7bfa33c2c..ddcefd0c536 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -1,5 +1,5 @@ /* Fortran language support routines for GDB, the GNU debugger. - Copyright 1993, 1994, 1996 Free Software Foundation, Inc. + Copyright 1993, 1994, 1996, 2000 Free Software Foundation, Inc. Contributed by Motorola. Adapted from the C parser by Farooq Butt (fmbutt@engage.sps.mot.com). @@ -84,9 +84,11 @@ static void patch_common_entries PARAMS ((SAVED_F77_COMMON_PTR, CORE_ADDR, int)) #endif static struct type *f_create_fundamental_type PARAMS ((struct objfile *, int)); -static void f_printstr PARAMS ((GDB_FILE * stream, char *string, unsigned int length, int width, int force_ellipses)); -static void f_printchar PARAMS ((int c, GDB_FILE * stream)); -static void f_emit_char PARAMS ((int c, GDB_FILE * stream, int quoter)); +static void f_printstr (struct ui_file * stream, char *string, + unsigned int length, int width, + int force_ellipses); +static void f_printchar (int c, struct ui_file * stream); +static void f_emit_char (int c, struct ui_file * stream, int quoter); /* Print the character C on STREAM as part of the contents of a literal string whose delimiter is QUOTER. Note that that format for printing @@ -97,7 +99,7 @@ static void f_emit_char PARAMS ((int c, GDB_FILE * stream, int quoter)); static void f_emit_char (c, stream, quoter) register int c; - GDB_FILE *stream; + struct ui_file *stream; int quoter; { c &= 0xFF; /* Avoid sign bit follies */ @@ -146,7 +148,7 @@ f_emit_char (c, stream, quoter) static void f_printchar (c, stream) int c; - GDB_FILE *stream; + struct ui_file *stream; { fputs_filtered ("'", stream); LA_EMIT_CHAR (c, stream, '\''); @@ -162,7 +164,7 @@ f_printchar (c, stream) static void f_printstr (stream, string, length, width, force_ellipses) - GDB_FILE *stream; + struct ui_file *stream; char *string; unsigned int length; int width; @@ -460,8 +462,8 @@ struct type **CONST_PTR (f_builtin_types[]) = /* This is declared in c-lang.h but it is silly to import that file for what is already just a hack. */ -extern int -c_value_print PARAMS ((struct value *, GDB_FILE *, int, enum val_prettyprint)); +extern int c_value_print (struct value *, struct ui_file *, int, + enum val_prettyprint); const struct language_defn f_language_defn = { diff --git a/gdb/f-lang.h b/gdb/f-lang.h index 77f36752f81..0dbe55f3aee 100644 --- a/gdb/f-lang.h +++ b/gdb/f-lang.h @@ -1,5 +1,5 @@ /* Fortran language support definitions for GDB, the GNU debugger. - Copyright 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 2000 Free Software Foundation, Inc. Contributed by Motorola. Adapted from the C definitions by Farooq Butt (fmbutt@engage.sps.mot.com). @@ -24,12 +24,12 @@ extern int f_parse PARAMS ((void)); extern void f_error PARAMS ((char *)); /* Defined in f-exp.y */ -extern void f_print_type PARAMS ((struct type *, char *, - GDB_FILE *, int, int)); +extern void f_print_type (struct type *, char *, struct ui_file *, int, + int); -extern int f_val_print PARAMS ((struct type *, char *, int, - CORE_ADDR, GDB_FILE *, - int, int, int, enum val_prettyprint)); +extern int f_val_print (struct type *, char *, int, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); /* Language-specific data structures */ diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 12b2865ee70..db6e0017d6f 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -1,5 +1,5 @@ /* Support for printing Fortran types for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1993, 1994 Free Software Foundation, Inc. + Copyright 1986, 1988, 1989, 1991, 1993, 1994, 2000 Free Software Foundation, Inc. Contributed by Motorola. Adapted from the C version by Farooq Butt (fmbutt@engage.sps.mot.com). @@ -41,19 +41,19 @@ #include #if 0 /* Currently unused */ -static void f_type_print_args PARAMS ((struct type *, GDB_FILE *)); +static void f_type_print_args (struct type *, struct ui_file *); #endif -static void print_equivalent_f77_float_type PARAMS ((struct type *, - GDB_FILE *)); +static void print_equivalent_f77_float_type (struct type *, + struct ui_file *); -static void f_type_print_varspec_suffix PARAMS ((struct type *, GDB_FILE *, - int, int, int)); +static void f_type_print_varspec_suffix (struct type *, struct ui_file *, + int, int, int); -void f_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, - int, int)); +void f_type_print_varspec_prefix (struct type *, struct ui_file *, + int, int); -void f_type_print_base PARAMS ((struct type *, GDB_FILE *, int, int)); +void f_type_print_base (struct type *, struct ui_file *, int, int); /* LEVEL is the depth to indent lines by. */ @@ -62,7 +62,7 @@ void f_print_type (type, varstring, stream, show, level) struct type *type; char *varstring; - GDB_FILE *stream; + struct ui_file *stream; int show; int level; { @@ -105,7 +105,7 @@ f_print_type (type, varstring, stream, show, level) void f_type_print_varspec_prefix (type, stream, show, passed_a_ptr) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; int show; int passed_a_ptr; { @@ -163,7 +163,7 @@ f_type_print_varspec_prefix (type, stream, show, passed_a_ptr) static void f_type_print_args (type, stream) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; { int i; struct type **args; @@ -203,7 +203,7 @@ f_type_print_args (type, stream) static void f_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; int show; int passed_a_ptr; int demangled_args; @@ -314,7 +314,7 @@ f_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args) static void print_equivalent_f77_float_type (type, stream) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; { /* Override type name "float" and make it the appropriate real. XLC stupidly outputs -12 as a type @@ -339,7 +339,7 @@ print_equivalent_f77_float_type (type, stream) void f_type_print_base (type, stream, show, level) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; int show; int level; { diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 5d127981e5e..a007c871c1e 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -1,5 +1,5 @@ /* Support for printing Fortran values for GDB, the GNU debugger. - Copyright 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1993-1995, 2000 Free Software Foundation, Inc. Contributed by Motorola. Adapted from the C definitions by Farooq Butt (fmbutt@engage.sps.mot.com), additionally worked over by Stan Shebs. @@ -41,14 +41,14 @@ static int there_is_a_visible_common_named PARAMS ((char *)); extern void _initialize_f_valprint PARAMS ((void)); static void info_common_command PARAMS ((char *, int)); static void list_all_visible_commons PARAMS ((char *)); -static void f77_print_array PARAMS ((struct type *, char *, CORE_ADDR, - GDB_FILE *, int, int, int, - enum val_prettyprint)); -static void f77_print_array_1 PARAMS ((int, int, struct type *, char *, - CORE_ADDR, GDB_FILE *, int, int, int, - enum val_prettyprint)); -static void f77_create_arrayprint_offset_tbl PARAMS ((struct type *, - GDB_FILE *)); +static void f77_print_array (struct type *, char *, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); +static void f77_print_array_1 (int, int, struct type *, char *, + CORE_ADDR, struct ui_file *, int, int, int, + enum val_prettyprint); +static void f77_create_arrayprint_offset_tbl (struct type *, + struct ui_file *); static void f77_get_dynamic_length_of_aggregate PARAMS ((struct type *)); int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; @@ -234,7 +234,7 @@ f77_get_dynamic_length_of_aggregate (type) static void f77_create_arrayprint_offset_tbl (type, stream) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; { struct type *tmp_type; int eltlen; @@ -288,7 +288,7 @@ f77_print_array_1 (nss, ndimensions, type, valaddr, address, struct type *type; char *valaddr; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; @@ -336,7 +336,7 @@ f77_print_array (type, valaddr, address, stream, format, deref_ref, recurse, struct type *type; char *valaddr; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; @@ -381,7 +381,7 @@ f_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref, char *valaddr; int embedded_offset; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; diff --git a/gdb/frame.h b/gdb/frame.h index 0912205e6f6..f82ae362d30 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -216,7 +216,7 @@ extern struct block *block_for_pc_sect PARAMS ((CORE_ADDR, asection *)); extern int frameless_look_for_prologue PARAMS ((struct frame_info *)); extern void print_frame_args PARAMS ((struct symbol *, struct frame_info *, - int, GDB_FILE *)); + int, struct ui_file *)); extern struct frame_info *find_relative_frame PARAMS ((struct frame_info *, int *)); diff --git a/gdb/gdb-events.sh b/gdb/gdb-events.sh index 6b9dc810aad..6b0b958402a 100755 --- a/gdb/gdb-events.sh +++ b/gdb/gdb-events.sh @@ -1,7 +1,7 @@ #!/bin/sh # User Interface Events. -# Copyright 1999 Free Software Foundation, Inc. +# Copyright 1999-2000 Free Software Foundation, Inc. # # Contributed by Cygnus Solutions. # @@ -73,7 +73,7 @@ f:void:breakpoint_modify:int b:b #*:void:target_wait_loop_hook:void #*:void:init_gdb_hook:char *argv0:argv0 #*:void:command_loop_hook:void -#*:void:fputs_unfiltered_hook:const char *linebuff,GDB_FILE *stream:linebuff, stream +#*:void:fputs_unfiltered_hook:const char *linebuff,struct ui_file *stream:linebuff, stream #*:void:print_frame_info_listing_hook:struct symtab *s, int line, int stopline, int noerror:s, line, stopline, noerror #*:int:query_hook:const char *query, va_list args:query, args #*:void:warning_hook:const char *string, va_list args:string, args diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h index af4fcf6199f..b801f08147e 100644 --- a/gdb/gdbcmd.h +++ b/gdb/gdbcmd.h @@ -1,5 +1,5 @@ /* Header file for GDB-specific command-line stuff. - Copyright 1986, 1989, 1990, 1992 Free Software Foundation, Inc. + Copyright 1986, 1989, 1990, 1992, 2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -106,8 +106,8 @@ execute_command PARAMS ((char *, int)); enum command_control_type execute_control_command PARAMS ((struct command_line *)); -extern void -print_command_line PARAMS ((struct command_line *, unsigned int, GDB_FILE *)); +extern void print_command_line (struct command_line *, unsigned int, + struct ui_file *); extern char **noop_completer PARAMS ((char *, char *)); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 49ace6a5bb7..3c124f06097 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1,6 +1,5 @@ /* Internal type definitions for GDB. - Copyright (C) 1992, 1993, 1994, 1996, 1998, 1999 - Free Software Foundation, Inc. + Copyright (C) 1992-1994, 1996, 1998-2000 Free Software Foundation, Inc. Contributed by Cygnus Support, using pieces from other GDB modules. This file is part of GDB. @@ -1151,8 +1150,8 @@ extern void recursive_dump_type PARAMS ((struct type *, int)); /* printcmd.c */ -extern void -print_scalar_formatted PARAMS ((char *, struct type *, int, int, GDB_FILE *)); +extern void print_scalar_formatted (char *, struct type *, int, int, + struct ui_file *); extern int can_dereference PARAMS ((struct type *)); @@ -1162,6 +1161,6 @@ extern void maintenance_print_type PARAMS ((char *, int)); /* typeprint.c */ -extern void print_type_scalar PARAMS ((struct type *, LONGEST, GDB_FILE *)); +extern void print_type_scalar (struct type *, LONGEST, struct ui_file *); #endif /* GDBTYPES_H */ diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 1477df2527f..2adee0f1104 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -1,6 +1,5 @@ /* Target-dependent code for the HP PA architecture, for GDB. - Copyright 1986, 87, 89, 90, 91, 92, 93, 94, 95, 96, 1999 - Free Software Foundation, Inc. + Copyright 1986, 1987, 1989-1996, 1999-2000 Free Software Foundation, Inc. Contributed by the Center for Software Science at the University of Utah (pa-gdb-bugs@cs.utah.edu). @@ -122,10 +121,10 @@ static void internalize_unwinds PARAMS ((struct objfile *, asection *, unsigned int, unsigned int, CORE_ADDR)); static void pa_print_registers PARAMS ((char *, int, int)); -static void pa_strcat_registers PARAMS ((char *, int, int, GDB_FILE *)); +static void pa_strcat_registers (char *, int, int, struct ui_file *); static void pa_register_look_aside PARAMS ((char *, int, long *)); static void pa_print_fp_reg PARAMS ((int)); -static void pa_strcat_fp_reg PARAMS ((int, GDB_FILE *, enum precision_type)); +static void pa_strcat_fp_reg (int, struct ui_file *, enum precision_type); static void record_text_segment_lowaddr PARAMS ((bfd *, asection *, void *)); typedef struct @@ -2586,7 +2585,7 @@ void pa_do_strcat_registers_info (regnum, fpregs, stream, precision) int regnum; int fpregs; - GDB_FILE *stream; + struct ui_file *stream; enum precision_type precision; { char raw_regs[REGISTER_BYTES]; @@ -2801,7 +2800,7 @@ pa_strcat_registers (raw_regs, regnum, fpregs, stream) char *raw_regs; int regnum; int fpregs; - GDB_FILE *stream; + struct ui_file *stream; { int i, j; long raw_val[2]; /* Alas, we are compiled so that "long long" is 32 bits */ @@ -2894,7 +2893,7 @@ pa_print_fp_reg (i) static void pa_strcat_fp_reg (i, stream, precision) int i; - GDB_FILE *stream; + struct ui_file *stream; enum precision_type precision; { char raw_buffer[MAX_REGISTER_RAW_SIZE]; diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index dd323b2a495..367add2427f 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -1,5 +1,5 @@ /* Java language support routines for GDB, the GNU debugger. - Copyright 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -58,7 +58,7 @@ static int java_class_is_primitive PARAMS ((value_ptr clas)); static struct type *java_lookup_type PARAMS ((char *signature)); static value_ptr java_value_string PARAMS ((char *ptr, int len)); -static void java_emit_char PARAMS ((int c, GDB_FILE * stream, int quoter)); +static void java_emit_char (int c, struct ui_file * stream, int quoter); /* This objfile contains symtabs that have been dynamically created to record dynamically loaded Java classes and dynamically @@ -837,7 +837,7 @@ java_value_string (ptr, len) static void java_emit_char (c, stream, quoter) int c; - GDB_FILE *stream; + struct ui_file *stream; int quoter; { switch (c) diff --git a/gdb/jv-lang.h b/gdb/jv-lang.h index cec3aabf5b0..cfb1a39d64e 100644 --- a/gdb/jv-lang.h +++ b/gdb/jv-lang.h @@ -1,5 +1,5 @@ /* Java language support definitions for GDB, the GNU debugger. - Copyright 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright 1997-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -37,13 +37,12 @@ extern struct type *java_float_type; extern struct type *java_double_type; extern struct type *java_void_type; -extern int -java_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, int, int, - int, enum val_prettyprint)); +extern int java_val_print (struct type *, char *, int, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); -extern int -java_value_print PARAMS ((struct value *, GDB_FILE *, int, - enum val_prettyprint)); +extern int java_value_print (struct value *, struct ui_file *, int, + enum val_prettyprint); extern value_ptr java_class_from_object PARAMS ((value_ptr)); @@ -62,7 +61,8 @@ extern struct type *java_lookup_class PARAMS ((char *)); extern int is_object_type PARAMS ((struct type *)); -extern void /* Defined in jv-typeprint.c */ -java_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int)); +/* Defined in jv-typeprint.c */ +extern void java_print_type (struct type *, char *, struct ui_file *, int, + int); extern char *java_demangle_type_signature PARAMS ((char *)); diff --git a/gdb/jv-typeprint.c b/gdb/jv-typeprint.c index c7bd349f311..1b60830a854 100644 --- a/gdb/jv-typeprint.c +++ b/gdb/jv-typeprint.c @@ -1,5 +1,5 @@ /* Support for printing Java types for GDB, the GNU debugger. - Copyright 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright 1997-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -31,11 +31,13 @@ /* Local functions */ -static void java_type_print_base PARAMS ((struct type * type, GDB_FILE * stream, int show, int level)); +static void java_type_print_base (struct type * type, + struct ui_file *stream, int show, + int level); static void java_type_print_derivation_info (stream, type) - GDB_FILE *stream; + struct ui_file *stream; struct type *type; { char *name; @@ -84,7 +86,7 @@ java_type_print_derivation_info (stream, type) static void java_type_print_base (type, stream, show, level) struct type *type; - GDB_FILE *stream; + struct ui_file *stream; int show; int level; { @@ -323,14 +325,14 @@ java_type_print_base (type, stream, show, level) /* LEVEL is the depth to indent lines by. */ -extern void -c_type_print_varspec_suffix PARAMS ((struct type *, GDB_FILE *, int, int, int)); +extern void c_type_print_varspec_suffix (struct type *, struct ui_file *, + int, int, int); void java_print_type (type, varstring, stream, show, level) struct type *type; char *varstring; - GDB_FILE *stream; + struct ui_file *stream; int show; int level; { diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c index 7e87b1530d4..0f4232cc8c6 100644 --- a/gdb/jv-valprint.c +++ b/gdb/jv-valprint.c @@ -1,5 +1,5 @@ /* Support for printing Java values for GDB, the GNU debugger. - Copyright 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright 1997-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -33,13 +33,17 @@ /* Local functions */ -static void java_print_value_fields PARAMS ((struct type * type, char *valaddr, CORE_ADDR address, GDB_FILE * stream, int format, int recurse, enum val_prettyprint pretty)); +static void java_print_value_fields (struct type * type, char *valaddr, + CORE_ADDR address, + struct ui_file *stream, int format, + int recurse, + enum val_prettyprint pretty); int java_value_print (val, stream, format, pretty) value_ptr val; - GDB_FILE *stream; + struct ui_file *stream; int format; enum val_prettyprint pretty; { @@ -242,7 +246,7 @@ java_print_value_fields (type, valaddr, address, stream, struct type *type; char *valaddr; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int recurse; enum val_prettyprint pretty; @@ -451,7 +455,7 @@ java_val_print (type, valaddr, embedded_offset, address, stream, format, struct type *type; char *valaddr; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; diff --git a/gdb/language.c b/gdb/language.c index 05f710f4f67..ebdcefe5628 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -1,5 +1,5 @@ /* Multiple source language support for GDB. - Copyright 1991, 1992 Free Software Foundation, Inc. + Copyright 1991, 1992, 2000 Free Software Foundation, Inc. Contributed by the Department of Computer Science at the State University of New York at Buffalo. @@ -86,27 +86,25 @@ set_check PARAMS ((char *, int)); static void set_type_range PARAMS ((void)); -static void -unk_lang_emit_char PARAMS ((int c, GDB_FILE * stream, int quoter)); +static void unk_lang_emit_char (int c, struct ui_file *stream, int quoter); -static void -unk_lang_printchar PARAMS ((int c, GDB_FILE * stream)); +static void unk_lang_printchar (int c, struct ui_file *stream); -static void -unk_lang_printstr PARAMS ((GDB_FILE * stream, char *string, unsigned int length, int width, int force_ellipses)); +static void unk_lang_printstr (struct ui_file * stream, char *string, + unsigned int length, int width, + int force_ellipses); static struct type * unk_lang_create_fundamental_type PARAMS ((struct objfile *, int)); -static void -unk_lang_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int)); +static void unk_lang_print_type (struct type *, char *, struct ui_file *, + int, int); -static int -unk_lang_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, - int, int, int, enum val_prettyprint)); +static int unk_lang_val_print (struct type *, char *, int, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); -static int -unk_lang_value_print PARAMS ((value_ptr, GDB_FILE *, int, enum val_prettyprint)); +static int unk_lang_value_print (value_ptr, struct ui_file *, int, enum val_prettyprint); /* Forward declaration */ extern const struct language_defn unknown_language_defn; @@ -1364,7 +1362,7 @@ unk_lang_error (msg) static void unk_lang_emit_char (c, stream, quoter) register int c; - GDB_FILE *stream; + struct ui_file *stream; int quoter; { error ("internal error - unimplemented function unk_lang_emit_char called."); @@ -1373,14 +1371,14 @@ unk_lang_emit_char (c, stream, quoter) static void unk_lang_printchar (c, stream) register int c; - GDB_FILE *stream; + struct ui_file *stream; { error ("internal error - unimplemented function unk_lang_printchar called."); } static void unk_lang_printstr (stream, string, length, width, force_ellipses) - GDB_FILE *stream; + struct ui_file *stream; char *string; unsigned int length; int width; @@ -1401,7 +1399,7 @@ static void unk_lang_print_type (type, varstring, stream, show, level) struct type *type; char *varstring; - GDB_FILE *stream; + struct ui_file *stream; int show; int level; { @@ -1415,7 +1413,7 @@ unk_lang_val_print (type, valaddr, embedded_offset, address, stream, format, der char *valaddr; int embedded_offset; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; @@ -1427,7 +1425,7 @@ unk_lang_val_print (type, valaddr, embedded_offset, address, stream, format, der static int unk_lang_value_print (val, stream, format, pretty) value_ptr val; - GDB_FILE *stream; + struct ui_file *stream; int format; enum val_prettyprint pretty; { diff --git a/gdb/language.h b/gdb/language.h index b730d9b26ea..2f27cb120e3 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -1,5 +1,5 @@ /* Source-language-related definitions for GDB. - Copyright 1991, 1992 Free Software Foundation, Inc. + Copyright 1991, 1992, 2000 Free Software Foundation, Inc. Contributed by the Department of Computer Science at the State University of New York at Buffalo. @@ -151,29 +151,31 @@ struct language_defn struct value *(*evaluate_exp) PARAMS ((struct type *, struct expression *, int *, enum noside)); - void (*la_printchar) PARAMS ((int ch, GDB_FILE * stream)); + void (*la_printchar) (int ch, struct ui_file * stream); - void (*la_printstr) PARAMS ((GDB_FILE * stream, char *string, - unsigned int length, int width, - int force_ellipses)); + void (*la_printstr) (struct ui_file * stream, char *string, + unsigned int length, int width, + int force_ellipses); - void (*la_emitchar) PARAMS ((int ch, GDB_FILE * stream, int quoter)); + void (*la_emitchar) (int ch, struct ui_file * stream, int quoter); struct type *(*la_fund_type) PARAMS ((struct objfile *, int)); /* Print a type using syntax appropriate for this language. */ - void (*la_print_type) PARAMS ((struct type *, char *, GDB_FILE *, int, int)); + void (*la_print_type) (struct type *, char *, struct ui_file *, int, + int); /* Print a value using syntax appropriate for this language. */ - int (*la_val_print) PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, - int, int, int, enum val_prettyprint)); + int (*la_val_print) (struct type *, char *, int, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); /* Print a top-level value using syntax appropriate for this language. */ - int (*la_value_print) PARAMS ((struct value *, GDB_FILE *, - int, enum val_prettyprint)); + int (*la_value_print) (struct value *, struct ui_file *, + int, enum val_prettyprint); /* Base 2 (binary) formats. */ diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index fd13349295a..e1136a7de3e 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -1,5 +1,5 @@ /* Modula 2 language support routines for GDB, the GNU debugger. - Copyright 1992 Free Software Foundation, Inc. + Copyright 1992, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -29,9 +29,11 @@ extern void _initialize_m2_language PARAMS ((void)); static struct type *m2_create_fundamental_type PARAMS ((struct objfile *, int)); -static void m2_printstr PARAMS ((GDB_FILE * stream, char *string, unsigned int length, int width, int force_ellipses)); -static void m2_printchar PARAMS ((int, GDB_FILE *)); -static void m2_emit_char PARAMS ((int, GDB_FILE *, int)); +static void m2_printstr (struct ui_file * stream, char *string, + unsigned int length, int width, + int force_ellipses); +static void m2_printchar (int, struct ui_file *); +static void m2_emit_char (int, struct ui_file *, int); /* Print the character C on STREAM as part of the contents of a literal string whose delimiter is QUOTER. Note that that format for printing @@ -43,7 +45,7 @@ static void m2_emit_char PARAMS ((int, GDB_FILE *, int)); static void m2_emit_char (c, stream, quoter) register int c; - GDB_FILE *stream; + struct ui_file *stream; int quoter; { @@ -95,7 +97,7 @@ m2_emit_char (c, stream, quoter) static void m2_printchar (c, stream) int c; - GDB_FILE *stream; + struct ui_file *stream; { fputs_filtered ("'", stream); LA_EMIT_CHAR (c, stream, '\''); @@ -111,7 +113,7 @@ m2_printchar (c, stream) static void m2_printstr (stream, string, length, width, force_ellipses) - GDB_FILE *stream; + struct ui_file *stream; char *string; unsigned int length; int width; diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h index 190940e4b0b..6e63e8d7801 100644 --- a/gdb/m2-lang.h +++ b/gdb/m2-lang.h @@ -1,5 +1,5 @@ /* Modula 2 language support definitions for GDB, the GNU debugger. - Copyright 1992 Free Software Foundation, Inc. + Copyright 1992, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -24,9 +24,10 @@ m2_parse PARAMS ((void)); /* Defined in m2-exp.y */ extern void m2_error PARAMS ((char *)); /* Defined in m2-exp.y */ -extern void /* Defined in m2-typeprint.c */ -m2_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int)); +/* Defined in m2-typeprint.c */ +extern void m2_print_type (struct type *, char *, struct ui_file *, int, + int); -extern int -m2_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, int, int, - int, enum val_prettyprint)); +extern int m2_val_print (struct type *, char *, int, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c index c3c1e5db3a6..ee7e8362260 100644 --- a/gdb/m2-typeprint.c +++ b/gdb/m2-typeprint.c @@ -1,5 +1,5 @@ /* Support for printing Modula 2 types for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc. + Copyright 1986, 1988, 1989, 1991, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -40,11 +40,12 @@ void m2_print_type (type, varstring, stream, show, level) struct type *type; char *varstring; - GDB_FILE *stream; + struct ui_file *stream; int show; int level; { - extern void c_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int)); + extern void c_print_type (struct type *, char *, struct ui_file *, int, + int); c_print_type (type, varstring, stream, show, level); /* FIXME */ } diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index 76b97c5ca77..903d96b6e80 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -1,5 +1,5 @@ /* Support for printing Modula 2 values for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc. + Copyright 1986, 1988, 1989, 1991, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -34,15 +34,15 @@ m2_val_print (type, valaddr, embedded_offset, address, char *valaddr; int embedded_offset; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; enum val_prettyprint pretty; { - extern int - c_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, - GDB_FILE *, int, int, int, enum val_prettyprint)); + extern int c_val_print (struct type *, char *, int, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); return (c_val_print (type, valaddr, 0, address, stream, format, deref_ref, recurse, pretty)); } diff --git a/gdb/m3-nat.c b/gdb/m3-nat.c index 79317bcf182..0770cc3a503 100644 --- a/gdb/m3-nat.c +++ b/gdb/m3-nat.c @@ -1,7 +1,7 @@ /* Interface GDB to Mach 3.0 operating systems. (Most) Mach 3.0 related routines live in this file. - Copyright (C) 1992, 1996, 1999 Free Software Foundation, Inc. + Copyright (C) 1992, 1996, 1999-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -2472,7 +2472,7 @@ map_cprocs_to_kernel_threads (cprocs, mthreads, thread_count) void print_tl_address (stream, pc) - GDB_FILE *stream; + struct ui_file *stream; CORE_ADDR pc; { if (!lookup_minimal_symbol_by_pc (pc)) diff --git a/gdb/main.c b/gdb/main.c index 7ccc47fbd42..c5c4e96fd9f 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -1,6 +1,5 @@ /* Top level stuff for GDB, the GNU debugger. - Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 1999 - Free Software Foundation, Inc. + Copyright 1986-1995, 1999-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -62,10 +61,10 @@ int xdb_commands = 0; /* Whether dbx commands will be handled */ int dbx_commands = 0; -GDB_FILE *gdb_stdout; -GDB_FILE *gdb_stderr; -GDB_FILE *gdb_stdlog; -GDB_FILE *gdb_stdtarg; +struct ui_file *gdb_stdout; +struct ui_file *gdb_stderr; +struct ui_file *gdb_stdlog; +struct ui_file *gdb_stdtarg; /* Used to initialize error() - defined in utils.c */ @@ -74,7 +73,7 @@ extern void error_init (void); /* Whether to enable writing into executable and core files */ extern int write_files; -static void print_gdb_help PARAMS ((GDB_FILE *)); +static void print_gdb_help (struct ui_file *); /* These two are used to set the external editor commands when gdb is farming out files to be edited by another program. */ @@ -194,7 +193,7 @@ captured_main (void *data) #if defined (TUI) || defined (GDBTK) /* Older code uses the tui_file and fputs_unfiltered_hook(). It - should be using a customized GDB_FILE object and re-initializing + should be using a customized UI_FILE object and re-initializing within its own _initialize function. */ gdb_stdout = tui_fileopen (stdout); gdb_stderr = tui_fileopen (stderr); @@ -714,8 +713,7 @@ main (int argc, char **argv) to print. */ static void -print_gdb_help (stream) - GDB_FILE *stream; +print_gdb_help (struct ui_file *stream) { fputs_unfiltered ("\ This is the GNU debugger. Usage:\n\n\ diff --git a/gdb/monitor.c b/gdb/monitor.c index 3a50c9887aa..ef142aad3a1 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -1,6 +1,5 @@ /* Remote debugging interface for boot monitors, for GDB. - Copyright 1990, 1991, 1992, 1993, 1995, 1996, 1997, 1999 - Free Software Foundation, Inc. + Copyright 1990-1993, 1995-1997, 1999-2000 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Rob Savoye for Cygnus. Resurrected from the ashes by Stu Grossman. @@ -2270,7 +2269,7 @@ monitor_stop () static void monitor_rcmd (char *command, - struct gdb_file *outbuf) + struct ui_file *outbuf) { char *p; int resp_len; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 6324357cfb2..9fac1f39b4b 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1,6 +1,5 @@ /* Print values for GNU debugger GDB. - Copyright 1986, 87, 88, 89, 90, 91, 93, 94, 95, 1998 - Free Software Foundation, Inc. + Copyright 1986-1991, 1993-1995, 1998, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -135,8 +134,8 @@ static void disassemble_command PARAMS ((char *, int)); static void printf_command PARAMS ((char *, int)); -static void print_frame_nameless_args PARAMS ((struct frame_info *, long, - int, int, GDB_FILE *)); +static void print_frame_nameless_args (struct frame_info *, long, + int, int, struct ui_file *); static void display_info PARAMS ((char *, int)); @@ -166,11 +165,11 @@ static void validate_format PARAMS ((struct format_data, char *)); static void do_examine PARAMS ((struct format_data, CORE_ADDR addr, asection * section)); -static void print_formatted PARAMS ((value_ptr, int, int, GDB_FILE *)); +static void print_formatted (value_ptr, int, int, struct ui_file *); static struct format_data decode_format PARAMS ((char **, int, int)); -static int print_insn PARAMS ((CORE_ADDR, GDB_FILE *)); +static int print_insn (CORE_ADDR, struct ui_file *); static void sym_info PARAMS ((char *, int)); @@ -281,7 +280,7 @@ print_formatted (val, format, size, stream) register value_ptr val; register int format; int size; - GDB_FILE *stream; + struct ui_file *stream; { struct type *type = check_typedef (VALUE_TYPE (val)); int len = TYPE_LENGTH (type); @@ -349,7 +348,7 @@ print_scalar_formatted (valaddr, type, format, size, stream) struct type *type; int format; int size; - GDB_FILE *stream; + struct ui_file *stream; { LONGEST val_long; unsigned int len = TYPE_LENGTH (type); @@ -540,7 +539,7 @@ set_next_address (addr) void print_address_symbolic (addr, stream, do_demangle, leadin) CORE_ADDR addr; - GDB_FILE *stream; + struct ui_file *stream; int do_demangle; char *leadin; { @@ -667,7 +666,7 @@ void print_address_numeric (addr, use_local, stream) CORE_ADDR addr; int use_local; - GDB_FILE *stream; + struct ui_file *stream; { /* This assumes a CORE_ADDR can fit in a LONGEST. Probably a safe assumption. */ @@ -681,7 +680,7 @@ print_address_numeric (addr, use_local, stream) void print_address (addr, stream) CORE_ADDR addr; - GDB_FILE *stream; + struct ui_file *stream; { print_address_numeric (addr, 1, stream); print_address_symbolic (addr, stream, asm_demangle, " "); @@ -695,7 +694,7 @@ print_address (addr, stream) void print_address_demangle (addr, stream, do_demangle) CORE_ADDR addr; - GDB_FILE *stream; + struct ui_file *stream; int do_demangle; { if (addr == 0) @@ -1743,7 +1742,7 @@ void print_variable_value (var, frame, stream) struct symbol *var; struct frame_info *frame; - GDB_FILE *stream; + struct ui_file *stream; { value_ptr val = read_var_value (var, frame); @@ -1763,7 +1762,7 @@ print_frame_args (func, fi, num, stream) struct symbol *func; struct frame_info *fi; int num; - GDB_FILE *stream; + struct ui_file *stream; { struct block *b = NULL; int nsyms = 0; @@ -1948,7 +1947,7 @@ print_frame_nameless_args (fi, start, num, first, stream) long start; int num; int first; - GDB_FILE *stream; + struct ui_file *stream; { int i; CORE_ADDR argsaddr; @@ -2398,7 +2397,7 @@ disassemble_command (arg, from_tty) static int print_insn (memaddr, stream) CORE_ADDR memaddr; - GDB_FILE *stream; + struct ui_file *stream; { if (TARGET_BYTE_ORDER == BIG_ENDIAN) TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_BIG; diff --git a/gdb/pyr-tdep.c b/gdb/pyr-tdep.c index e5e4043328d..0cc355e96f2 100644 --- a/gdb/pyr-tdep.c +++ b/gdb/pyr-tdep.c @@ -1,5 +1,5 @@ /* OBSOLETE /* Pyramid target-dependent code for GDB. */ -/* OBSOLETE Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc. */ +/* OBSOLETE Copyright (C) 1988, 1989, 1991, 2000 Free Software Foundation, Inc. */ /* OBSOLETE */ /* OBSOLETE This file is part of GDB. */ /* OBSOLETE */ @@ -184,7 +184,7 @@ /* OBSOLETE int */ /* OBSOLETE pyr_print_insn (memaddr, stream) */ /* OBSOLETE CORE_ADDR memaddr; */ -/* OBSOLETE GDB_FILE *stream; */ +/* OBSOLETE struct ui_file *stream; */ /* OBSOLETE { */ /* OBSOLETE unsigned char buffer[MAXLEN]; */ /* OBSOLETE register int i, nargs, insn_size =4; */ diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 87997ad08bc..d2efcf28b7a 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -1,5 +1,5 @@ /* Remote debugging interface for MIPS remote debugging protocol. - Copyright 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1993-1995, 2000 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Ian Lance Taylor . @@ -514,7 +514,7 @@ mips_error (char *string,...) static void fputc_readable (ch, file) int ch; - struct gdb_file *file; + struct ui_file *file; { if (ch == '\n') fputc_unfiltered ('\n', file); @@ -535,7 +535,7 @@ fputc_readable (ch, file) static void fputs_readable (string, file) char *string; - struct gdb_file *file; + struct ui_file *file; { int c; diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 74728376dc1..52c02920f61 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -1,5 +1,5 @@ /* Generic remote debugging interface for simulators. - Copyright 1993, 1994, 1996, 1997 Free Software Foundation, Inc. + Copyright 1993, 1994, 1996, 1997, 2000 Free Software Foundation, Inc. Contributed by Cygnus Support. Steve Chamberlain (sac@cygnus.com). @@ -194,7 +194,7 @@ gdb_os_write_stdout (p, buf, len) int i; char b[2]; - gdb_file_write (gdb_stdtarg, buf, len); + ui_file_write (gdb_stdtarg, buf, len); return len; } diff --git a/gdb/remote-udi.c b/gdb/remote-udi.c index 4da615386c0..e67bb4634e7 100644 --- a/gdb/remote-udi.c +++ b/gdb/remote-udi.c @@ -1,5 +1,5 @@ /* Remote debugging interface for AMD 29k interfaced via UDI, for GDB. - Copyright 1990, 1992, 1995 Free Software Foundation, Inc. + Copyright 1990, 1992, 1995, 2000 Free Software Foundation, Inc. Written by Daniel Mann. Contributed by AMD. This file is part of GDB. @@ -1673,7 +1673,7 @@ void convert32 () {; } -GDB_FILE *EchoFile = 0; /* used for debugging */ +struct ui_file *EchoFile = 0; /* used for debugging */ int QuietMode = 0; /* used for debugging */ #ifdef NO_HIF_SUPPORT diff --git a/gdb/remote.c b/gdb/remote.c index 783f75ea283..72ff24d05ec 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1,6 +1,5 @@ /* Remote target communications for serial-line targets in custom GDB protocol - Copyright 1988, 91, 92, 93, 94, 95, 96, 97, 98, 1999 - Free Software Foundation, Inc. + Copyright 1988, 1991-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -56,6 +55,7 @@ /* Prototypes for local functions */ static void cleanup_sigint_signal_handler (void *dummy); static void initialize_sigint_signal_handler (void); +static int getpkt_sane (char *buf, long sizeof_buf, int forever); static void handle_remote_sigint PARAMS ((int)); static void handle_remote_sigint_twice PARAMS ((int)); @@ -3906,11 +3906,31 @@ read_frame (char *buf, store it in BUF. If FOREVER, wait forever rather than timing out; this is used (in synchronous mode) to wait for a target that is is executing user code to stop. */ - +/* FIXME: ezannoni 2000-02-01 this wrapper is necessary so that we + don't have to change all the calls to getpkt to deal with the + return value, because at the moment I don't know what the right + thing to do it for those. */ void getpkt (char *buf, long sizeof_buf, int forever) +{ + int timed_out; + + timed_out = getpkt_sane (buf, sizeof_buf, forever); +} + + +/* Read a packet from the remote machine, with error checking, and + store it in BUF. If FOREVER, wait forever rather than timing out; + this is used (in synchronous mode) to wait for a target that is is + executing user code to stop. If FOREVER == 0, this function is + allowed to time out gracefully and return an indication of this to + the caller. */ +int +getpkt_sane (char *buf, + long sizeof_buf, + int forever) { int c; int tries; @@ -3971,7 +3991,7 @@ getpkt (char *buf, fprintf_unfiltered (gdb_stdlog, "\n"); } SERIAL_WRITE (remote_desc, "+", 1); - return; + return 0; } /* Try the whole thing again. */ @@ -3983,6 +4003,7 @@ getpkt (char *buf, printf_unfiltered ("Ignoring packet error, continuing...\n"); SERIAL_WRITE (remote_desc, "+", 1); + return 1; } static void @@ -4605,7 +4626,7 @@ remote_query (query_type, buf, outbuf, bufsiz) static void remote_rcmd (char *command, - struct gdb_file *outbuf) + struct ui_file *outbuf) { int i; char *buf = alloca (PBUFSIZ); diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c index a424891a461..ac09fe6aa32 100644 --- a/gdb/scm-lang.c +++ b/gdb/scm-lang.c @@ -1,5 +1,5 @@ /* Scheme/Guile language support routines for GDB, the GNU debugger. - Copyright 1995 Free Software Foundation, Inc. + Copyright 1995, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -36,7 +36,9 @@ static value_ptr evaluate_subexp_scm PARAMS ((struct type *, struct expression * int *, enum noside)); static value_ptr scm_lookup_name PARAMS ((char *)); static int in_eval_c PARAMS ((void)); -static void scm_printstr PARAMS ((GDB_FILE * stream, char *string, unsigned int length, int width, int force_ellipses)); +static void scm_printstr (struct ui_file * stream, char *string, + unsigned int length, int width, + int force_ellipses); extern struct type **CONST_PTR (c_builtin_types[]); @@ -45,14 +47,14 @@ struct type *builtin_type_scm; void scm_printchar (c, stream) int c; - GDB_FILE *stream; + struct ui_file *stream; { fprintf_filtered (stream, "#\\%c", c); } static void scm_printstr (stream, string, length, width, force_ellipses) - GDB_FILE *stream; + struct ui_file *stream; char *string; unsigned int length; int width; diff --git a/gdb/scm-lang.h b/gdb/scm-lang.h index 68ba2da925d..eb708fb53ef 100644 --- a/gdb/scm-lang.h +++ b/gdb/scm-lang.h @@ -1,3 +1,23 @@ +/* Scheme/Guile language support routines for GDB, the GNU debugger. + Copyright 1995, 1996, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + #define SICP #include "scm-tags.h" #undef SCM_NCELLP @@ -25,20 +45,21 @@ /* Forward decls for prototypes */ struct value; -extern int scm_value_print PARAMS ((struct value *, GDB_FILE *, - int, enum val_prettyprint)); +extern int scm_value_print (struct value *, struct ui_file *, + int, enum val_prettyprint); -extern int scm_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, - int, int, int, enum val_prettyprint)); +extern int scm_val_print (struct type *, char *, int, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); extern LONGEST scm_get_field PARAMS ((LONGEST, int)); -extern void scm_scmval_print PARAMS ((LONGEST, GDB_FILE *, - int, int, int, enum val_prettyprint)); +extern void scm_scmval_print (LONGEST, struct ui_file *, int, int, int, + enum val_prettyprint); extern int is_scmvalue_type PARAMS ((struct type *)); -extern void scm_printchar PARAMS ((int, GDB_FILE *)); +extern void scm_printchar (int, struct ui_file *); extern struct value *scm_evaluate_string PARAMS ((char *, int)); diff --git a/gdb/scm-valprint.c b/gdb/scm-valprint.c index 8ddfb7f6aa4..802751f346a 100644 --- a/gdb/scm-valprint.c +++ b/gdb/scm-valprint.c @@ -1,5 +1,5 @@ /* Scheme/Guile language support routines for GDB, the GNU debugger. - Copyright 1995 Free Software Foundation, Inc. + Copyright 1995, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -30,15 +30,15 @@ #include "gdbcore.h" /* FIXME: Should be in a header file that we import. */ -extern int -c_val_print PARAMS ((struct type *, char *, int, CORE_ADDR, GDB_FILE *, int, int, - int, enum val_prettyprint)); +extern int c_val_print (struct type *, char *, int, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint); -static void scm_ipruk PARAMS ((char *, LONGEST, GDB_FILE *)); -static void scm_scmlist_print PARAMS ((LONGEST, GDB_FILE *, int, int, - int, enum val_prettyprint)); -static int scm_inferior_print PARAMS ((LONGEST, GDB_FILE *, int, int, - int, enum val_prettyprint)); +static void scm_ipruk (char *, LONGEST, struct ui_file *); +static void scm_scmlist_print (LONGEST, struct ui_file *, int, int, + int, enum val_prettyprint); +static int scm_inferior_print (LONGEST, struct ui_file *, int, int, + int, enum val_prettyprint); /* Prints the SCM value VALUE by invoking the inferior, if appropraite. Returns >= 0 on succes; retunr -1 if the inferior cannot/should not @@ -47,7 +47,7 @@ static int scm_inferior_print PARAMS ((LONGEST, GDB_FILE *, int, int, static int scm_inferior_print (value, stream, format, deref_ref, recurse, pretty) LONGEST value; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; @@ -98,7 +98,7 @@ static char *scm_isymnames[] = static void scm_scmlist_print (svalue, stream, format, deref_ref, recurse, pretty) LONGEST svalue; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; @@ -138,7 +138,7 @@ static void scm_ipruk (hdr, ptr, stream) char *hdr; LONGEST ptr; - GDB_FILE *stream; + struct ui_file *stream; { fprintf_filtered (stream, "#ops->print_tty_state (scb, ttystate, stream); } diff --git a/gdb/serial.h b/gdb/serial.h index 4b2c1f37ecd..4aff1b0ecae 100644 --- a/gdb/serial.h +++ b/gdb/serial.h @@ -1,5 +1,5 @@ /* Remote serial support interface definitions for GDB, the GNU Debugger. - Copyright 1992, 1993, 1999 Free Software Foundation, Inc. + Copyright 1992, 1993, 1999, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -127,7 +127,7 @@ extern int serial_set_tty_state (serial_t scb, serial_ttystate ttystate); the specified STREAM. FIXME: At present this sends output to the default stream - GDB_STDOUT. */ -extern void serial_print_tty_state (serial_t scb, serial_ttystate ttystate, struct gdb_file *); +extern void serial_print_tty_state (serial_t scb, serial_ttystate ttystate, struct ui_file *); #define SERIAL_PRINT_TTY_STATE(SERIAL_T, TTYSTATE, STREAM) serial_print_tty_state ((SERIAL_T), (TTYSTATE), (STREAM)) /* Set the tty state to NEW_TTYSTATE, where OLD_TTYSTATE is the @@ -238,7 +238,7 @@ struct serial_ops void (*go_raw) (serial_t); serial_ttystate (*get_tty_state) (serial_t); int (*set_tty_state) (serial_t, serial_ttystate); - void (*print_tty_state) (serial_t, serial_ttystate, struct gdb_file *); + void (*print_tty_state) (serial_t, serial_ttystate, struct ui_file *); int (*noflush_set_tty_state) (serial_t, serial_ttystate, serial_ttystate); int (*setbaudrate) (serial_t, int rate); int (*setstopbits) (serial_t, int num); diff --git a/gdb/stack.c b/gdb/stack.c index d344baba2f1..7e414c549f8 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1,6 +1,5 @@ /* Print and select stack frames for GDB, the GNU debugger. - Copyright 1986, 87, 89, 91, 92, 93, 94, 95, 96, 98, 1999, 2000 - Free Software Foundation, Inc. + Copyright 1986, 1987, 1989, 1991-1996, 1998-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -70,27 +69,25 @@ static void current_frame_command PARAMS ((char *, int)); static void select_frame_command PARAMS ((char *, int)); -static void print_frame_arg_vars PARAMS ((struct frame_info *, GDB_FILE *)); +static void print_frame_arg_vars (struct frame_info *, struct ui_file *); static void catch_info PARAMS ((char *, int)); static void args_plus_locals_info PARAMS ((char *, int)); -static void print_frame_label_vars PARAMS ((struct frame_info *, - int, - GDB_FILE *)); +static void print_frame_label_vars (struct frame_info *, int, + struct ui_file *); -static void print_frame_local_vars PARAMS ((struct frame_info *, - int, - GDB_FILE *)); +static void print_frame_local_vars (struct frame_info *, int, + struct ui_file *); -static int print_block_frame_labels PARAMS ((struct block *, int *, - GDB_FILE *)); +static int print_block_frame_labels (struct block *, int *, + struct ui_file *); -static int print_block_frame_locals PARAMS ((struct block *, - struct frame_info *, - int, - GDB_FILE *)); +static int print_block_frame_locals (struct block *, + struct frame_info *, + int, + struct ui_file *); static void print_frame (struct frame_info *fi, int level, @@ -314,7 +311,7 @@ struct print_args_args { struct symbol *func; struct frame_info *fi; - GDB_FILE *stream; + struct ui_file *stream; }; static int print_args_stub PARAMS ((PTR)); @@ -1189,7 +1186,7 @@ print_block_frame_locals (b, fi, num_tabs, stream) struct block *b; register struct frame_info *fi; int num_tabs; - register GDB_FILE *stream; + register struct ui_file *stream; { int nsyms; register int i, j; @@ -1230,7 +1227,7 @@ static int print_block_frame_labels (b, have_default, stream) struct block *b; int *have_default; - register GDB_FILE *stream; + register struct ui_file *stream; { int nsyms; register int i; @@ -1278,7 +1275,7 @@ static void print_frame_local_vars (fi, num_tabs, stream) register struct frame_info *fi; register int num_tabs; - register GDB_FILE *stream; + register struct ui_file *stream; { register struct block *block = get_frame_block (fi); register int values_printed = 0; @@ -1313,7 +1310,7 @@ static void print_frame_label_vars (fi, this_level_only, stream) register struct frame_info *fi; int this_level_only; - register GDB_FILE *stream; + register struct ui_file *stream; { register struct blockvector *bl; register struct block *block = get_frame_block (fi); @@ -1423,7 +1420,7 @@ catch_info (ignore, from_tty) static void print_frame_arg_vars (fi, stream) register struct frame_info *fi; - register GDB_FILE *stream; + register struct ui_file *stream; { struct symbol *func = get_frame_function (fi); register struct block *b; diff --git a/gdb/symfile.c b/gdb/symfile.c index c74a59323c7..0726d1a6540 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1,6 +1,5 @@ /* Generic symbol file reading for the GNU debugger, GDB. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998 - Free Software Foundation, Inc. + Copyright 1990-1996, 1998, 2000 Free Software Foundation, Inc. Contributed by Cygnus Support, using pieces from other GDB modules. This file is part of GDB. @@ -1400,7 +1399,7 @@ report_transfer_performance (data_count, start_time, end_time) } void -print_transfer_performance (struct gdb_file *stream, +print_transfer_performance (struct ui_file *stream, unsigned long data_count, unsigned long write_count, unsigned long time_count) diff --git a/gdb/symmisc.c b/gdb/symmisc.c index dbf64f79b0b..1a806ccff6a 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -1,6 +1,5 @@ /* Do various things to symbol tables (other than lookup), for GDB. - Copyright 1986, 87, 89, 91, 92, 93, 94, 95, 96, 1998 - Free Software Foundation, Inc. + Copyright 1986, 1987, 1989, 1991-1996, 1998, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -49,20 +48,20 @@ FILE *std_err; /* Prototypes for local functions */ -static void dump_symtab PARAMS ((struct objfile *, struct symtab *, - GDB_FILE *)); +static void dump_symtab (struct objfile *, struct symtab *, + struct ui_file *); -static void dump_psymtab PARAMS ((struct objfile *, struct partial_symtab *, - GDB_FILE *)); +static void dump_psymtab (struct objfile *, struct partial_symtab *, + struct ui_file *); -static void dump_msymbols PARAMS ((struct objfile *, GDB_FILE *)); +static void dump_msymbols (struct objfile *, struct ui_file *); static void dump_objfile PARAMS ((struct objfile *)); static int block_depth PARAMS ((struct block *)); -static void print_partial_symbols PARAMS ((struct partial_symbol **, int, - char *, GDB_FILE *)); +static void print_partial_symbols (struct partial_symbol **, int, + char *, struct ui_file *); static void free_symtab_block PARAMS ((struct objfile *, struct block *)); @@ -72,7 +71,7 @@ struct print_symbol_args { struct symbol *symbol; int depth; - GDB_FILE *outfile; + struct ui_file *outfile; }; static int print_symbol PARAMS ((PTR)); @@ -269,7 +268,7 @@ dump_objfile (objfile) static void dump_msymbols (objfile, outfile) struct objfile *objfile; - GDB_FILE *outfile; + struct ui_file *outfile; { struct minimal_symbol *msymbol; int index; @@ -346,7 +345,7 @@ static void dump_psymtab (objfile, psymtab, outfile) struct objfile *objfile; struct partial_symtab *psymtab; - GDB_FILE *outfile; + struct ui_file *outfile; { int i; @@ -415,7 +414,7 @@ static void dump_symtab (objfile, symtab, outfile) struct objfile *objfile; struct symtab *symtab; - GDB_FILE *outfile; + struct ui_file *outfile; { register int i, j; int len, blen; @@ -507,7 +506,7 @@ maintenance_print_symbols (args, from_tty) int from_tty; { char **argv; - GDB_FILE *outfile; + struct ui_file *outfile; struct cleanup *cleanups; char *symname = NULL; char *filename = DEV_TTY; @@ -543,7 +542,7 @@ Arguments missing: an output file name and an optional symbol file name"); outfile = gdb_fopen (filename, FOPEN_WT); if (outfile == 0) perror_with_name (filename); - make_cleanup_gdb_file_delete (outfile); + make_cleanup_ui_file_delete (outfile); immediate_quit++; ALL_SYMTABS (objfile, s) @@ -564,7 +563,7 @@ print_symbol (args) { struct symbol *symbol = ((struct print_symbol_args *) args)->symbol; int depth = ((struct print_symbol_args *) args)->depth; - GDB_FILE *outfile = ((struct print_symbol_args *) args)->outfile; + struct ui_file *outfile = ((struct print_symbol_args *) args)->outfile; print_spaces (depth, outfile); if (SYMBOL_NAMESPACE (symbol) == LABEL_NAMESPACE) @@ -745,7 +744,7 @@ maintenance_print_psymbols (args, from_tty) int from_tty; { char **argv; - GDB_FILE *outfile; + struct ui_file *outfile; struct cleanup *cleanups; char *symname = NULL; char *filename = DEV_TTY; @@ -780,7 +779,7 @@ maintenance_print_psymbols (args, from_tty) outfile = gdb_fopen (filename, FOPEN_WT); if (outfile == 0) perror_with_name (filename); - make_cleanup_gdb_file_delete (outfile); + make_cleanup_ui_file_delete (outfile); immediate_quit++; ALL_PSYMTABS (objfile, ps) @@ -795,7 +794,7 @@ print_partial_symbols (p, count, what, outfile) struct partial_symbol **p; int count; char *what; - GDB_FILE *outfile; + struct ui_file *outfile; { fprintf_filtered (outfile, " %s partial symbols:\n", what); while (count-- > 0) @@ -894,7 +893,7 @@ maintenance_print_msymbols (args, from_tty) int from_tty; { char **argv; - GDB_FILE *outfile; + struct ui_file *outfile; struct cleanup *cleanups; char *filename = DEV_TTY; char *symname = NULL; @@ -928,7 +927,7 @@ maintenance_print_msymbols (args, from_tty) outfile = gdb_fopen (filename, FOPEN_WT); if (outfile == 0) perror_with_name (filename); - make_cleanup_gdb_file_delete (outfile); + make_cleanup_ui_file_delete (outfile); immediate_quit++; ALL_OBJFILES (objfile) diff --git a/gdb/tahoe-tdep.c b/gdb/tahoe-tdep.c index 32b5e6f012d..e4011f3f95e 100644 --- a/gdb/tahoe-tdep.c +++ b/gdb/tahoe-tdep.c @@ -1,5 +1,5 @@ /* OBSOLETE /* Print instructions for Tahoe target machines, for GDB. */ -/* OBSOLETE Copyright 1986, 1989, 1991, 1992 Free Software Foundation, Inc. */ +/* OBSOLETE Copyright 1986, 1989, 1991, 1992, 2000 Free Software Foundation, Inc. */ /* OBSOLETE Contributed by the State University of New York at Buffalo, by the */ /* OBSOLETE Distributed Computer Systems Lab, Department of Computer Science, 1991. */ /* OBSOLETE */ @@ -78,7 +78,7 @@ /* OBSOLETE int */ /* OBSOLETE tahoe_print_insn (memaddr, stream) */ /* OBSOLETE CORE_ADDR memaddr; */ -/* OBSOLETE GDB_FILE *stream; */ +/* OBSOLETE struct ui_file *stream; */ /* OBSOLETE { */ /* OBSOLETE unsigned char buffer[MAXLEN]; */ /* OBSOLETE register int i; */ @@ -124,7 +124,7 @@ /* OBSOLETE char *d; */ /* OBSOLETE register char *p; */ /* OBSOLETE CORE_ADDR addr; */ -/* OBSOLETE GDB_FILE *stream; */ +/* OBSOLETE struct ui_file *stream; */ /* OBSOLETE { */ /* OBSOLETE int temp1 = 0; */ /* OBSOLETE register int regnum = *p & 0xf; */ diff --git a/gdb/target.c b/gdb/target.c index bf465dd7cfe..a13ac25040e 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1,5 +1,5 @@ /* Select target systems and architectures at runtime for GDB. - Copyright 1990, 1992-1995, 1998, 1999 Free Software Foundation, Inc. + Copyright 1990, 1992-1995, 1998-2000 Free Software Foundation, Inc. Contributed by Cygnus Support. This file is part of GDB. @@ -549,7 +549,7 @@ cleanup_target (t) (int (*) (int, char *, char *, int *)) return_zero); de_fault (to_rcmd, - (void (*) (char *, struct gdb_file *)) + (void (*) (char *, struct ui_file *)) tcomplain); de_fault (to_enable_exception_callback, (struct symtab_and_line * (*) (enum exception_event_kind, int)) @@ -2892,7 +2892,7 @@ debug_to_query (type, req, resp, siz) static void debug_to_rcmd (char *command, - struct gdb_file *outbuf) + struct ui_file *outbuf) { debug_target.to_rcmd (command, outbuf); fprintf_unfiltered (gdb_stdlog, "target_rcmd (%s, ...)\n", command); diff --git a/gdb/target.h b/gdb/target.h index 5582223f8ac..a7dfe2bcb0f 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1,5 +1,5 @@ /* Interface between GDB and target environments, including files and processes - Copyright 1990, 91, 92, 93, 94, 1999 Free Software Foundation, Inc. + Copyright 1990-1994, 1999, 2000 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by John Gilmore. This file is part of GDB. @@ -425,7 +425,7 @@ struct target_ops char *(*to_extra_thread_info) PARAMS ((struct thread_info *)); void (*to_stop) PARAMS ((void)); int (*to_query) PARAMS ((int /*char */ , char *, char *, int *)); - void (*to_rcmd) (char *command, struct gdb_file *output); + void (*to_rcmd) (char *command, struct ui_file *output); struct symtab_and_line *(*to_enable_exception_callback) PARAMS ((enum exception_event_kind, int)); struct exception_event_record *(*to_get_current_exception_event) PARAMS ((void)); char *(*to_pid_to_exec_file) PARAMS ((int pid)); diff --git a/gdb/top.c b/gdb/top.c index c19818c3b41..8a26c9ec0b8 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1,6 +1,5 @@ /* Top level stuff for GDB, the GNU debugger. - Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999 - Free Software Foundation, Inc. + Copyright 1986-2000 Free Software Foundation, Inc. This file is part of GDB. @@ -840,7 +839,7 @@ void print_command_line (cmd, depth, stream) struct command_line *cmd; unsigned int depth; - GDB_FILE *stream; + struct ui_file *stream; { unsigned int i; @@ -2970,7 +2969,7 @@ document_command (comname, from_tty) /* Print the GDB banner. */ void print_gdb_version (stream) - GDB_FILE *stream; + struct ui_file *stream; { /* From GNU coding standards, first line is meant to be easy for a program to parse, and is just canonical program name and version diff --git a/gdb/top.h b/gdb/top.h index 36bf52b509a..9e962a350ba 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -1,6 +1,5 @@ /* Top level stuff for GDB, the GNU debugger. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994 - Free Software Foundation, Inc. + Copyright 1986-1994, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -28,7 +27,7 @@ extern int inhibit_gdbinit; extern int epoch_interface; extern char gdbinit[]; -extern void print_gdb_version PARAMS ((GDB_FILE *)); +extern void print_gdb_version (struct ui_file *); extern void source_command PARAMS ((char *, int)); extern void cd_command PARAMS ((char *, int)); diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index 8f8f17934ff..642b7cb71a1 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,9 @@ +Tue Feb 1 00:17:12 2000 Andrew Cagney + + * tui-file.c, tui-file.h, tuiDisassem.c, tuiIO.c, tuiIO.h, + tuiRegs.c: Update to reflect rename of gdb-file / GDB_FILE to + ui-file / ``struct ui_file''. + Mon Jan 31 18:12:43 2000 Andrew Cagney * tui-file.c (enum streamtype, struct tui_stream, tui_file_new, diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c index ae3f842e961..7822108de8a 100644 --- a/gdb/tui/tui-file.c +++ b/gdb/tui/tui-file.c @@ -1,4 +1,4 @@ -/* GDB_FILE - a generic STDIO like output stream. +/* UI_FILE - a generic STDIO like output stream. Copyright (C) 1999, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -19,16 +19,17 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" -#include "gdb-file.h" +#include "ui-file.h" #include "tui/tui-file.h" #include /* Called instead of fputs for all TUI_FILE output. */ -void (*fputs_unfiltered_hook) (const char *linebuffer, GDB_FILE * stream); +void (*fputs_unfiltered_hook) (const char *linebuffer, + struct ui_file * stream); -/* A ``struct gdb_file'' that is compatible with all the legacy +/* A ``struct ui_file'' that is compatible with all the legacy code. */ /* new */ @@ -48,35 +49,35 @@ struct tui_stream int ts_buflen; }; -static gdb_file_flush_ftype tui_file_flush; -extern gdb_file_fputs_ftype tui_file_fputs; -static gdb_file_isatty_ftype tui_file_isatty; -static gdb_file_rewind_ftype tui_file_rewind; -static gdb_file_put_ftype tui_file_put; -static gdb_file_delete_ftype tui_file_delete; -static struct gdb_file *tui_file_new PARAMS ((void)); +static ui_file_flush_ftype tui_file_flush; +extern ui_file_fputs_ftype tui_file_fputs; +static ui_file_isatty_ftype tui_file_isatty; +static ui_file_rewind_ftype tui_file_rewind; +static ui_file_put_ftype tui_file_put; +static ui_file_delete_ftype tui_file_delete; +static struct ui_file *tui_file_new PARAMS ((void)); static int tui_file_magic; -static struct gdb_file * +static struct ui_file * tui_file_new () { struct tui_stream *tui = xmalloc (sizeof (struct tui_stream)); - struct gdb_file *file = gdb_file_new (); - set_gdb_file_data (file, tui, tui_file_delete); - set_gdb_file_flush (file, tui_file_flush); - set_gdb_file_fputs (file, tui_file_fputs); - set_gdb_file_isatty (file, tui_file_isatty); - set_gdb_file_rewind (file, tui_file_rewind); - set_gdb_file_put (file, tui_file_put); + struct ui_file *file = ui_file_new (); + set_ui_file_data (file, tui, tui_file_delete); + set_ui_file_flush (file, tui_file_flush); + set_ui_file_fputs (file, tui_file_fputs); + set_ui_file_isatty (file, tui_file_isatty); + set_ui_file_rewind (file, tui_file_rewind); + set_ui_file_put (file, tui_file_put); tui->ts_magic = &tui_file_magic; return file; } static void tui_file_delete (file) - struct gdb_file *file; + struct ui_file *file; { - struct tui_stream *tmpstream = gdb_file_data (file); + struct tui_stream *tmpstream = ui_file_data (file); if (tmpstream->ts_magic != &tui_file_magic) internal_error ("tui_file_delete: bad magic number"); if ((tmpstream->ts_streamtype == astring) && @@ -87,12 +88,12 @@ tui_file_delete (file) free (tmpstream); } -struct gdb_file * +struct ui_file * tui_fileopen (stream) FILE *stream; { - struct gdb_file *file = tui_file_new (); - struct tui_stream *tmpstream = gdb_file_data (file); + struct ui_file *file = tui_file_new (); + struct tui_stream *tmpstream = ui_file_data (file); tmpstream->ts_streamtype = afile; tmpstream->ts_filestream = stream; tmpstream->ts_strbuf = NULL; @@ -100,12 +101,12 @@ tui_fileopen (stream) return file; } -struct gdb_file * +struct ui_file * tui_sfileopen (n) int n; { - struct gdb_file *file = tui_file_new (); - struct tui_stream *tmpstream = gdb_file_data (file); + struct ui_file *file = tui_file_new (); + struct tui_stream *tmpstream = ui_file_data (file); tmpstream->ts_streamtype = astring; tmpstream->ts_filestream = NULL; if (n > 0) @@ -123,9 +124,9 @@ tui_sfileopen (n) static int tui_file_isatty (file) - struct gdb_file *file; + struct ui_file *file; { - struct tui_stream *stream = gdb_file_data (file); + struct tui_stream *stream = ui_file_data (file); if (stream->ts_magic != &tui_file_magic) internal_error ("tui_file_isatty: bad magic number"); if (stream->ts_streamtype == afile) @@ -136,20 +137,20 @@ tui_file_isatty (file) static void tui_file_rewind (file) - struct gdb_file *file; + struct ui_file *file; { - struct tui_stream *stream = gdb_file_data (file); + struct tui_stream *stream = ui_file_data (file); if (stream->ts_magic != &tui_file_magic) internal_error ("tui_file_rewind: bad magic number"); stream->ts_strbuf[0] = '\0'; } static void -tui_file_put (struct gdb_file *file, - gdb_file_put_method_ftype *write, +tui_file_put (struct ui_file *file, + ui_file_put_method_ftype *write, void *dest) { - struct tui_stream *stream = gdb_file_data (file); + struct tui_stream *stream = ui_file_data (file); if (stream->ts_magic != &tui_file_magic) internal_error ("tui_file_put: bad magic number"); if (stream->ts_streamtype == astring) @@ -168,15 +169,15 @@ tui_file_put (struct gdb_file *file, void tui_file_fputs (linebuffer, file) const char *linebuffer; - GDB_FILE *file; + struct ui_file *file; { - struct tui_stream *stream = gdb_file_data (file); + struct tui_stream *stream = ui_file_data (file); #if defined(TUI) extern int tui_owns_terminal; #endif /* NOTE: cagney/1999-10-13: The use of fputs_unfiltered_hook is seriously discouraged. Those wanting to hook output should - instead implement their own gdb_file object and install that. See + instead implement their own ui_file object and install that. See also tui_file_flush(). */ if (fputs_unfiltered_hook && (file == gdb_stdout @@ -235,9 +236,9 @@ tui_file_fputs (linebuffer, file) } char * -tui_file_get_strbuf (struct gdb_file *file) +tui_file_get_strbuf (struct ui_file *file) { - struct tui_stream *stream = gdb_file_data (file); + struct tui_stream *stream = ui_file_data (file); if (stream->ts_magic != &tui_file_magic) internal_error ("tui_file_get_strbuf: bad magic number"); return (stream->ts_strbuf); @@ -246,9 +247,9 @@ tui_file_get_strbuf (struct gdb_file *file) /* adjust the length of the buffer by the amount necessary to accomodate appending a string of length N to the buffer contents */ void -tui_file_adjust_strbuf (int n, struct gdb_file *file) +tui_file_adjust_strbuf (int n, struct ui_file *file) { - struct tui_stream *stream = gdb_file_data (file); + struct tui_stream *stream = ui_file_data (file); int non_null_chars; if (stream->ts_magic != &tui_file_magic) internal_error ("tui_file_adjust_strbuf: bad magic number"); @@ -274,16 +275,16 @@ tui_file_adjust_strbuf (int n, struct gdb_file *file) static void tui_file_flush (file) - GDB_FILE *file; + struct ui_file *file; { - struct tui_stream *stream = gdb_file_data (file); + struct tui_stream *stream = ui_file_data (file); if (stream->ts_magic != &tui_file_magic) internal_error ("tui_file_flush: bad magic number"); /* NOTE: cagney/1999-10-12: If we've been linked with code that uses fputs_unfiltered_hook then we assume that it doesn't need to know about flushes. Code that does need to know about flushes can - implement a proper gdb_file object. */ + implement a proper ui_file object. */ if (fputs_unfiltered_hook) return; diff --git a/gdb/tui/tui-file.h b/gdb/tui/tui-file.h index c962d4ff714..acc019db6ca 100644 --- a/gdb/tui/tui-file.h +++ b/gdb/tui/tui-file.h @@ -1,4 +1,4 @@ -/* GDB_FILE - a generic STDIO like output stream. +/* UI_FILE - a generic STDIO like output stream. Copyright (C) 1999, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -21,14 +21,14 @@ #ifndef TUI_FILE_H #define TUI_FILE_H -extern struct gdb_file *tui_fileopen (FILE *); -extern struct gdb_file *tui_sfileopen (int); -extern char *tui_file_get_strbuf (struct gdb_file *); -extern void tui_file_adjust_strbuf (int, struct gdb_file *); +extern struct ui_file *tui_fileopen (FILE *); +extern struct ui_file *tui_sfileopen (int); +extern char *tui_file_get_strbuf (struct ui_file *); +extern void tui_file_adjust_strbuf (int, struct ui_file *); /* NOTE: cagney/1999-10-14: fputs_unfiltered_hook is deprecated. Code wanting to control GDB's output should override the gdb_std... files. */ extern void (*fputs_unfiltered_hook) (const char *linebuffer, - GDB_FILE * stream); + struct ui_file * stream); #endif diff --git a/gdb/tui/tuiDisassem.c b/gdb/tui/tuiDisassem.c index a39574b3890..a6df69432f5 100644 --- a/gdb/tui/tuiDisassem.c +++ b/gdb/tui/tuiDisassem.c @@ -43,7 +43,7 @@ tuiSetDisassemContent (s, startAddr) #endif { TuiStatus ret = TUI_FAILURE; - GDB_FILE *gdb_dis_out; + struct ui_file *gdb_dis_out; if (startAddr != (Opaque) NULL) { @@ -65,7 +65,7 @@ tuiSetDisassemContent (s, startAddr) lineWidth = disassemWin->generic.width - 1; threshold = (lineWidth - 1) + offset; - /* now init the gdb_file structure */ + /* now init the ui_file structure */ gdb_dis_out = tui_sfileopen (threshold); INIT_DISASSEMBLE_INFO_NO_ARCH (asmInfo, gdb_dis_out, (fprintf_ftype) fprintf_filtered); @@ -118,7 +118,7 @@ tuiSetDisassemContent (s, startAddr) /* reset the buffer to empty */ tui_file_get_strbuf (gdb_dis_out)[0] = '\0'; } - gdb_file_delete (gdb_dis_out); + ui_file_delete (gdb_dis_out); gdb_dis_out = NULL; disassemWin->generic.contentSize = curLine; ret = TUI_SUCCESS; diff --git a/gdb/tui/tuiIO.c b/gdb/tui/tuiIO.c index f443bd00b12..60a296526f8 100644 --- a/gdb/tui/tuiIO.c +++ b/gdb/tui/tuiIO.c @@ -50,11 +50,11 @@ void #ifdef __STDC__ tuiPuts_unfiltered ( const char *string, - GDB_FILE * stream) + struct ui_file * stream) #else tuiPuts_unfiltered (string, stream) char *string; - GDB_FILE *stream; + struct ui_file *stream; #endif { int len = strlen (string); diff --git a/gdb/tui/tuiIO.h b/gdb/tui/tuiIO.h index adb7b15da19..a1fe6a098ef 100644 --- a/gdb/tui/tuiIO.h +++ b/gdb/tui/tuiIO.h @@ -7,7 +7,7 @@ #include -extern void tuiPuts_unfiltered PARAMS ((const char *, GDB_FILE *)); +extern void tuiPuts_unfiltered (const char *, struct ui_file *); extern unsigned int tuiGetc PARAMS ((void)); extern unsigned int tuiBufferGetc PARAMS ((void)); extern int tuiRead PARAMS ((int, char *, int)); diff --git a/gdb/tui/tuiRegs.c b/gdb/tui/tuiRegs.c index 33d6079cf87..30dd906da9c 100644 --- a/gdb/tui/tuiRegs.c +++ b/gdb/tui/tuiRegs.c @@ -669,12 +669,12 @@ _tuiRegisterFormat (buf, bufLen, regNum, dataElement, precision) { char tmpBuf[15]; char *fmt; - GDB_FILE *stream; + struct ui_file *stream; stream = tui_sfileopen (bufLen); pa_do_strcat_registers_info (regNum, 0, stream, precision); strcpy (buf, tui_file_get_strbuf (stream)); - gdb_file_delete (stream); + ui_file_delete (stream); return; } /* _tuiRegisterFormat */ diff --git a/gdb/typeprint.c b/gdb/typeprint.c index e892e5e6da2..560c4a1d7fa 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -1,5 +1,5 @@ /* Language independent support for printing types for GDB, the GNU debugger. - Copyright 1986, 88, 89, 91, 92, 93, 1998 Free Software Foundation, Inc. + Copyright 1986, 1988, 1989, 1991-1993, 1998, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -64,7 +64,7 @@ void type_print (type, varstring, stream, show) struct type *type; char *varstring; - GDB_FILE *stream; + struct ui_file *stream; int show; { LA_PRINT_TYPE (type, varstring, stream, show, 0); @@ -197,7 +197,7 @@ void print_type_scalar (type, val, stream) struct type *type; LONGEST val; - GDB_FILE *stream; + struct ui_file *stream; { unsigned int i; unsigned len; diff --git a/gdb/typeprint.h b/gdb/typeprint.h index 0d13a3810b3..a0d44385ffe 100644 --- a/gdb/typeprint.h +++ b/gdb/typeprint.h @@ -1,5 +1,5 @@ /* Language independent support for printing types for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1999 + Copyright 1986, 1988, 1989, 1991-1993, 1999, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -19,8 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -void -print_type_scalar PARAMS ((struct type * type, LONGEST, GDB_FILE *)); +void print_type_scalar (struct type * type, LONGEST, struct ui_file *); -void -c_type_print_varspec_suffix PARAMS ((struct type *, GDB_FILE *, int, int, int)); +void c_type_print_varspec_suffix (struct type *, struct ui_file *, int, + int, int); diff --git a/gdb/ui-file.c b/gdb/ui-file.c new file mode 100644 index 00000000000..d077009956a --- /dev/null +++ b/gdb/ui-file.c @@ -0,0 +1,511 @@ +/* UI_FILE - a generic STDIO like output stream. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Implement the ``struct ui_file'' object. */ + +#include "defs.h" +#include "ui-file.h" + +#undef XMALLOC +#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) + +static ui_file_isatty_ftype null_file_isatty; +static ui_file_write_ftype null_file_write; +static ui_file_fputs_ftype null_file_fputs; +static ui_file_flush_ftype null_file_flush; +static ui_file_delete_ftype null_file_delete; +static ui_file_rewind_ftype null_file_rewind; +static ui_file_put_ftype null_file_put; + +struct ui_file + { + int *magic; + ui_file_flush_ftype *to_flush; + ui_file_write_ftype *to_write; + ui_file_fputs_ftype *to_fputs; + ui_file_delete_ftype *to_delete; + ui_file_isatty_ftype *to_isatty; + ui_file_rewind_ftype *to_rewind; + ui_file_put_ftype *to_put; + void *to_data; + }; +int ui_file_magic; + +struct ui_file * +ui_file_new () +{ + struct ui_file *file = xmalloc (sizeof (struct ui_file)); + file->magic = &ui_file_magic; + set_ui_file_data (file, NULL, null_file_delete); + set_ui_file_flush (file, null_file_flush); + set_ui_file_write (file, null_file_write); + set_ui_file_fputs (file, null_file_fputs); + set_ui_file_isatty (file, null_file_isatty); + set_ui_file_rewind (file, null_file_rewind); + set_ui_file_put (file, null_file_put); + return file; +} + +void +ui_file_delete (file) + struct ui_file *file; +{ + file->to_delete (file); + free (file); +} + +static int +null_file_isatty (file) + struct ui_file *file; +{ + return 0; +} + +static void +null_file_rewind (file) + struct ui_file *file; +{ + return; +} + +static void +null_file_put (struct ui_file *file, + ui_file_put_method_ftype *write, + void *dest) +{ + return; +} + +static void +null_file_flush (file) + struct ui_file *file; +{ + return; +} + +static void +null_file_write (struct ui_file *file, + const char *buf, + long sizeof_buf) +{ + if (file->to_fputs == null_file_fputs) + /* Both the write and fputs methods are null. Discard the + request. */ + return; + else + { + /* The fputs method isn't null, slowly pass the write request + onto that. FYI, this isn't as bad as it may look - the + current (as of 1999-11-07) printf_* function calls fputc and + fputc does exactly the below. By having a write function it + is possible to clean up that code. */ + int i; + char b[2]; + b[1] = '\0'; + for (i = 0; i < sizeof_buf; i++) + { + b[0] = buf[i]; + file->to_fputs (b, file); + } + return; + } +} + +static void +null_file_fputs (buf, file) + const char *buf; + struct ui_file *file; +{ + if (file->to_write == null_file_write) + /* Both the write and fputs methods are null. Discard the + request. */ + return; + else + { + /* The write method was implemented, use that. */ + file->to_write (file, buf, strlen (buf)); + } +} + +static void +null_file_delete (file) + struct ui_file *file; +{ + return; +} + +void * +ui_file_data (file) + struct ui_file *file; +{ + if (file->magic != &ui_file_magic) + internal_error ("ui_file_data: bad magic number"); + return file->to_data; +} + +void +gdb_flush (file) + struct ui_file *file; +{ + file->to_flush (file); +} + +int +ui_file_isatty (file) + struct ui_file *file; +{ + return file->to_isatty (file); +} + +void +ui_file_rewind (file) + struct ui_file *file; +{ + file->to_rewind (file); +} + +void +ui_file_put (struct ui_file *file, + ui_file_put_method_ftype *write, + void *dest) +{ + file->to_put (file, write, dest); +} + +void +ui_file_write (struct ui_file *file, + const char *buf, + long length_buf) +{ + file->to_write (file, buf, length_buf); +} + +void +fputs_unfiltered (buf, file) + const char *buf; + struct ui_file *file; +{ + file->to_fputs (buf, file); +} + +void +set_ui_file_flush (file, flush) + struct ui_file *file; + ui_file_flush_ftype *flush; +{ + file->to_flush = flush; +} + +void +set_ui_file_isatty (file, isatty) + struct ui_file *file; + ui_file_isatty_ftype *isatty; +{ + file->to_isatty = isatty; +} + +void +set_ui_file_rewind (file, rewind) + struct ui_file *file; + ui_file_rewind_ftype *rewind; +{ + file->to_rewind = rewind; +} + +void +set_ui_file_put (file, put) + struct ui_file *file; + ui_file_put_ftype *put; +{ + file->to_put = put; +} + +void +set_ui_file_write (struct ui_file *file, + ui_file_write_ftype *write) +{ + file->to_write = write; +} + +void +set_ui_file_fputs (file, fputs) + struct ui_file *file; + ui_file_fputs_ftype *fputs; +{ + file->to_fputs = fputs; +} + +void +set_ui_file_data (file, data, delete) + struct ui_file *file; + void *data; + ui_file_delete_ftype *delete; +{ + file->to_data = data; + file->to_delete = delete; +} + +/* ui_file utility function for converting a ``struct ui_file'' into + a memory buffer''. */ + +struct accumulated_ui_file +{ + char *buffer; + long length; +}; + +static void +do_ui_file_xstrdup (void *context, const char *buffer, long length) +{ + struct accumulated_ui_file *acc = context; + if (acc->buffer == NULL) + acc->buffer = xmalloc (length + 1); + else + acc->buffer = xrealloc (acc->buffer, acc->length + length + 1); + memcpy (acc->buffer + acc->length, buffer, length); + acc->length += length; + acc->buffer[acc->length] = '\0'; +} + +char * +ui_file_xstrdup (struct ui_file *file, + long *length) +{ + struct accumulated_ui_file acc; + acc.buffer = NULL; + acc.length = 0; + ui_file_put (file, do_ui_file_xstrdup, &acc); + if (acc.buffer == NULL) + acc.buffer = xstrdup (""); + *length = acc.length; + return acc.buffer; +} + +/* A pure memory based ``struct ui_file'' that can be used an output + buffer. The buffers accumulated contents are available via + ui_file_put(). */ + +struct mem_file + { + int *magic; + char *buffer; + int sizeof_buffer; + int length_buffer; + }; + +static ui_file_rewind_ftype mem_file_rewind; +static ui_file_put_ftype mem_file_put; +static ui_file_write_ftype mem_file_write; +static ui_file_delete_ftype mem_file_delete; +static struct ui_file *mem_file_new PARAMS ((void)); +static int mem_file_magic; + +static struct ui_file * +mem_file_new (void) +{ + struct mem_file *stream = XMALLOC (struct mem_file); + struct ui_file *file = ui_file_new (); + set_ui_file_data (file, stream, mem_file_delete); + set_ui_file_rewind (file, mem_file_rewind); + set_ui_file_put (file, mem_file_put); + set_ui_file_write (file, mem_file_write); + stream->magic = &mem_file_magic; + stream->buffer = NULL; + stream->sizeof_buffer = 0; + stream->length_buffer = 0; + return file; +} + +static void +mem_file_delete (struct ui_file *file) +{ + struct mem_file *stream = ui_file_data (file); + if (stream->magic != &mem_file_magic) + internal_error ("mem_file_delete: bad magic number"); + if (stream->buffer != NULL) + free (stream->buffer); + free (stream); +} + +struct ui_file * +mem_fileopen (void) +{ + return mem_file_new (); +} + +static void +mem_file_rewind (struct ui_file *file) +{ + struct mem_file *stream = ui_file_data (file); + if (stream->magic != &mem_file_magic) + internal_error ("mem_file_rewind: bad magic number"); + stream->length_buffer = 0; +} + +static void +mem_file_put (struct ui_file *file, + ui_file_put_method_ftype *write, + void *dest) +{ + struct mem_file *stream = ui_file_data (file); + if (stream->magic != &mem_file_magic) + internal_error ("mem_file_put: bad magic number"); + if (stream->length_buffer > 0) + write (dest, stream->buffer, stream->length_buffer); +} + +void +mem_file_write (struct ui_file *file, + const char *buffer, + long length_buffer) +{ + struct mem_file *stream = ui_file_data (file); + if (stream->magic != &mem_file_magic) + internal_error ("mem_file_write: bad magic number"); + if (stream->buffer == NULL) + { + stream->length_buffer = length_buffer; + stream->sizeof_buffer = length_buffer; + stream->buffer = xmalloc (stream->sizeof_buffer); + memcpy (stream->buffer, buffer, length_buffer); + } + else + { + int new_length = stream->length_buffer + length_buffer; + if (new_length >= stream->sizeof_buffer) + { + stream->sizeof_buffer = new_length; + stream->buffer = xrealloc (stream->buffer, stream->sizeof_buffer); + } + memcpy (stream->buffer + stream->length_buffer, buffer, length_buffer); + stream->length_buffer = new_length; + } +} + +/* ``struct ui_file'' implementation that maps directly onto + 's FILE. */ + +static ui_file_write_ftype stdio_file_write; +static ui_file_fputs_ftype stdio_file_fputs; +static ui_file_isatty_ftype stdio_file_isatty; +static ui_file_delete_ftype stdio_file_delete; +static struct ui_file *stdio_file_new PARAMS ((FILE * file, int close_p)); +static ui_file_flush_ftype stdio_file_flush; + +static int stdio_file_magic; + +struct stdio_file + { + int *magic; + FILE *file; + int close_p; + }; + +static struct ui_file * +stdio_file_new (file, close_p) + FILE *file; + int close_p; +{ + struct ui_file *ui_file = ui_file_new (); + struct stdio_file *stdio = xmalloc (sizeof (struct stdio_file)); + stdio->magic = &stdio_file_magic; + stdio->file = file; + stdio->close_p = close_p; + set_ui_file_data (ui_file, stdio, stdio_file_delete); + set_ui_file_flush (ui_file, stdio_file_flush); + set_ui_file_write (ui_file, stdio_file_write); + set_ui_file_fputs (ui_file, stdio_file_fputs); + set_ui_file_isatty (ui_file, stdio_file_isatty); + return ui_file; +} + +static void +stdio_file_delete (file) + struct ui_file *file; +{ + struct stdio_file *stdio = ui_file_data (file); + if (stdio->magic != &stdio_file_magic) + internal_error ("stdio_file_delete: bad magic number"); + if (stdio->close_p) + { + fclose (stdio->file); + } + free (stdio); +} + +static void +stdio_file_flush (file) + struct ui_file *file; +{ + struct stdio_file *stdio = ui_file_data (file); + if (stdio->magic != &stdio_file_magic) + internal_error ("stdio_file_flush: bad magic number"); + fflush (stdio->file); +} + +static void +stdio_file_write (struct ui_file *file, const char *buf, long length_buf) +{ + struct stdio_file *stdio = ui_file_data (file); + if (stdio->magic != &stdio_file_magic) + internal_error ("stdio_file_write: bad magic number"); + fwrite (buf, length_buf, 1, stdio->file); +} + +static void +stdio_file_fputs (linebuffer, file) + const char *linebuffer; + struct ui_file *file; +{ + struct stdio_file *stdio = ui_file_data (file); + if (stdio->magic != &stdio_file_magic) + internal_error ("stdio_file_fputs: bad magic number"); + fputs (linebuffer, stdio->file); +} + +static int +stdio_file_isatty (file) + struct ui_file *file; +{ + struct stdio_file *stdio = ui_file_data (file); + if (stdio->magic != &stdio_file_magic) + internal_error ("stdio_file_isatty: bad magic number"); + return (isatty (fileno (stdio->file))); +} + +/* Like fdopen(). Create a ui_file from a previously opened FILE. */ + +struct ui_file * +stdio_fileopen (file) + FILE *file; +{ + return stdio_file_new (file, 0); +} + +struct ui_file * +gdb_fopen (name, mode) + char *name; + char *mode; +{ + FILE *f = fopen (name, mode); + if (f == NULL) + return NULL; + return stdio_file_new (f, 1); +} diff --git a/gdb/ui-file.h b/gdb/ui-file.h new file mode 100644 index 00000000000..c805335bc5f --- /dev/null +++ b/gdb/ui-file.h @@ -0,0 +1,93 @@ +/* UI_FILE - a generic STDIO like output stream. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef UI_FILE_H +#define UI_FILE_H + +struct ui_file; + +/* Create a generic ui_file object with null methods. */ + +extern struct ui_file *ui_file_new (void); + +/* Override methods used by specific implementations of a UI_FILE + object. */ + +typedef void (ui_file_flush_ftype) (struct ui_file * stream); +extern void set_ui_file_flush (struct ui_file *stream, ui_file_flush_ftype * flush); + +/* NOTE: Both fputs and write methods are available. Default + implementations that mapping one onto the other are included. */ +typedef void (ui_file_write_ftype) (struct ui_file * stream, const char *buf, long length_buf); +extern void set_ui_file_write (struct ui_file *stream, ui_file_write_ftype *fputs); + +typedef void (ui_file_fputs_ftype) (const char *, struct ui_file * stream); +extern void set_ui_file_fputs (struct ui_file *stream, ui_file_fputs_ftype * fputs); + +typedef int (ui_file_isatty_ftype) (struct ui_file * stream); +extern void set_ui_file_isatty (struct ui_file *stream, ui_file_isatty_ftype * isatty); + +typedef void (ui_file_rewind_ftype) (struct ui_file * stream); +extern void set_ui_file_rewind (struct ui_file *stream, ui_file_rewind_ftype * rewind); + +typedef void (ui_file_put_method_ftype) (void *object, const char *buffer, long length_buffer); +typedef void (ui_file_put_ftype) (struct ui_file *stream, ui_file_put_method_ftype * method, void *context); +extern void set_ui_file_put (struct ui_file *stream, ui_file_put_ftype * put); + +typedef void (ui_file_delete_ftype) (struct ui_file * stream); +extern void set_ui_file_data (struct ui_file *stream, void *data, ui_file_delete_ftype * delete); + +extern void *ui_file_data (struct ui_file *file); + + +extern void gdb_flush (struct ui_file *); + +extern void ui_file_delete (struct ui_file *stream); + +extern void ui_file_rewind (struct ui_file *stream); + +extern int ui_file_isatty (struct ui_file *); + +extern void ui_file_write (struct ui_file *file, const char *buf, long length_buf); + +/* NOTE: copies left to right */ +extern void ui_file_put (struct ui_file *src, ui_file_put_method_ftype *write, void *dest); + +/* Returns a freshly allocated buffer containing the entire contents + of FILE (as determined by ui_file_put()) with a NUL character + appended. LENGTH is set to the size of the buffer minus that + appended NUL. */ +extern char *ui_file_xstrdup (struct ui_file *file, long *length); + + + +/* Create/open a memory based file. Can be used as a scratch buffer + for collecting output. */ +extern struct ui_file *mem_fileopen (void); + + + +/* Open/create a an STDIO based UI_FILE using the already open FILE. */ +extern struct ui_file *stdio_fileopen (FILE *file); + +/* Open NAME returning an STDIO based UI_FILE. */ +extern struct ui_file *gdb_fopen (char *name, char *mode); + +#endif diff --git a/gdb/utils.c b/gdb/utils.c index 1111eeacd25..2c8d4028493 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1,5 +1,6 @@ /* General utility routines for GDB, the GNU debugger. - Copyright 1986, 89, 90, 91, 92, 95, 96, 1998 Free Software Foundation, Inc. + Copyright 1986, 1989, 1990-1992, 1995, 1996, 1998, 2000 + Free Software Foundation, Inc. This file is part of GDB. @@ -57,14 +58,14 @@ void (*error_begin_hook) PARAMS ((void)); /* Holds the last error message issued by gdb */ -static GDB_FILE *gdb_lasterr; +static struct ui_file *gdb_lasterr; /* Prototypes for local functions */ -static void vfprintf_maybe_filtered PARAMS ((GDB_FILE *, const char *, - va_list, int)); +static void vfprintf_maybe_filtered (struct ui_file *, const char *, + va_list, int); -static void fputs_maybe_filtered PARAMS ((const char *, GDB_FILE *, int)); +static void fputs_maybe_filtered (const char *, struct ui_file *, int); #if defined (USE_MMALLOC) && !defined (NO_MMCHECK) static void malloc_botch PARAMS ((void)); @@ -79,10 +80,6 @@ set_width_command PARAMS ((char *, int, struct cmd_list_element *)); static void set_width PARAMS ((void)); -#ifndef GDB_FILE_ISATTY -#define GDB_FILE_ISATTY(GDB_FILE_PTR) (gdb_file_isatty(GDB_FILE_PTR)) -#endif - /* Chain of cleanup actions established with make_cleanup, to be executed if an error happens. */ @@ -213,15 +210,15 @@ make_cleanup_freeargv (arg) } static void -do_gdb_file_delete (void *arg) +do_ui_file_delete (void *arg) { - gdb_file_delete (arg); + ui_file_delete (arg); } struct cleanup * -make_cleanup_gdb_file_delete (struct gdb_file *arg) +make_cleanup_ui_file_delete (struct ui_file *arg) { - return make_my_cleanup (&cleanup_chain, do_gdb_file_delete, arg); + return make_my_cleanup (&cleanup_chain, do_ui_file_delete, arg); } struct cleanup * @@ -617,7 +614,7 @@ verror (const char *string, va_list args) va_list twice which works on some platforms and fails miserably on others. */ /* Save it as the last error */ - gdb_file_rewind (gdb_lasterr); + ui_file_rewind (gdb_lasterr); vfprintf_filtered (gdb_lasterr, string, args); /* Retrieve the last error and print it to gdb_stderr */ err_string = error_last_message (); @@ -638,10 +635,10 @@ error (const char *string,...) } NORETURN void -error_stream (GDB_FILE *stream) +error_stream (struct ui_file *stream) { long size; - char *msg = gdb_file_xstrdup (stream, &size); + char *msg = ui_file_xstrdup (stream, &size); make_cleanup (free, msg); error ("%s", msg); } @@ -652,7 +649,7 @@ char * error_last_message (void) { long len; - return gdb_file_xstrdup (gdb_lasterr, &len); + return ui_file_xstrdup (gdb_lasterr, &len); } /* This is to be called by main() at the very beginning */ @@ -1193,7 +1190,7 @@ mstrsave (md, ptr) void print_spaces (n, file) register int n; - register GDB_FILE *file; + register struct ui_file *file; { fputs_unfiltered (n_spaces (n), file); } @@ -1201,7 +1198,7 @@ print_spaces (n, file) /* Print a host address. */ void -gdb_print_host_address (void *addr, struct gdb_file *stream) +gdb_print_host_address (void *addr, struct ui_file *stream) { /* We could use the %p conversion specifier to fprintf if we had any @@ -1405,14 +1402,14 @@ parse_escape (string_ptr) be call for printing things which are independent of the language of the program being debugged. */ -static void printchar PARAMS ((int c, void (*do_fputs) (const char *, GDB_FILE*), void (*do_fprintf) (GDB_FILE*, const char *, ...), GDB_FILE *stream, int quoter)); +static void printchar (int c, void (*do_fputs) (const char *, struct ui_file*), void (*do_fprintf) (struct ui_file*, const char *, ...), struct ui_file *stream, int quoter); static void printchar (c, do_fputs, do_fprintf, stream, quoter) int c; - void (*do_fputs) PARAMS ((const char *, GDB_FILE*)); - void (*do_fprintf) PARAMS ((GDB_FILE*, const char *, ...)); - GDB_FILE *stream; + void (*do_fputs) PARAMS ((const char *, struct ui_file*)); + void (*do_fprintf) PARAMS ((struct ui_file*, const char *, ...)); + struct ui_file *stream; int quoter; { @@ -1467,7 +1464,7 @@ void fputstr_filtered (str, quoter, stream) const char *str; int quoter; - GDB_FILE *stream; + struct ui_file *stream; { while (*str) printchar (*str++, fputs_filtered, fprintf_filtered, stream, quoter); @@ -1477,7 +1474,7 @@ void fputstr_unfiltered (str, quoter, stream) const char *str; int quoter; - GDB_FILE *stream; + struct ui_file *stream; { while (*str) printchar (*str++, fputs_unfiltered, fprintf_unfiltered, stream, quoter); @@ -1488,7 +1485,7 @@ fputstrn_unfiltered (str, n, quoter, stream) const char *str; int n; int quoter; - GDB_FILE *stream; + struct ui_file *stream; { int i; for (i = 0; i < n; i++) @@ -1598,7 +1595,7 @@ init_page_info () #endif #endif /* If the output is not a terminal, don't paginate it. */ - if (!GDB_FILE_ISATTY (gdb_stdout)) + if (!ui_file_isatty (gdb_stdout)) lines_per_page = UINT_MAX; } /* the command_line_version */ set_width (); @@ -1788,7 +1785,7 @@ begin_line () static void fputs_maybe_filtered (linebuffer, stream, filter) const char *linebuffer; - GDB_FILE *stream; + struct ui_file *stream; int filter; { const char *lineptr; @@ -1892,7 +1889,7 @@ fputs_maybe_filtered (linebuffer, stream, filter) void fputs_filtered (linebuffer, stream) const char *linebuffer; - GDB_FILE *stream; + struct ui_file *stream; { fputs_maybe_filtered (linebuffer, stream, 1); } @@ -1902,24 +1899,24 @@ putchar_unfiltered (c) int c; { char buf = c; - gdb_file_write (gdb_stdout, &buf, 1); + ui_file_write (gdb_stdout, &buf, 1); return c; } int fputc_unfiltered (c, stream) int c; - GDB_FILE *stream; + struct ui_file *stream; { char buf = c; - gdb_file_write (stream, &buf, 1); + ui_file_write (stream, &buf, 1); return c; } int fputc_filtered (c, stream) int c; - GDB_FILE *stream; + struct ui_file *stream; { char buf[2]; @@ -2033,7 +2030,7 @@ puts_debug (prefix, string, suffix) static void vfprintf_maybe_filtered (stream, format, args, filter) - GDB_FILE *stream; + struct ui_file *stream; const char *format; va_list args; int filter; @@ -2055,7 +2052,7 @@ vfprintf_maybe_filtered (stream, format, args, filter) void vfprintf_filtered (stream, format, args) - GDB_FILE *stream; + struct ui_file *stream; const char *format; va_list args; { @@ -2064,7 +2061,7 @@ vfprintf_filtered (stream, format, args) void vfprintf_unfiltered (stream, format, args) - GDB_FILE *stream; + struct ui_file *stream; const char *format; va_list args; { @@ -2099,7 +2096,7 @@ vprintf_unfiltered (format, args) } void -fprintf_filtered (GDB_FILE * stream, const char *format,...) +fprintf_filtered (struct ui_file * stream, const char *format,...) { va_list args; va_start (args, format); @@ -2108,7 +2105,7 @@ fprintf_filtered (GDB_FILE * stream, const char *format,...) } void -fprintf_unfiltered (GDB_FILE * stream, const char *format,...) +fprintf_unfiltered (struct ui_file * stream, const char *format,...) { va_list args; va_start (args, format); @@ -2120,7 +2117,7 @@ fprintf_unfiltered (GDB_FILE * stream, const char *format,...) Called as fprintfi_filtered (spaces, stream, format, ...); */ void -fprintfi_filtered (int spaces, GDB_FILE * stream, const char *format,...) +fprintfi_filtered (int spaces, struct ui_file * stream, const char *format,...) { va_list args; va_start (args, format); @@ -2210,7 +2207,7 @@ n_spaces (n) void print_spaces_filtered (n, stream) int n; - GDB_FILE *stream; + struct ui_file *stream; { fputs_filtered (n_spaces (n), stream); } @@ -2224,7 +2221,7 @@ print_spaces_filtered (n, stream) void fprintf_symbol_filtered (stream, name, lang, arg_mode) - GDB_FILE *stream; + struct ui_file *stream; char *name; enum language lang; int arg_mode; @@ -2365,7 +2362,7 @@ initialize_utils () init_page_info (); /* If the output is not a terminal, don't paginate it. */ - if (!GDB_FILE_ISATTY (gdb_stdout)) + if (!ui_file_isatty (gdb_stdout)) lines_per_page = UINT_MAX; set_width_command ((char *) NULL, 0, c); diff --git a/gdb/v850ice.c b/gdb/v850ice.c index fc04e28fea7..4e187c0bea2 100644 --- a/gdb/v850ice.c +++ b/gdb/v850ice.c @@ -1,5 +1,5 @@ /* ICE interface for the NEC V850 for GDB, the GNU debugger. - Copyright 1996, Free Software Foundation, Inc. + Copyright 1996, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -107,7 +107,7 @@ static void ice_SimulateAddrLookup PARAMS ((char *, int)); static void ice_Simulate_SymLookup PARAMS ((char *, int)); -static void ice_fputs PARAMS ((const char *, GDB_FILE *)); +static void ice_fputs (const char *, struct ui_file *); static int ice_file PARAMS ((char *)); diff --git a/gdb/valprint.c b/gdb/valprint.c index 83ce1168f5f..cc1432be972 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1,5 +1,5 @@ /* Print values for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1998 + Copyright 1986, 1988, 1989, 1991-1994, 1998, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -40,8 +40,8 @@ static int partial_memory_read (CORE_ADDR memaddr, char *myaddr, int len, int *errnoptr); -static void print_hex_chars PARAMS ((GDB_FILE *, unsigned char *, - unsigned int)); +static void print_hex_chars (struct ui_file *, unsigned char *, + unsigned int); static void show_print PARAMS ((char *, int)); @@ -130,7 +130,7 @@ val_print (type, valaddr, embedded_offset, address, char *valaddr; int embedded_offset; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; @@ -167,7 +167,7 @@ val_print (type, valaddr, embedded_offset, address, int value_print (val, stream, format, pretty) value_ptr val; - GDB_FILE *stream; + struct ui_file *stream; int format; enum val_prettyprint pretty; { @@ -192,7 +192,7 @@ void val_print_type_code_int (type, valaddr, stream) struct type *type; char *valaddr; - GDB_FILE *stream; + struct ui_file *stream; { if (TYPE_LENGTH (type) > sizeof (LONGEST)) { @@ -240,10 +240,11 @@ val_print_type_code_int (type, valaddr, stream) */ #if defined (CC_HAS_LONG_LONG) && !defined (PRINTF_HAS_LONG_LONG) -static void print_decimal PARAMS ((GDB_FILE * stream, char *sign, int use_local, ULONGEST val_ulong)); +static void print_decimal (struct ui_file * stream, char *sign, + int use_local, ULONGEST val_ulong); static void print_decimal (stream, sign, use_local, val_ulong) - GDB_FILE *stream; + struct ui_file *stream; char *sign; int use_local; ULONGEST val_ulong; @@ -280,7 +281,7 @@ print_decimal (stream, sign, use_local, val_ulong) void print_longest (stream, format, use_local, val_long) - GDB_FILE *stream; + struct ui_file *stream; int format; int use_local; LONGEST val_long; @@ -567,7 +568,7 @@ void print_floating (valaddr, type, stream) char *valaddr; struct type *type; - GDB_FILE *stream; + struct ui_file *stream; { DOUBLEST doub; int inv; @@ -675,7 +676,7 @@ print_floating (valaddr, type, stream) void print_binary_chars (stream, valaddr, len) - GDB_FILE *stream; + struct ui_file *stream; unsigned char *valaddr; unsigned len; { @@ -739,7 +740,7 @@ print_binary_chars (stream, valaddr, len) */ void print_octal_chars (stream, valaddr, len) - GDB_FILE *stream; + struct ui_file *stream; unsigned char *valaddr; unsigned len; { @@ -890,7 +891,7 @@ print_octal_chars (stream, valaddr, len) */ void print_decimal_chars (stream, valaddr, len) - GDB_FILE *stream; + struct ui_file *stream; unsigned char *valaddr; unsigned len; { @@ -1033,7 +1034,7 @@ print_decimal_chars (stream, valaddr, len) static void print_hex_chars (stream, valaddr, len) - GDB_FILE *stream; + struct ui_file *stream; unsigned char *valaddr; unsigned len; { @@ -1078,7 +1079,7 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref, struct type *type; char *valaddr; CORE_ADDR address; - GDB_FILE *stream; + struct ui_file *stream; int format; int deref_ref; int recurse; @@ -1206,7 +1207,7 @@ val_print_string (addr, len, width, stream) CORE_ADDR addr; int len; int width; - GDB_FILE *stream; + struct ui_file *stream; { int force_ellipsis = 0; /* Force ellipsis to be printed if nonzero. */ int errcode; /* Errno returned from bad reads. */ diff --git a/gdb/valprint.h b/gdb/valprint.h index fa4860ad53c..a6a3cfa7dc7 100644 --- a/gdb/valprint.h +++ b/gdb/valprint.h @@ -1,6 +1,5 @@ /* Declarations for value printing routines for GDB, the GNU debugger. - Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994 - Free Software Foundation, Inc. + Copyright 1986, 1988, 1989, 1991-1994, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -36,19 +35,18 @@ extern int output_format; extern int stop_print_at_null; /* Stop printing at null char? */ -extern void -val_print_array_elements PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *, - int, int, int, enum val_prettyprint, - unsigned int)); +extern void val_print_array_elements (struct type *, char *, CORE_ADDR, + struct ui_file *, int, int, int, + enum val_prettyprint, unsigned int); -extern void -val_print_type_code_int PARAMS ((struct type *, char *, GDB_FILE *)); +extern void val_print_type_code_int (struct type *, char *, + struct ui_file *); -extern void -print_binary_chars PARAMS ((GDB_FILE *, unsigned char *, unsigned int)); +extern void print_binary_chars (struct ui_file *, unsigned char *, + unsigned int); -extern void -print_octal_chars PARAMS ((GDB_FILE *, unsigned char *, unsigned int)); +extern void print_octal_chars (struct ui_file *, unsigned char *, + unsigned int); -extern void -print_decimal_chars PARAMS ((GDB_FILE *, unsigned char *, unsigned int)); +extern void print_decimal_chars (struct ui_file *, unsigned char *, + unsigned int); diff --git a/gdb/value.h b/gdb/value.h index d1b68911379..ab22573a480 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -1,6 +1,5 @@ /* Definitions for values of C expressions, for GDB. - Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996 - Free Software Foundation, Inc. + Copyright 1986, 1987, 1989, 1992-1996, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -245,8 +244,7 @@ struct internalvar struct frame_info; struct fn_field; -extern void -print_address_demangle PARAMS ((CORE_ADDR, GDB_FILE *, int)); +extern void print_address_demangle (CORE_ADDR, struct ui_file *, int); extern LONGEST value_as_long PARAMS ((value_ptr val)); @@ -487,47 +485,46 @@ extern void get_saved_register PARAMS ((char *raw_buffer, int *optimized, extern void modify_field PARAMS ((char *addr, LONGEST fieldval, int bitpos, int bitsize)); -extern void -type_print PARAMS ((struct type * type, char *varstring, GDB_FILE * stream, - int show)); +extern void type_print (struct type * type, char *varstring, + struct ui_file * stream, int show); extern char *baseclass_addr PARAMS ((struct type * type, int index, char *valaddr, value_ptr * valuep, int *errp)); -extern void -print_longest PARAMS ((GDB_FILE * stream, int format, int use_local, - LONGEST val)); +extern void print_longest (struct ui_file * stream, int format, + int use_local, LONGEST val); -extern void -print_floating PARAMS ((char *valaddr, struct type * type, GDB_FILE * stream)); +extern void print_floating (char *valaddr, struct type * type, + struct ui_file * stream); -extern int value_print PARAMS ((value_ptr val, GDB_FILE * stream, int format, - enum val_prettyprint pretty)); +extern int value_print (value_ptr val, struct ui_file *stream, int format, + enum val_prettyprint pretty); -extern void -value_print_array_elements PARAMS ((value_ptr val, GDB_FILE * stream, - int format, enum val_prettyprint pretty)); +extern void value_print_array_elements (value_ptr val, + struct ui_file *stream, + int format, + enum val_prettyprint pretty); extern value_ptr value_release_to_mark PARAMS ((value_ptr mark)); -extern int -val_print PARAMS ((struct type * type, char *valaddr, int embedded_offset, CORE_ADDR address, - GDB_FILE * stream, int format, int deref_ref, - int recurse, enum val_prettyprint pretty)); +extern int val_print (struct type * type, char *valaddr, + int embedded_offset, CORE_ADDR address, + struct ui_file * stream, int format, + int deref_ref, int recurse, + enum val_prettyprint pretty); -extern int -val_print_string PARAMS ((CORE_ADDR addr, int len, int width, GDB_FILE * stream)); +extern int val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream); -extern void -print_variable_value PARAMS ((struct symbol * var, struct frame_info * frame, - GDB_FILE * stream)); +extern void print_variable_value (struct symbol * var, + struct frame_info * frame, + struct ui_file *stream); extern int check_field PARAMS ((value_ptr, const char *)); -extern void -c_typedef_print PARAMS ((struct type * type, struct symbol * news, GDB_FILE * stream)); +extern void c_typedef_print (struct type * type, struct symbol * news, + struct ui_file * stream); extern char * internalvar_name PARAMS ((struct internalvar * var)); -- 2.30.2