1 /* This testcase is part of GDB, the GNU debugger.
3 Copyright 2018-2021 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/>. */
19 #include <sys/types.h>
22 /* This is set to 1 by the debugger post attach to continue to the
23 watchpoint trigger. */
24 volatile int should_continue
= 0;
25 /* The variable to place a watchpoint on. */
26 volatile int watched_variable
= 0;
31 unsigned int counter
= 1;
32 int mypid
= getpid ();
34 /* Wait for the debugger to attach, but not indefinitely so this
35 test program is not left hanging around. */
36 for (counter
= 0; !should_continue
&& counter
< 100; counter
++)
37 sleep (1); /* pidacquired */
39 /* Trigger a watchpoint. */
41 printf ("My variable is %d\n", watched_variable
);
This page took 0.033314 seconds and 5 git commands to generate.