Index: gdb/testsuite/gdb.base/siginfo-thread.c |
diff --git a/gdb/testsuite/gdb.base/siginfo-obj.c b/gdb/testsuite/gdb.base/siginfo-thread.c |
similarity index 85% |
copy from gdb/testsuite/gdb.base/siginfo-obj.c |
copy to gdb/testsuite/gdb.base/siginfo-thread.c |
index cb50126f727a7f91076f3cd3f067c0f7f5acd734..01f738165ab946eb043f261e078ec51c7636258d 100644 |
--- a/gdb/testsuite/gdb.base/siginfo-obj.c |
+++ b/gdb/testsuite/gdb.base/siginfo-thread.c |
@@ -1,6 +1,6 @@ |
/* This testcase is part of GDB, the GNU debugger. |
- Copyright 2004, 2007-2008, 2010-2012 Free Software Foundation, Inc. |
+ Copyright 2004-2013 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 |
@@ -22,6 +22,7 @@ |
#include <string.h> |
#include <sys/mman.h> |
#include <unistd.h> |
+#include <pthread.h> |
static void *p; |
@@ -38,9 +39,17 @@ handler (int sig, siginfo_t *info, void *context) |
_exit (0); /* set breakpoint here */ |
} |
+static void * |
+segv_thread (void *ptr) |
+{ |
+ *(int *)ptr = 0; |
+} |
+ |
int |
main (void) |
{ |
+ pthread_t thr; |
+ |
/* Set up unwritable memory. */ |
{ |
size_t len; |
@@ -64,7 +73,11 @@ main (void) |
return 1; |
} |
} |
- /* Trigger SIGSEGV. */ |
- *(int *)p = 0; |
+ |
+ /* Create a thread that will trigger SIGSEGV. */ |
+ pthread_create (&thr, NULL, segv_thread, p); |
+ |
+ pthread_join (thr, NULL); |
+ |
return 0; |
} |