This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: Eliminate flush_hook...
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Subject: Re: Eliminate flush_hook...
- From: James Ingham <jingham at cygnus dot com>
- Date: Wed, 13 Oct 1999 09:49:55 -0700 (PDT)
- Cc: GDB Patches <gdb-patches at sourceware dot cygnus dot com>, "Insight (GDB GUI)" <insight at sourceware dot cygnus dot com>
- References: <3804470B.4B043B05@cygnus.com>
Andrew,
Fine by me.
Jim
> OK?
>
> This eliminates the flush_hook. New code should be implementing the
> ``struct gdb_file'' object. The old code never did anything useful with
> flush_hook.
>
> Andrew
>
>
> --
>
> The patch is in three parts: gdb, tui, insight.
>
> Wed Oct 13 17:58:20 1999 Andrew Cagney <cagney@b1.cygnus.com>
>
> * gdb-events.sh: Update
>
> * utils.c (tui_file_flush): Don't call flush_hook. Don't try to
> flush ``astring''.
>
> * top.c (flush_hook): Delete.
>
>
> Wed Oct 13 18:01:52 1999 Andrew Cagney <cagney@b1.cygnus.com>
>
> * tui.c (tuiInit): Don't initialize ``flush_hook''.
>
>
> Wed Oct 13 17:57:17 1999 Andrew Cagney <cagney@b1.cygnus.com>
>
> * gdbtk-hooks.c (gdbtk_flush): Delete.
> (gdbtk_add_hooks): Don't initialize flush_hook.
>
> --Wed Oct 13 17:58:20 1999 Andrew Cagney <cagney@b1.cygnus.com>
>
> * gdb-events.sh: Update
>
> * utils.c (tui_file_flush): Don't call flush_hook. Don't try to
> flush ``astring''.
>
> * top.c (flush_hook): Delete.
>
> Index: gdb-events.sh
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/gdb-events.sh,v
> retrieving revision 2.1
> diff -p -r2.1 gdb-events.sh
> *** gdb-events.sh 1999/08/29 00:06:42 2.1
> --- gdb-events.sh 1999/10/13 08:29:52
> *************** f:void:breakpoint_modify:int b:b
> *** 77,83 ****
> #*: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
> - #*:void:flush_hook:GDB_FILE *stream:stream
> #*:void:target_output_hook:char *b:b
> #*:void:interactive_hook:void
> #*:void:registers_changed_hook:void
> --- 77,82 ----
> Index: top.c
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/top.c,v
> retrieving revision 2.164
> diff -p -r2.164 top.c
> *** top.c 1999/10/04 18:47:16 2.164
> --- top.c 1999/10/13 08:30:05
> *************** int (*query_hook) PARAMS ((const char *,
> *** 397,406 ****
>
> void (*warning_hook) PARAMS ((const char *, va_list));
>
> - /* Called from gdb_flush to flush output. */
> -
> - void (*flush_hook) PARAMS ((GDB_FILE * stream));
> -
> /* These three functions support getting lines of text from the user. They
> are used in sequence. First readline_begin_hook is called with a text
> string that might be (for example) a message for the user to type in a
> --- 397,402 ----
> Index: utils.c
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/utils.c,v
> retrieving revision 1.211
> diff -p -r1.211 utils.c
> *** utils.c 1999/10/04 18:47:16 1.211
> --- utils.c 1999/10/13 08:30:12
> *************** tui_file_fputs (linebuffer, file)
> *** 1875,1886 ****
> #if defined(TUI)
> extern int tui_owns_terminal;
> #endif
> ! /* If anything (GUI, TUI) wants to capture GDB output, this is
> ! * the place... the way to do it is to set up
> ! * fputs_unfiltered_hook.
> ! * Our TUI ("gdb -tui") used to hook output, but in the
> ! * new (XDB style) scheme, we do not do that anymore... - RT
> ! */
> if (fputs_unfiltered_hook
> && (file == gdb_stdout
> || file == gdb_stderr))
> --- 1875,1884 ----
> #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
> ! also tui_file_flush(). */
> if (fputs_unfiltered_hook
> && (file == gdb_stdout
> || file == gdb_stderr))
> *************** tui_file_flush (file)
> *** 2028,2043 ****
> {
> struct tui_stream *stream = gdb_file_data (file);
> if (stream->ts_magic != &tui_file_magic)
> ! error ("Internal error: bad magic number");
> ! if (flush_hook
> ! && (file == gdb_stdout
> ! || file == gdb_stderr))
> {
> ! flush_hook (file);
> ! return;
> }
> -
> - fflush (stream->ts_filestream);
> }
>
> void
> --- 2026,2046 ----
> {
> struct tui_stream *stream = gdb_file_data (file);
> if (stream->ts_magic != &tui_file_magic)
> ! internal_error ("tui_file_flush: bad magic number");
> !
> ! /* NOTE: cagney/1999-10-12: If this was hooked then don't bother
> ! with flush. */
> ! if (fputs_unfiltered_hook)
> ! return;
> !
> ! switch (stream->ts_streamtype)
> {
> ! case astring:
> ! break;
> ! case afile:
> ! fflush (stream->ts_filestream);
> ! break;
> }
> }
>
> void
> Wed Oct 13 18:01:52 1999 Andrew Cagney <cagney@b1.cygnus.com>
>
> * tui.c (tuiInit): Don't initialize ``flush_hook''.
>
> Index: tui/tui.c
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/tui/tui.c,v
> retrieving revision 1.3
> diff -p -r1.3 tui.c
> *** tui.c 1999/07/07 23:52:45 1.3
> --- tui.c 1999/10/13 08:30:17
> *************** tuiInit (argv0)
> *** 85,91 ****
> * the bottom of the screen (tuiTermUnsetup()).
> */
> fputs_unfiltered_hook = NULL;
> - flush_hook = NULL;
> rl_initialize (); /* need readline initialization to
> * create termcap sequences
> */
> --- 85,90 ----
> Wed Oct 13 17:57:17 1999 Andrew Cagney <cagney@b1.cygnus.com>
>
> * gdbtk-hooks.c (gdbtk_flush): Delete.
> (gdbtk_add_hooks): Don't initialize flush_hook.
>
> Index: gdbtk-hooks.c
> ===================================================================
> RCS file: /cvs/cvsfiles/devo/gdb/gdbtk-hooks.c,v
> retrieving revision 2.29
> diff -p -r2.29 gdbtk-hooks.c
> *** gdbtk-hooks.c 1999/09/23 22:46:57 2.29
> --- gdbtk-hooks.c 1999/10/13 08:29:54
> *************** static void gdbtk_warning PARAMS ((const
> *** 92,98 ****
> static char *gdbtk_readline PARAMS ((char *));
> static void gdbtk_readline_begin (char *format,...);
> static void gdbtk_readline_end PARAMS ((void));
> - static void gdbtk_flush PARAMS ((GDB_FILE *));
> static void gdbtk_pre_add_symbol PARAMS ((char *));
> static void gdbtk_print_frame_info PARAMS ((struct symtab *, int, int, int));
> static void gdbtk_post_add_symbol PARAMS ((void));
> --- 92,97 ----
> *************** gdbtk_add_hooks (void)
> *** 133,139 ****
> print_frame_info_listing_hook = gdbtk_print_frame_info;
> query_hook = gdbtk_query;
> warning_hook = gdbtk_warning;
> - flush_hook = gdbtk_flush;
>
> create_breakpoint_hook = gdbtk_create_breakpoint;
> delete_breakpoint_hook = gdbtk_delete_breakpoint;
> --- 132,137 ----
> *************** gdbtk_add_hooks (void)
> *** 169,176 ****
> }
>
> /* These control where to put the gdb output which is created by
> ! {f}printf_{un}filtered and friends. gdbtk_fputs and gdbtk_flush are the
> ! lowest level of these routines and capture all output from the rest of GDB.
>
> The reason to use the result_ptr rather than the gdbtk_interp's result
> directly is so that a call_wrapper invoked function can preserve its result
> --- 167,175 ----
> }
>
> /* These control where to put the gdb output which is created by
> ! {f}printf_{un}filtered and friends. gdbtk_fputs is the lowest
> ! level of these routines and capture all output from the rest of
> ! GDB.
>
> The reason to use the result_ptr rather than the gdbtk_interp's result
> directly is so that a call_wrapper invoked function can preserve its result
> *************** gdbtk_two_elem_cmd (cmd_name, argv1)
> *** 211,227 ****
> report_error ();
> free (command);
> return result;
> - }
> -
> - static void
> - gdbtk_flush (stream)
> - GDB_FILE *stream;
> - {
> - #if 0
> - /* Force immediate screen update */
> -
> - Tcl_VarEval (gdbtk_interp, "gdbtk_tcl_flush", NULL);
> - #endif
> }
>
> /* This handles all the output from gdb. All the gdb printf_xxx functions
> --- 210,215 ----