aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/set_unbuffered_mode.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-06-27 16:42:19 +0000
committerPedro Alves <palves@redhat.com>2008-06-27 16:42:19 +0000
commitf747e0ce0af7f5429fead10867abeb97ac1e6dde (patch)
tree561535bc1b945dac565b4055a6f6ff7dff482fd5 /gdb/testsuite/lib/set_unbuffered_mode.c
parent7ccc1c74d815b3b3a8bae8afb5f4eacb438b29c5 (diff)
downloadgdb-f747e0ce0af7f5429fead10867abeb97ac1e6dde.zip
gdb-f747e0ce0af7f5429fead10867abeb97ac1e6dde.tar.gz
gdb-f747e0ce0af7f5429fead10867abeb97ac1e6dde.tar.bz2
* lib/gdb.exp (gdb_saved_set_unbuffered_mode_obj): New global.
(gdb_compile): If target is *-*-cygwin* or *-*-mingw*, and we're compiling an executable, link in an object that forces unbuffered output. * lib/set_unbuffered_mode.c: New file.
Diffstat (limited to 'gdb/testsuite/lib/set_unbuffered_mode.c')
-rw-r--r--gdb/testsuite/lib/set_unbuffered_mode.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/set_unbuffered_mode.c b/gdb/testsuite/lib/set_unbuffered_mode.c
new file mode 100644
index 0000000..aa91801
--- /dev/null
+++ b/gdb/testsuite/lib/set_unbuffered_mode.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Force outputs to unbuffered mode. */
+
+#include <stdio.h>
+
+static int __gdb_set_unbuffered_output (void) __attribute__ ((constructor));
+static int
+__gdb_set_unbuffered_output (void)
+{
+ setvbuf (stdout, NULL, _IONBF, BUFSIZ);
+ setvbuf (stderr, NULL, _IONBF, BUFSIZ);
+}