Make handle_no_resumed transfer terminal
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.multi / multi-target.c
CommitLineData
1dadb1dd
PA
1/* This testcase is part of GDB, the GNU debugger.
2
3 Copyright 2017-2020 Free Software Foundation, Inc.
4
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.
9
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.
14
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/>. */
17
18#include <stdlib.h>
19#include <stdio.h>
20#include <unistd.h>
21#include <limits.h>
22#include <string.h>
23#include <pthread.h>
24
25#define NUM_THREADS 1
26
27static pthread_barrier_t barrier;
28
29static void *
30thread_start (void *arg)
31{
32 pthread_barrier_wait (&barrier);
33
34 while (1)
35 sleep (1);
36 return NULL;
37}
38
39static void
40all_started (void)
41{
42}
43
44int wait_for_gdb;
45
46static void
47function1 (void)
48{
49 while (wait_for_gdb)
50 sleep (1);
51}
52
53static void
54function2 (void)
55{
56 while (wait_for_gdb)
57 sleep (1);
58}
59
60static void
61function3 (void)
62{
63}
64
65static void
66function4 (void)
67{
68}
69
70static void
71function5 (void)
72{
73}
74
75int
76main (int argc, char ** argv)
77{
78 pthread_t thread;
79 int len;
80
81 alarm (360);
82
83 pthread_barrier_init (&barrier, NULL, NUM_THREADS + 1);
84 pthread_create (&thread, NULL, thread_start, NULL);
85
86 pthread_barrier_wait (&barrier);
87 all_started ();
88
89 while (1)
90 {
91 function1 (); /* set break 1 here */
92 function2 (); /* set break 2 here */
93 function3 ();
94 function4 ();
95 function5 ();
96 sleep (1);
97 }
98
99 return 0;
100}
This page took 0.103964 seconds and 4 git commands to generate.