2 * Copyright (c) 1996-2009 Barton P. Miller
4 * We provide the Paradyn Parallel Performance Tools (below
5 * described as "Paradyn") on an AS IS basis, and do not warrant its
6 * validity or performance. We reserve the right to update, modify,
7 * or discontinue this software at any time. We shall have no
8 * obligation to supply such updates or modifications or any other
9 * form of support to you.
11 * By your use of Paradyn, you understand and agree that we (or any
12 * other person or entity with proprietary rights in Paradyn) are
13 * under no obligation to provide either maintenance services,
14 * update services, notices of latent defects, or correction of
15 * defects for Paradyn.
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2.1 of the License, or (at your option) any later version.
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details.
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this library; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 #include "mutatee_util.h"
35 /* Externally accessed function prototypes. These must have globally unique
36 * names. I suggest following the pattern <testname>_<function>
43 /* Global variables accessed by the mutator. These must have globally unique
47 unsigned int test4_2_global1 = 0xdeadbeef;
49 /* Internally used function prototypes. These should be declared with the
50 * keyword static so they don't interfere with other mutatees in the group.
53 /* Global variables used internally by the mutatee. These should be declared
54 * with the keyword static so they don't interfere with other mutatees in the
58 /* Function definitions follow */
60 /* should be called by parent */
61 void test4_2_func3() {
62 dprintf("pid %d in test4_2_func3\n", (int) getpid());
63 test4_2_global1 = 2000002;
66 /* should be called by child */
67 void test4_2_func4() {
68 dprintf("pid %d in test4_2_func4\n", (int) getpid());
69 test4_2_global1 = 2000003;
72 void test4_2_func2() {
73 /* if we get this value at exit, no function was called */
74 test4_2_global1 = 2000001;
77 int test4_2_mutatee() {
78 #ifndef os_windows_test
82 dprintf("fork result: %d\n", pid);
85 registerPID(pid); /* Register for cleanup */
89 /* both parent and child exit here */
91 dprintf("at exit of %d, test4_2_global1 = %d\n", (int) getpid(),
94 #if defined(rs6000_ibm_aix4_1_test)
96 /* On AIX the child dies when the parent exits, so wait */
97 /* apparently the parent needs to wake up occasionally to keep Dyninst happy */
98 dprintf("%d SLEEPING\n",getpid());
100 dprintf("%d SLEEP MORE\n",getpid());
102 dprintf("%d SLEEP MORE\n",getpid());
104 dprintf("%d DONE SLEEPING\n",getpid());
108 dprintf("Mutatee %d exiting...\n", getpid());
110 } else if (pid < 0) {
115 return 0; /* No error, technically. Shouldn't get here */