Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: gdb/testsuite/gdb.threads/watchpoint-fork-parent.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /* Test case for forgotten hw-watchpoints after fork()-off of a process.
2
3 Copyright 2012 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
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.
11
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.
16
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. */
21
22 #include <string.h>
23 #include <errno.h>
24 #include <sys/types.h>
25 #include <unistd.h>
26 #include <assert.h>
27 #include <stdio.h>
28 #include <sys/wait.h>
29
30 #include "watchpoint-fork.h"
31
32 void
33 forkoff (int nr)
34 {
35 pid_t child, pid_got;
36 int exit_code = 42 + nr;
37 int status, i;
38
39 child = fork ();
40 switch (child)
41 {
42 case -1:
43 assert (0);
44 case 0:
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/watchpoin t-fork.c:33
49 33 }
50 (gdb) parent2: 14223 */
51 i = sleep (1);
52 assert (i == 0);
53
54 /* We must not get caught here (against a forgotten breakpoint). */
55 var++;
56 marker ();
57
58 _exit (exit_code);
59 default:
60 printf ("parent%d: %d\n", nr, (int) child);
61 /* Delay to get both the "child%d" and "parent%d" message printed, see
62 above. */
63 i = sleep (1);
64 assert (i == 0);
65
66 pid_got = wait (&status);
67 assert (pid_got == child);
68 assert (WIFEXITED (status));
69 assert (WEXITSTATUS (status) == exit_code);
70
71 /* We must get caught here (against a false watchpoint removal). */
72 marker ();
73 }
74 }
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.threads/watchpoint-fork-mt.c ('k') | gdb/testsuite/gdb.threads/watchpoint-fork-st.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698