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

Unified Diff: gdb/testsuite/gdb.python/py-inferior.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/testsuite/gdb.python/py-function.exp ('k') | gdb/testsuite/gdb.python/py-inferior.exp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/testsuite/gdb.python/py-inferior.c
diff --git a/gdb/testsuite/gdb.python/py-inferior.c b/gdb/testsuite/gdb.python/py-inferior.c
index 04ec4769263c8caeb67456ed2758263b5a696bcd..3ee9a4620604ecd0f7676b70dc4cb189275b186d 100644
--- a/gdb/testsuite/gdb.python/py-inferior.c
+++ b/gdb/testsuite/gdb.python/py-inferior.c
@@ -2,9 +2,11 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
+#include <pthread.h>
#define CHUNK_SIZE 16000 /* same as findcmd.c's */
#define BUF_SIZE (2 * CHUNK_SIZE) /* at least two chunks */
+#define NUMTH 8
int8_t int8_search_buf[100];
int16_t int16_search_buf[100];
@@ -43,8 +45,47 @@ init_bufs ()
memset (search_buf, 'x', search_buf_size);
}
+static void *
+thread (void *param)
+{
+ pthread_barrier_t *barrier = (pthread_barrier_t *) param;
+
+ pthread_barrier_wait (barrier);
+
+ return param;
+}
+
+static void
+check_threads (pthread_barrier_t *barrier)
+{
+ pthread_barrier_wait (barrier);
+}
+
+extern int
+test_threads (void)
+{
+ pthread_t threads[NUMTH];
+ pthread_barrier_t barrier;
+ int i;
+
+ pthread_barrier_init (&barrier, NULL, NUMTH + 1);
+
+ for (i = 0; i < NUMTH; ++i)
+ pthread_create (&threads[i], NULL, thread, &barrier);
+
+ check_threads (&barrier);
+
+ for (i = 0; i < NUMTH; ++i)
+ pthread_join (threads[i], NULL);
+
+ pthread_barrier_destroy (&barrier);
+
+ return 0;
+}
+
int main (int argc, char *argv[])
{
+ test_threads ();
init_bufs ();
return f1 (1, 2);
« no previous file with comments | « gdb/testsuite/gdb.python/py-function.exp ('k') | gdb/testsuite/gdb.python/py-inferior.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698