This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] MIPS sim: Flush file descriptors after write
- From: Thiemo Seufer <ths at networkno dot de>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 19 Feb 2007 17:51:48 +0000
- Subject: [PATCH] MIPS sim: Flush file descriptors after write
Hello All,
I applied the appended patch, it flushes the stdout/stderr file
descriptors after each write to make sure output completes before
buf is deallocated.
Thiemo
2007-02-19 Thiemo Seufer <ths@mips.com>
Nigel Stephens <nigel@mips.com>
* interp.c (sim_monitor): Flush stdout and stderr file descriptors
after each call to sim_io_write.
Index: head/sim/mips/interp.c
===================================================================
RCS file: /cvs/src/src/sim/mips/interp.c,v
retrieving revision 1.19
diff -u -p -r1.19 interp.c
--- head/sim/mips/interp.c 12 May 2004 01:42:33 -0000 1.19
+++ head/sim/mips/interp.c 24 Nov 2006 13:36:02 -0000
@@ -1178,6 +1178,10 @@ sim_monitor (SIM_DESC sd,
char *buf = zalloc (nr);
sim_read (sd, A1, buf, nr);
V0 = sim_io_write (sd, fd, buf, nr);
+ if (fd == 1)
+ sim_io_flush_stdout (sd);
+ else if (fd == 2)
+ sim_io_flush_stderr (sd);
zfree (buf);
break;
}