This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: [RFA] New ui_file streams for Insight
- To: "Martin M. Hunt" <hunt at redhat dot com>
- Subject: Re: [RFA] New ui_file streams for Insight
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Sun, 1 Apr 2001 15:52:47 -0400 (EDT)
- Cc: <gdb at sources dot redhat dot com>, <insight at sources dot redhat dot com>
- References: <Pine.SUN.4.33.0103310011540.11938-100000@rtl.cygnus.com>
Martin M. Hunt writes:
> Here are my first set of changes to add support for multiple streams to
> Insight. Instead of using the tui code and copying gdb_stdlog and
> gdb_stdtarg to gdb_stdout, it creates unique ui_files for each. Currently
> Insight will simple write stderr, stdlog, and stdtarg to the console
> window (if it is open). stderr messages appear in red, stdlog in green,
> and stdtarg in blue.
>
> In main.c, I moved the creation of the gdbtk ui_files until after the
> arguments are parsed. I don't see that this would cause problems,
> although I don't see why any of the ui_files are created before the
> command line is processed.
>
OK, approved. But, I believe the comments and FIXME still apply to the
TUI case, right? I think they should be left in there, in the #ifdef
TUI parts.
Elena
> 2001-03-30 Martin M. Hunt <hunt@redhat.com>
>
> * main.c (captured_main): For GDBtk, don't use tui_fileopen().
> Instead, wait until ars are processed, then if use_windows
> is set, replace the gdb_stdout and gdb_stderr with gdbtk
> ui_files.
>
>
> Index: main.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/main.c,v
> retrieving revision 1.7
> diff -u -p -r1.7 main.c
> --- main.c 2001/03/06 08:21:10 1.7
> +++ main.c 2001/03/31 08:09:18
> @@ -35,10 +35,11 @@
> #include "gdb_string.h"
> #include "event-loop.h"
> #include "ui-out.h"
> -#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. */
> +
> +#if defined (TUI)
> #include "tui/tui-file.h"
> +#elif defined (GDBTK)
> +extern struct ui_file *gdbtk_fileopen ();
> #endif
>
> /* If nonzero, display time usage both at startup and for each command. */
> @@ -199,10 +200,7 @@ captured_main (void *data)
> 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 UI_FILE object and re-initializing
> - within its own _initialize function. */
> +#if defined (TUI)
> gdb_stdout = tui_fileopen (stdout);
> gdb_stderr = tui_fileopen (stderr);
> gdb_stdlog = gdb_stdout; /* for moment */
> @@ -493,6 +491,17 @@ extern int gdbtk_test (char *);
> /* Should this be moved to tui-top.c:_initialize_tui()? */
> if (tui_version)
> init_ui_hook = tuiInit;
> +#elif defined(GDBTK)
> + if (use_windows)
> + {
> + /* close old output and send new to GDBTK */
> + ui_file_delete (gdb_stdout);
> + ui_file_delete (gdb_stderr);
> + gdb_stdout = gdbtk_fileopen ();
> + gdb_stderr = gdbtk_fileopen ();
> + gdb_stdlog = gdbtk_fileopen ();
> + gdb_stdtarg = gdbtk_fileopen ();
> + }
> #endif
>
> /* Initialize all files. Give the interpreter a chance to take