aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.threads/clone-new-thread-event.c16
-rw-r--r--gdb/testsuite/gdb.threads/clone-new-thread-event.exp2
2 files changed, 17 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.threads/clone-new-thread-event.c b/gdb/testsuite/gdb.threads/clone-new-thread-event.c
index 800514d..9e7ceb9 100644
--- a/gdb/testsuite/gdb.threads/clone-new-thread-event.c
+++ b/gdb/testsuite/gdb.threads/clone-new-thread-event.c
@@ -26,6 +26,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <sys/syscall.h>
+#include <sys/wait.h>
#include <features.h>
#ifdef __UCLIBC__
@@ -59,7 +60,7 @@ int
main (int argc, char **argv)
{
unsigned char *stack;
- int new_pid;
+ int new_pid, status, ret;
stack = malloc (STACK_SIZE);
assert (stack != NULL);
@@ -71,5 +72,18 @@ main (int argc, char **argv)
, NULL, NULL, NULL, NULL);
assert (new_pid > 0);
+ /* Note the clone call above didn't use CLONE_THREAD, so it actually
+ put the new thread in a new thread group. However, the new clone
+ is still reported with PTRACE_EVENT_CLONE to GDB, since we didn't
+ use CLONE_VFORK (results in PTRACE_EVENT_VFORK) nor set the
+ termination signal to SIGCHLD (results in PTRACE_EVENT_FORK), so
+ GDB thinks of it as a new thread of the same inferior. It's a
+ bit of an odd setup, but it's not important for what we're
+ testing, and, it let's us conveniently use waitpid to wait for
+ the clone, which you can't with CLONE_THREAD. */
+ ret = waitpid (new_pid, &status, __WALL);
+ assert (ret == new_pid);
+ assert (WIFSIGNALED (status) && WTERMSIG (status) == SIGUSR1);
+
return 0;
}
diff --git a/gdb/testsuite/gdb.threads/clone-new-thread-event.exp b/gdb/testsuite/gdb.threads/clone-new-thread-event.exp
index fdebd48..db5ae39 100644
--- a/gdb/testsuite/gdb.threads/clone-new-thread-event.exp
+++ b/gdb/testsuite/gdb.threads/clone-new-thread-event.exp
@@ -31,3 +31,5 @@ if { ![runto_main] } {
gdb_test "continue" \
"Thread 2 received signal SIGUSR1, User defined signal 1.*" \
"catch SIGUSR1"
+
+gdb_continue_to_end "" continue 1