Index: gdb/testsuite/gdb.threads/sigstep-threads.c |
diff --git a/gdb/testsuite/gdb.threads/fork-child-threads.c b/gdb/testsuite/gdb.threads/sigstep-threads.c |
similarity index 60% |
copy from gdb/testsuite/gdb.threads/fork-child-threads.c |
copy to gdb/testsuite/gdb.threads/sigstep-threads.c |
index bffe34e163dd3b03cee7313a494b93758d398ad4..ca77fe4602fee6a4a840991fe147d5a96a0c21fb 100644 |
--- a/gdb/testsuite/gdb.threads/fork-child-threads.c |
+++ b/gdb/testsuite/gdb.threads/sigstep-threads.c |
@@ -1,6 +1,6 @@ |
/* This testcase is part of GDB, the GNU debugger. |
- Copyright 2008-2012 Free Software Foundation, Inc. |
+ Copyright 2010-2012 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 |
@@ -17,34 +17,38 @@ |
#include <pthread.h> |
#include <assert.h> |
+#include <signal.h> |
+ |
+#include <asm/unistd.h> |
#include <unistd.h> |
+#define tgkill(tgid, tid, sig) syscall (__NR_tgkill, (tgid), (tid), (sig)) |
+#define gettid() syscall (__NR_gettid) |
+ |
+static volatile int var; |
+ |
+static void |
+handler (int signo) /* step-0 */ |
+{ /* step-0 */ |
+ var++; /* step-1 */ |
+ tgkill (getpid (), gettid (), SIGUSR1); /* step-2 */ |
+} |
static void * |
start (void *arg) |
{ |
+ tgkill (getpid (), gettid (), SIGUSR1); |
assert (0); |
- return arg; |
+ return NULL; |
} |
-int main(void) |
+int |
+main (void) |
{ |
pthread_t thread; |
- int i; |
- |
- switch (fork ()) |
- { |
- case -1: |
- assert (0); |
- default: |
- break; |
- case 0: |
- i = pthread_create (&thread, NULL, start, NULL); |
- assert (i == 0); |
- i = pthread_join (thread, NULL); |
- assert (i == 0); |
- |
- assert (0); |
- } |
+ signal (SIGUSR1, handler); |
+ |
+ pthread_create (&thread, NULL, start, NULL); |
+ start (NULL); /* main-start */ |
return 0; |
} |