This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

New files gdb-file.[hc] tui/tui-file.[hc]


Hello,

I've finally taken to defs.h and utils.c with a knife and choped out the
gdb-file code.  I've attatched a patch containing edited highlights from
the change.

You'll notice that non-gdbtk / non-tui platforms now use the very simple
STDIO implementation of the gdb-file.  This reduces the size of gdb a
tiny bit :-)

I've also almost managed to delete the fputs_unfiltered_hook - its been
moved to the tui-file where GDBtk and the TUI can continue to use it.

	enjoy,
		Andrew
ChangeLog:
Mon Jan 31 17:14:52 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* top.c (fputs_unfiltered_hook): Moved to tui/tui-file.c.

	* main.c (captured_main): Only use the legacy tui_file code when
 	linking in older code such as the TUI.

	* gdb-file.h, gdb-file.c: New files.
	* utils.c, defs.h (struct gdb_file, gdb_file_new, gdb_file_delete,
 	null_file_isatty, null_file_rewind, null_file_put,
 	null_file_flush, null_file_write, null_file_fputs,
 	null_file_delete, gdb_file_data, gdb_flush, gdb_file_isatty,
 	gdb_file_rewind, gdb_file_put, gdb_file_write, fputs_unfiltered,
 	set_gdb_file_flush, set_gdb_file_isatty, set_gdb_file_rewind,
 	set_gdb_file_put, set_gdb_file_write, set_gdb_file_fputs,
 	set_gdb_file_data, struct accumulated_gdb_file,
 	do_gdb_file_xstrdup, gdb_file_xstrdup, struct mem_file):
 	mem_file_new, mem_file_delete, mem_fileopen, mem_file_rewind,
 	mem_file_put, mem_file_write, struct stdio_file): stdio_file_new,
 	stdio_file_delete, stdio_file_flush, stdio_file_write,
 	stdio_file_fputs, stdio_file_isatty, stdio_fileopen, gdb_fopen):
 	Moved to gdb-file.h and gdb-file.c.
	* utils.c (enum streamtype, struct tui_stream, tui_file_new,
 	tui_file_delete, tui_fileopen, tui_sfileopen, tui_file_isatty,
 	tui_file_rewind, tui_file_put, tui_file_fputs,
 	tui_file_get_strbuf, tui_file_adjust_strbuf, tui_file_flush,
	fputs_unfiltered_hook):
 	Moved to tui/tui-file.c and tui/tui-file.h.
	
	* Makefile.in (COMMON_OBS): Add gdb-file.o, tui-file.o.
	(tui-file.o, gdb-file.o): Add dependencies.
	(corefile.o, main.o, utils.o, simmisc.o): Update dependencies.
	* main.c: #include tui/tui-file.h.

ChangeLog-gdbtk:
Mon Jan 31 18:32:06 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* gdbtk-cmds.c, gdbtk.c: Include "tui/tui-file.h"

tui/ChangeLog:
Mon Jan 31 18:12:43 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* tui-file.c (enum streamtype, struct tui_stream, tui_file_new,
 	tui_file_delete, tui_fileopen, tui_sfileopen, tui_file_isatty,
 	tui_file_rewind, tui_file_put, tui_file_fputs,
 	tui_file_get_strbuf, tui_file_adjust_strbuf, tui_file_flush,
 	fputs_unfiltered_hook): Move to here from ../utils.c

	* tui-file.h, tui-file.c: New files.

Index: Makefile.in
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/Makefile.in,v
retrieving revision 1.739
diff -p -r1.739 Makefile.in
*** Makefile.in	2000/01/18 17:23:49	1.739
--- Makefile.in	2000/01/31 09:07:11
*************** SFILES = ax-general.c ax-gdb.c bcache.c 
*** 475,481 ****
  	tui/tuiGeneralWin.h tui/tuiIO.c tui/tuiIO.h tui/tuiLayout.c \
  	tui/tuiLayout.h tui/tuiRegs.c tui/tuiRegs.h tui/tuiSource.c \
  	tui/tuiSource.h tui/tuiSourceWin.c tui/tuiSourceWin.h \
! 	tui/tuiStack.c tui/tuiStack.h tui/tuiWin.c tui/tuiWin.h
  
  LINTFILES = $(SFILES) $(YYFILES) @CONFIG_SRCS@ init.c
  
--- 475,483 ----
  	tui/tuiGeneralWin.h tui/tuiIO.c tui/tuiIO.h tui/tuiLayout.c \
  	tui/tuiLayout.h tui/tuiRegs.c tui/tuiRegs.h tui/tuiSource.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
  
  LINTFILES = $(SFILES) $(YYFILES) @CONFIG_SRCS@ init.c
  
*************** command_h =	command.h
*** 524,530 ****
  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
  
  top_h =		top.h
  inferior_h =	inferior.h $(breakpoint_h)
--- 526,532 ----
  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
  
  top_h =		top.h
  inferior_h =	inferior.h $(breakpoint_h)
*************** COMMON_OBS = version.o blockframe.o brea
*** 622,628 ****
  	scm-exp.o scm-lang.o scm-valprint.o complaints.o typeprint.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
  
  OBS = $(COMMON_OBS) $(ANNOTATE_OBS)
  
--- 624,631 ----
  	scm-exp.o scm-lang.o scm-valprint.o complaints.o typeprint.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
  
  OBS = $(COMMON_OBS) $(ANNOTATE_OBS)
  
*************** m88k-tdep.o: m88k-tdep.c $(defs_h) $(gdb
*** 1478,1484 ****
  
  mac-nat.o: mac-nat.c $(defs_h) gdb_string.h
  
! main.o: main.c top.h $(defs_h) gdb_string.h $(event_loop_h)
  
  maint.o: maint.c $(defs_h) $(gdbcmd_h) $(gdbtypes_h) $(symtab_h) language.h \
  	$(expression_h) objfiles.h symfile.h
--- 1481,1487 ----
  
  mac-nat.o: mac-nat.c $(defs_h) gdb_string.h
  
! main.o: main.c top.h $(defs_h) gdb_string.h $(event_loop_h) tui/tui-file.h
  
  maint.o: maint.c $(defs_h) $(gdbcmd_h) $(gdbtypes_h) $(symtab_h) language.h \
  	$(expression_h) objfiles.h symfile.h
*************** stabsread.o: stabsread.c $(bfd_h) $(INCL
*** 1779,1784 ****
--- 1782,1791 ----
  
  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
+ tui-file.o: $(srcdir)/tui/tui-file.c $(defs_h) $(srcdir)/tui/tui-file.h
+ 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/tui/tui-file.c
  
  ax-general.o: ax-general.c $(ax_h) $(defs_h) $(value_h)
  ax-gdb.o: ax-gdb.c $(defs_h) $(symtab_h) symfile.h $(gdbtypes_h) \
Index: gdbtk-cmds.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbtk-cmds.c,v
retrieving revision 2.66
diff -p -r2.66 gdbtk-cmds.c
*** gdbtk-cmds.c	2000/01/02 14:23:15	2.66
--- gdbtk-cmds.c	2000/01/31 09:07:46
***************
*** 36,41 ****
--- 36,42 ----
  #include "tracepoint.h"
  #include "demangle.h"
  #include "frame.h"
+ #include "tui/tui-file.h"
  
  #include <sys/stat.h>
  
Index: gdbtk.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbtk.c,v
retrieving revision 2.146
diff -p -r2.146 gdbtk.c
*** gdbtk.c	1999/11/23 03:40:27	2.146
--- gdbtk.c	2000/01/31 09:07:50
***************
*** 32,37 ****
--- 32,38 ----
  #include "tracepoint.h"
  #include "demangle.h"
  #include "version.h"
+ #include "tui/tui-file.h"
  
  #ifdef _WIN32
  #define WIN32_LEAN_AND_MEAN
Index: main.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/main.c,v
retrieving revision 1.197
diff -p -r1.197 main.c
*** main.c	1999/12/13 16:07:40	1.197
--- main.c	2000/01/31 09:07:53
***************
*** 36,41 ****
--- 36,46 ----
  
+ #if defined (TUI) || defined (GDBTK)
+ /* FIXME: cagney/2000-01-31: This #include is to allow older code such
+    as that found in the TUI to continue to build. */
+ #include "tui/tui-file.h"
+ #endif
  
  /* If nonzero, display time usage both at startup and for each command.  */
  
*************** captured_main (void *data)
*** 195,210 ****
    getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
    current_directory = gdb_dirbuf;
  
! #if 0
!   /* not yet */
!   gdb_stdout = stdio_fileopen (stdout);
!   gdb_stderr = stdio_fileopen (stderr);
!   gdb_stdlog = gdb_stderr;	/* for moment */
!   gdb_stdtarg = gdb_stderr;	/* for moment */
! #else
    gdb_stdout = tui_fileopen (stdout);
    gdb_stderr = tui_fileopen (stderr);
    gdb_stdlog = gdb_stdout;	/* for moment */
    gdb_stdtarg = gdb_stderr;	/* for moment */
  #endif
  
--- 200,217 ----
    getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
    current_directory = gdb_dirbuf;
  
! #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
!      within its own _initialize function.  */
    gdb_stdout = tui_fileopen (stdout);
    gdb_stderr = tui_fileopen (stderr);
    gdb_stdlog = gdb_stdout;	/* for moment */
+   gdb_stdtarg = gdb_stderr;	/* for moment */
+ #else
+   gdb_stdout = stdio_fileopen (stdout);
+   gdb_stderr = stdio_fileopen (stderr);
+   gdb_stdlog = gdb_stderr;	/* for moment */
    gdb_stdtarg = gdb_stderr;	/* for moment */
  #endif
  
Index: top.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/top.c,v
retrieving revision 2.171
diff -p -r2.171 top.c
*** top.c	1999/12/13 16:07:39	2.171
--- top.c	2000/01/31 09:08:02
*************** int (*ui_loop_hook) PARAMS ((int));
*** 382,391 ****
  void (*command_loop_hook) PARAMS ((void));
  
  
- /* Called instead of fputs for all output.  */
- 
- void (*fputs_unfiltered_hook) PARAMS ((const char *linebuffer, GDB_FILE * stream));
- 
  /* Called from print_frame_info to list the line we stopped in.  */
  
  void (*print_frame_info_listing_hook) PARAMS ((struct symtab * s, int line,
--- 382,387 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]