This is the mail archive of the gdb-patches@sources.redhat.com 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]

[PATCH] Fix remote simulator stdio/stderr callbacks


There seems to be two problems with the current callbacks in remote-sim.c:

(1)  The callback to write out the target stderr data writes to the stdtarg
     (stdout) stream instead of the stdtargerr (stderr) stream.

(2)  The callback to flush the target stderr data actually flushes a completely
     different stream that the one that the stderr data was written to.

Am I missing something obvious?  I think the problem was masked by the
fact that normally gdb_stdtarg and gdb_stdtargerr are the same as
gdb_stderr.

Also included is a minor tweak to group the gdb_stdtarg declaration
with the other gdb_stdtarg* declarations.

Not included in the patch is an update to the file copyright years,
which I will include when the changes are checked in, if approved.

-Fred


2004-01-29  Fred Fish  <fnf@redhat.com>

	* main.c (gdb_stdtarg): Move definition to group with other gdb_stdtarg
	definitions.
	* remote-sim.c (gdb_os_write_stderr): Write output to gdb_stdtargerr
	stream instead of gdb_stdtarg stream.
	(gdb_os_flush_stderr): Flush gdb_stdtargerr steam instead of
	gdb_stderr stream.

Index: main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.37
diff -c -p -r1.37 main.c
*** main.c	19 Jan 2004 19:56:01 -0000	1.37
--- main.c	30 Jan 2004 04:44:02 -0000
*************** char *gdb_sysroot = 0;
*** 72,81 ****
  struct ui_file *gdb_stdout;
  struct ui_file *gdb_stderr;
  struct ui_file *gdb_stdlog;
- struct ui_file *gdb_stdtarg;
  struct ui_file *gdb_stdin;
  /* target IO streams */
  struct ui_file *gdb_stdtargin;
  struct ui_file *gdb_stdtargerr;
  
  /* Whether to enable writing into executable and core files */
--- 72,81 ----
  struct ui_file *gdb_stdout;
  struct ui_file *gdb_stderr;
  struct ui_file *gdb_stdlog;
  struct ui_file *gdb_stdin;
  /* target IO streams */
  struct ui_file *gdb_stdtargin;
+ struct ui_file *gdb_stdtarg;
  struct ui_file *gdb_stdtargerr;
  
  /* Whether to enable writing into executable and core files */
Index: remote-sim.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sim.c,v
retrieving revision 1.33
diff -c -p -r1.33 remote-sim.c
*** remote-sim.c	13 Nov 2003 19:06:26 -0000	1.33
--- remote-sim.c	30 Jan 2004 04:44:03 -0000
*************** gdb_os_write_stderr (host_callback *p, c
*** 221,227 ****
      {
        b[0] = buf[i];
        b[1] = 0;
!       fputs_unfiltered (b, gdb_stdtarg);
      }
    return len;
  }
--- 221,227 ----
      {
        b[0] = buf[i];
        b[1] = 0;
!       fputs_unfiltered (b, gdb_stdtargerr);
      }
    return len;
  }
*************** gdb_os_write_stderr (host_callback *p, c
*** 231,237 ****
  static void
  gdb_os_flush_stderr (host_callback *p)
  {
!   gdb_flush (gdb_stderr);
  }
  
  /* GDB version of printf_filtered callback.  */
--- 231,237 ----
  static void
  gdb_os_flush_stderr (host_callback *p)
  {
!   gdb_flush (gdb_stdtargerr);
  }
  
  /* GDB version of printf_filtered callback.  */



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