This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Avoid memory leak in gdb_setup_readline
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 16 Dec 2012 19:52:46 +0100
- Subject: Re: [RFA] Avoid memory leak in gdb_setup_readline
- References: <000001cdd7c0$fdd7e690$f987b3b0$@muller@ics-cnrs.unistra.fr>
On Tue, 11 Dec 2012 18:00:15 +0100, Pierre Muller wrote:
> --- src/gdb/event-top.c 23 Oct 2012 06:20:49 -0000 1.89
> +++ src/gdb/event-top.c 11 Dec 2012 16:50:36 -0000
> @@ -953,7 +953,13 @@ gdb_setup_readline (void)
> mess it up here. The sync stuff should really go away over
> time. */
> if (!batch_silent)
> - gdb_stdout = stdio_fileopen (stdout);
> + {
> + if (gdb_stdout)
> + ui_file_delete (gdb_stdout);
> + gdb_stdout = stdio_fileopen (stdout);
> + }
> + if (gdb_stderr)
> + ui_file_delete (gdb_stderr);
> gdb_stderr = stdio_fileopen (stderr);
> gdb_stdlog = gdb_stderr; /* for moment */
> gdb_stdtarg = gdb_stderr; /* for moment */
At least with -lmcheck it has regressions on
{x86_64,x86_64-m32,i686}-fedora18-linux-gnu:
Running gdb/testsuite/gdb.dwarf2/dw2-filename.exp ...
-PASS: gdb.dwarf2/dw2-filename.exp: interpreter-exec mi -file-list-exec-source-files
-PASS: gdb.dwarf2/dw2-filename.exp: info sources
+ERROR: Process no longer exists
-PASS: gdb.mi/mi-cmd-param-changed.exp: cmd param: "set scheduler-locking step" no event (requested by MI interp)
+FAIL: gdb.mi/mi-cmd-param-changed.exp: cmd param: "set scheduler-locking step" no event (requested by MI interp)
[...]
-PASS: gdb.trace/tfile.exp: interpreter-exec mi "-target-select tfile basic.tf"
+ERROR: Process no longer exists
+UNRESOLVED: gdb.trace/tfile.exp: interpreter-exec mi "-target-select tfile basic.tf"
I did not check but I believe in some cases such as a redirection
gdb_stdout == gdb_stderr. Unfortunately this UI streams code is a bit
minefield.
Regards,
Jan