This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: [RFA] Avoid memory leak in gdb_setup_readline


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


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