From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Taylor To: insight@sources.redhat.com Cc: gdb-patches@sourceware.cygnus.com Subject: [RFA] insight gdb_stdlog bug Date: Wed, 20 Dec 2000 14:53:00 -0000 Message-id: <200012202252.RAA28763@texas.cygnus.com> X-SW-Source: 2000-q4/msg00440.html When GDBTK_TO_RESULT is set, insight gobbles all output written to gdb_stdlog. But, the stuff written to gdb_stdlog isn't meant to be parsed by insight -- it's meant to be read by a person. While it might be desired -- when GDBTK_TO_RESULT is not set -- that gdb_stdlog go the same place as gdb_stdout, it cannot have the same pointer value as gdb_stdout or the code won't be able to distinguish output meant for gdb_stdout vs output meant for gdb_stdlog when GDBTK_TO_RESULT is set. The following patch fixes that. (The result is that output written to gdb_stdlog appears in the insight console window if it is active.) ChangeLog entries (3 separate ChangeLog files): * main.c (captured_main): Initialize gdb_stdlog to a copy of gdb_stdout rather than to gdb_stdout, so that code can distinguish them. * tui/tui-file.c (tui_file_fputs): Handle gdb_stdlog the same as gdb_stdout. * gdbtk/generic/gdbtk-hooks.c (gdbtk_fputs): Distinguish between gdb_stdlog and gdb_stdout. Index: main.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/main.c,v retrieving revision 1.207.12.1 diff -c -r1.207.12.1 main.c *** main.c 2000/11/13 02:10:59 1.207.12.1 --- main.c 2000/12/20 22:23:25 *************** *** 203,209 **** within its own _initialize function. */ gdb_stdout = tui_fileopen (stdout); gdb_stderr = tui_fileopen (stderr); ! gdb_stdlog = gdb_stdout; /* for moment */ gdb_stdtarg = gdb_stderr; /* for moment */ #else gdb_stdout = stdio_fileopen (stdout); --- 203,209 ---- within its own _initialize function. */ gdb_stdout = tui_fileopen (stdout); gdb_stderr = tui_fileopen (stderr); ! gdb_stdlog = tui_fileopen (stdout); /* for moment */ gdb_stdtarg = gdb_stderr; /* for moment */ #else gdb_stdout = stdio_fileopen (stdout); Index: tui/tui-file.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/tui/tui-file.c,v retrieving revision 1.5 diff -c -r1.5 tui-file.c *** tui-file.c 2000/07/30 01:50:07 1.5 --- tui-file.c 2000/12/20 22:23:25 *************** *** 181,187 **** also tui_file_flush(). */ if (fputs_unfiltered_hook && (file == gdb_stdout ! || file == gdb_stderr)) fputs_unfiltered_hook (linebuffer, file); else { --- 181,188 ---- also tui_file_flush(). */ if (fputs_unfiltered_hook && (file == gdb_stdout ! || file == gdb_stderr ! || file == gdb_stdlog)) fputs_unfiltered_hook (linebuffer, file); else { Index: gdbtk/generic/gdbtk-hooks.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/gdbtk/generic/gdbtk-hooks.c,v retrieving revision 1.7 diff -c -r1.7 gdbtk-hooks.c *** gdbtk-hooks.c 2000/10/23 22:42:01 1.7 --- gdbtk-hooks.c 2000/12/20 22:23:29 *************** *** 250,256 **** if (result_ptr != NULL) { ! if (result_ptr->flags & GDBTK_TO_RESULT) { if (result_ptr->flags & GDBTK_MAKES_LIST) Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, --- 250,258 ---- if (result_ptr != NULL) { ! if (stream == gdb_stdlog) ! gdbtk_two_elem_cmd ("gdbtk_tcl_fputs", (char *) ptr); ! else if (result_ptr->flags & GDBTK_TO_RESULT) { if (result_ptr->flags & GDBTK_MAKES_LIST) Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,