This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Integrate PR 12649's race detector directly in the testsuite machinery
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 15 Aug 2014 22:48:04 +0200
- Subject: Re: [PATCH] Integrate PR 12649's race detector directly in the testsuite machinery
- Authentication-results: sourceware.org; auth=none
- References: <1406314028-12796-1-git-send-email-palves at redhat dot com>
On Fri, 25 Jul 2014 20:47:08 +0200, Pedro Alves wrote:
> --- /dev/null
> +++ b/gdb/testsuite/read1.c
I would find it more suitable as: gdb/testsuite/lib/read1.c
> @@ -0,0 +1,40 @@
> +/* This is part of GDB, the GNU debugger.
> +
> + Copyright 2011-2014 Free Software Foundation, Inc.
> +
> + 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/>.
> +*/
> +
> +#define _GNU_SOURCE 1
> +#include <dlfcn.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +#include <stdlib.h>
> +
> +/* Wrap 'read', forcing it to return only one byte at a time, if
> + reading from the terminal. */
> +
> +ssize_t
> +read (int fd, void *buf, size_t count)
> +{
> + static ssize_t (*read2) (int fd, void *buf, size_t count) = NULL;
> + if (read2 == NULL)
> + {
> + unsetenv ("LD_PRELOAD");
> + read2 = dlsym (RTLD_NEXT, "read");
> + }
> + if (count > 0 && isatty (fd) >= 1)
Here could be 'count > 1'.
> + count = 1;
> + return read2 (fd, buf, count);
> +}
> --
> 1.9.3
Otherwise the Makefiles work for me.
Thanks,
Jan