* [PATCH] Fix remote simulator stdio/stderr callbacks
@ 2004-01-30 4:59 Fred Fish
2004-01-30 23:18 ` Andrew Cagney
0 siblings, 1 reply; 2+ messages in thread
From: Fred Fish @ 2004-01-30 4:59 UTC (permalink / raw)
To: gdb-patches; +Cc: fnf
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. */
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] Fix remote simulator stdio/stderr callbacks
2004-01-30 4:59 [PATCH] Fix remote simulator stdio/stderr callbacks Fred Fish
@ 2004-01-30 23:18 ` Andrew Cagney
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2004-01-30 23:18 UTC (permalink / raw)
To: fnf; +Cc: gdb-patches
> 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 don't think so - gdb_stdtarg* were added for fileio.
No one thought to update the simulator to use that same mechanism,
thanks for doing this.
> 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.
Andrew
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-01-30 23:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-30 4:59 [PATCH] Fix remote simulator stdio/stderr callbacks Fred Fish
2004-01-30 23:18 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox