This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] uiout fix for Insight
- To: "Martin M. Hunt" <hunt at redhat dot com>
- Subject: Re: [RFA] uiout fix for Insight
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Mon, 16 Apr 2001 22:45:11 -0400 (EDT)
- Cc: <gdb-patches at sources dot redhat dot com>, <insight at sources dot redhat dot com>
- References: <Pine.SUN.4.33.0104101451320.19358-100000@rtl.cygnus.com>
Martin M. Hunt writes:
> There is a problem with my recent ui_file patch for Insight. It creates a
> new gdb_stdout and deletes the old one. Unfortunately, gdb_init()
> initialized a global "uiout" pointing to the old gdb_stdout. This can
> cause core dumps.
>
> I'm not sure what the best fix is; I got dizzy tracing through all the ui,
> cli, and mi stuff, but the following seems to work. OK to check in?
>
Ok, yes. Go ahead.
Elena
> 2001-04-10 Martin M. Hunt <hunt@redhat.com>
>
> * top.c (gdb_init): Don't call cli_out_new() to
> create global uiout if init_ui_hook is set. uiout will
> have to be initialized there.
>
> 2001-04-10 Martin M. Hunt <hunt@redhat.com>
>
> * generic/gdbtk.c (gdbtk_init): Initialize uiout.
>
>
> Index: top.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/top.c,v
> retrieving revision 1.31
> diff -u -p -r1.31 top.c
> --- top.c 2001/04/05 15:19:42 1.31
> +++ top.c 2001/04/10 21:50:36
> @@ -704,17 +704,18 @@ gdb_init (char *argv0)
>
> #ifdef UI_OUT
> /* Install the default UI */
> - uiout = cli_out_new (gdb_stdout);
> -#endif
> -
> -#ifdef UI_OUT
> - /* All the interpreters should have had a look at things by now.
> - Initialize the selected interpreter. */
> - if (interpreter_p && !init_ui_hook)
> + if (!init_ui_hook)
> {
> - fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n",
> - interpreter_p);
> - exit (1);
> + uiout = cli_out_new (gdb_stdout);
> +
> + /* All the interpreters should have had a look at things by now.
> + Initialize the selected interpreter. */
> + if (interpreter_p)
> + {
> + fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n",
> + interpreter_p);
> + exit (1);
> + }
> }
> #endif
>
> @@ -733,8 +734,8 @@ execute_command (char *p, int from_tty)
> static int warned = 0;
> char *line;
> /* FIXME: These should really be in an appropriate header file */
> -extern void serial_log_command (const char *);
> -
> + extern void serial_log_command (const char *);
> +
> free_all_values ();
>
> /* Force cleanup of any alloca areas if using C alloca instead of
> Index: gdbtk/generic/gdbtk.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 gdbtk.c
> --- gdbtk.c 2001/04/05 02:02:14 1.10
> +++ gdbtk.c 2001/04/10 21:50:36
> @@ -386,7 +386,8 @@ gdbtk_init (argv0)
> gdb_stderr = gdbtk_fileopen ();
> gdb_stdlog = gdbtk_fileopen ();
> gdb_stdtarg = gdbtk_fileopen ();
> -
> + uiout = cli_out_new (gdb_stdout);
> +
> /* First init tcl and tk. */
> Tcl_FindExecutable (argv0);
> gdbtk_interp = Tcl_CreateInterp ();
>