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.
127 lines
3 KiB
C
127 lines
3 KiB
C
#include <stdio.h>
|
|
|
|
#include "../lib/unbuffer_output.c"
|
|
|
|
typedef char padding[16];
|
|
|
|
struct {
|
|
padding p1;
|
|
char v;
|
|
padding p2;
|
|
} padding_char;
|
|
|
|
struct {
|
|
padding p1;
|
|
short v;
|
|
padding p2;
|
|
} padding_short;
|
|
|
|
struct {
|
|
padding p1;
|
|
int v;
|
|
padding p2;
|
|
} padding_int;
|
|
|
|
struct {
|
|
padding p1;
|
|
long v;
|
|
padding p2;
|
|
} padding_long;
|
|
|
|
struct {
|
|
padding p1;
|
|
long long v;
|
|
padding p2;
|
|
} padding_long_long;
|
|
|
|
struct {
|
|
padding p1;
|
|
float v;
|
|
padding p2;
|
|
} padding_float;
|
|
|
|
struct {
|
|
padding p1;
|
|
double v;
|
|
padding p2;
|
|
} padding_double;
|
|
|
|
struct {
|
|
padding p1;
|
|
long double v;
|
|
padding p2;
|
|
} padding_long_double;
|
|
|
|
static void
|
|
fill (void *buf, long sizeof_buf)
|
|
{
|
|
char *p = buf;
|
|
int i;
|
|
for (i = 0; i < sizeof_buf; i++)
|
|
p[i] = "The quick brown dingo jumped over the layzy dog."[i];
|
|
}
|
|
|
|
void
|
|
fill_structs (void)
|
|
{
|
|
fill (&padding_char.p1, sizeof (padding));
|
|
fill (&padding_char.v, sizeof (padding_char.v));
|
|
fill (&padding_char.p2, sizeof (padding));
|
|
|
|
fill (&padding_short.p1, sizeof (padding));
|
|
fill (&padding_short.v, sizeof (padding_short.v));
|
|
fill (&padding_short.p2, sizeof (padding));
|
|
|
|
fill (&padding_int.p1, sizeof (padding));
|
|
fill (&padding_int.v, sizeof (padding_int.v));
|
|
fill (&padding_int.p2, sizeof (padding));
|
|
|
|
fill (&padding_long.p1, sizeof (padding));
|
|
fill (&padding_long.v, sizeof (padding_long.v));
|
|
fill (&padding_long.p2, sizeof (padding));
|
|
|
|
fill (&padding_long_long.p1, sizeof (padding));
|
|
fill (&padding_long_long.v, sizeof (padding_long_long.v));
|
|
fill (&padding_long_long.p2, sizeof (padding));
|
|
|
|
fill (&padding_float.p1, sizeof (padding));
|
|
fill (&padding_float.v, sizeof (padding_float.v));
|
|
fill (&padding_float.p2, sizeof (padding));
|
|
|
|
fill (&padding_double.p1, sizeof (padding));
|
|
fill (&padding_double.v, sizeof (padding_double.v));
|
|
fill (&padding_double.p2, sizeof (padding));
|
|
|
|
fill (&padding_long_double.p1, sizeof (padding));
|
|
fill (&padding_long_double.v, sizeof (padding_long_double.v));
|
|
fill (&padding_long_double.p2, sizeof (padding));
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
gdb_unbuffer_output ();
|
|
|
|
fill_structs ();
|
|
|
|
printf ("sizeof (char) == %d\n", (int) sizeof (char));
|
|
printf ("sizeof (short) == %d\n", (int) sizeof (short));
|
|
printf ("sizeof (int) == %d\n", (int) sizeof (int));
|
|
printf ("sizeof (long) == %d\n", (int) sizeof (long));
|
|
printf ("sizeof (long long) == %d\n", (int) sizeof (long long));
|
|
|
|
printf ("sizeof (void *) == %d\n", (int) sizeof (void*));
|
|
printf ("sizeof (void (*)(void)) == %d\n", (int) sizeof (void (*)(void)));
|
|
|
|
printf ("sizeof (float) == %d\n", (int) sizeof (float));
|
|
printf ("sizeof (double) == %d\n", (int) sizeof (double));
|
|
printf ("sizeof (long double) == %d\n", (int) sizeof (long double));
|
|
|
|
/* Signed char? */
|
|
printf ("valueof ('\\377') == %d\n", '\377');
|
|
printf ("valueof ((int) (char) -1) == %d\n", (int) (char) -1);
|
|
printf ("valueof ((int) (signed char) -1) == %d\n", (int) (signed char) -1);
|
|
printf ("valueof ((int) (unsigned char) -1) == %d\n", (int) (unsigned char) -1);
|
|
|
|
return 0;
|
|
}
|