Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: gdb/contrib/expect-read1.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/contrib/excheck.py ('k') | gdb/contrib/expect-read1.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/contrib/expect-read1.c
diff --git a/gdb/testsuite/gdb.threads/corethreads.c b/gdb/contrib/expect-read1.c
similarity index 59%
copy from gdb/testsuite/gdb.threads/corethreads.c
copy to gdb/contrib/expect-read1.c
index e3c7c8c3bf70bbea79e099274254a40b542c6976..963c1ffab9358e898898c19aa55404ceef5143b5 100644
--- a/gdb/testsuite/gdb.threads/corethreads.c
+++ b/gdb/contrib/expect-read1.c
@@ -1,4 +1,4 @@
-/* Copyright 2011-2012 Free Software Foundation, Inc.
+/* Copyright (C) 2013 Free Software Foundation, Inc.
This file is part of GDB.
@@ -15,33 +15,26 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <pthread.h>
+/* RTLD_NEXT requires _GNU_SOURCE. */
+#define _GNU_SOURCE 1
+#include <dlfcn.h>
+#include <unistd.h>
+#include <fcntl.h>
#include <stdlib.h>
-#include <assert.h>
-pthread_t thread0;
-pthread_t thread1;
-
-static void *
-start (void *arg)
-{
- assert (pthread_self () == thread1);
-
- abort ();
-}
-
-int
-main (void)
+ssize_t
+read (int fd, void *buf, size_t count)
{
- int i;
-
- thread0 = pthread_self ();
+ static ssize_t (*read2) (int fd, void *buf, size_t count) = NULL;
- i = pthread_create (&thread1, NULL, start, NULL);
- assert (i == 0);
+ if (read2 == NULL)
+ {
+ unsetenv ("LD_PRELOAD");
+ read2 = dlsym (RTLD_NEXT, "read");
+ }
- i = pthread_join (thread1, NULL);
- assert (i == 0);
+ if (count > 1 && isatty (fd) == 1)
+ count = 1;
- return 0;
+ return read2 (fd, buf, count);
}
« no previous file with comments | « gdb/contrib/excheck.py ('k') | gdb/contrib/expect-read1.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698