Index: gdb/testsuite/gdb.base/attach-twice.c |
diff --git a/gdb/testsuite/gdb.base/kill-after-signal.c b/gdb/testsuite/gdb.base/attach-twice.c |
similarity index 73% |
copy from gdb/testsuite/gdb.base/kill-after-signal.c |
copy to gdb/testsuite/gdb.base/attach-twice.c |
index 2a6ceb7f4cb47b71950c7d9c07c1e241d277506a..cff221551923119c8cd1978d49f812883f870dfb 100644 |
--- a/gdb/testsuite/gdb.base/kill-after-signal.c |
+++ b/gdb/testsuite/gdb.base/attach-twice.c |
@@ -15,23 +15,28 @@ |
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 <signal.h> |
-#include <assert.h> |
+#include <stdlib.h> |
#include <unistd.h> |
-#include <stdio.h> |
- |
-void |
-handler (int signo) |
-{ |
- sleep (600); |
- assert (0); |
-} |
+#include <sys/ptrace.h> |
+#include <errno.h> |
int |
main (void) |
{ |
- signal (SIGUSR1, handler); |
- raise (SIGUSR1); |
- assert (0); |
+ long l; |
+ |
+ switch (fork ()) |
+ { |
+ case -1: |
+ perror ("fork"); |
+ exit (1); |
+ case 0: |
+ errno = 0; |
+ ptrace (PTRACE_ATTACH, getppid (), NULL, NULL); |
+ if (errno != 0) |
+ perror ("PTRACE_ATTACH"); |
+ break; |
+ } |
+ sleep (600); |
return 0; |
} |