mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
dedad4e3d2
This forces all tests that rely on stdio to be unbuffered, like
interrupt.exp was adjusted in 6f98576f
.
To recap, in some scenarios, GDB or GDBserver can be spawned with
input _not_ connected to a tty, and then tests that rely on stdio fail
with timeouts, because the inferior's stdout and stderr streams end up
fully buffered. Calling gdb_unbuffer_output forces output to be
unbuffered.
See https://sourceware.org/ml/gdb-patches/2015-02/msg00809.html and
https://sourceware.org/ml/gdb-patches/2015-02/msg00819.html.
Tested on x86_64 Fedora 20, native, and against a remote gdbserver
board file that connects to the target with ssh, with and without -t
(create pty).
gdb/testsuite/ChangeLog:
2015-07-29 Pedro Alves <palves@redhat.com>
* gdb.base/call-ar-st.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/call-rt-st.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/call-strs.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/call-strs.exp: Adjust to step over the
gdb_unbuffer_output call.
* gdb.base/catch-gdb-caused-signals.c: Include
"../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/dprintf.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/ending-run.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/run.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/shlib-call.exp: Adjust to step over the
gdb_unbuffer_output call.
* gdb.base/shmain.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/sizeof.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
* gdb.base/varargs.c: Include "../lib/unbuffer_output.c".
(main): Rename to ...
(test): ... this.
(main): Reimplement.
* gdb.base/varargs.exp: Run to test instead of to main.
* gdb.mi/mi-dprintf.c: Include "../lib/unbuffer_output.c".
(main): Call gdb_unbuffer_output.
61 lines
1.1 KiB
C
61 lines
1.1 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "../lib/unbuffer_output.c"
|
|
|
|
char buf[100];
|
|
char bigbuf[1000];
|
|
char * s;
|
|
|
|
char * str_func1(char *s1)
|
|
{
|
|
printf("first string arg is: %s\n", s1);
|
|
strcpy(bigbuf, s1);
|
|
return bigbuf;
|
|
}
|
|
|
|
char * str_func(
|
|
char * s1,
|
|
char * s2,
|
|
char * s3,
|
|
char * s4,
|
|
char * s5,
|
|
char * s6,
|
|
char * s7)
|
|
{
|
|
printf("first string arg is: %s\n", s1);
|
|
printf("second string arg is: %s\n", s2);
|
|
printf("third string arg is: %s\n", s3);
|
|
printf("fourth string arg is: %s\n", s4);
|
|
printf("fifth string arg is: %s\n", s5);
|
|
printf("sixth string arg is: %s\n", s6);
|
|
printf("seventh string arg is: %s\n", s7);
|
|
strcpy(bigbuf, s1);
|
|
strcat(bigbuf, s2);
|
|
strcat(bigbuf, s3);
|
|
strcat(bigbuf, s4);
|
|
strcat(bigbuf, s5);
|
|
strcat(bigbuf, s6);
|
|
strcat(bigbuf, s7);
|
|
return bigbuf;
|
|
}
|
|
|
|
char *
|
|
link_malloc ()
|
|
{
|
|
return (char*) malloc (1);
|
|
}
|
|
|
|
int main()
|
|
{
|
|
gdb_unbuffer_output ();
|
|
|
|
s = &buf[0];
|
|
strcpy(buf, "test string");
|
|
str_func("abcd", "efgh", "ijkl", "mnop", "qrst", "uvwx", "yz12");
|
|
str_func1("abcd");
|
|
return 0;
|
|
}
|
|
|