1 /* Test case for forgotten hw-watchpoints after fork()-off of a process.
3 Copyright 2012 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
24 #include <sys/types.h>
30 #include "watchpoint-fork.h"
36 int exit_code = 42 + nr;
45 printf ("child%d: %d\n", nr, (int) getpid ());
46 /* Delay to get both the "child%d" and "parent%d" message printed without
47 a race breaking expect by its endless wait on `$gdb_prompt$':
48 Breakpoint 3, marker () at ../../../gdb/testsuite/gdb.threads/watchpoint-fork.c:33
50 (gdb) parent2: 14223 */
54 /* We must not get caught here (against a forgotten breakpoint). */
60 printf ("parent%d: %d\n", nr, (int) child);
61 /* Delay to get both the "child%d" and "parent%d" message printed, see
66 pid_got = wait (&status);
67 assert (pid_got == child);
68 assert (WIFEXITED (status));
69 assert (WEXITSTATUS (status) == exit_code);
71 /* We must get caught here (against a false watchpoint removal). */