1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2012-2022 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
27 static pthread_barrier_t barrier
;
30 thread_start (void *arg
)
32 pthread_barrier_wait (&barrier
);
33 pthread_barrier_wait (&barrier
);
34 pthread_barrier_wait (&barrier
);
47 main (int argc
, char ** argv
)
53 strcpy (prog
, argv
[0]);
55 /* Replace "multi-arch-exec" with "multi-arch-exec-hello". */
56 memcpy (prog
+ len
- 15, "multi-arch-exec-hello", 21);
59 pthread_barrier_init (&barrier
, NULL
, NUM_THREADS
+ 1);
60 pthread_create (&thread
, NULL
, thread_start
, NULL
);
62 pthread_barrier_wait (&barrier
);
65 /* Avoid races with GDB ptrace-resuming the threads and the exec: ensure
66 both threads were resumed by GDB before going into the exec. */
67 pthread_barrier_wait (&barrier
);
68 pthread_barrier_wait (&barrier
);
73 perror ("execl failed");