xref: /illumos-gate/usr/src/cmd/dtrace/test/tst/common/assocs/tst.invalidref.d (revision 73b80b821da76082173547dd650e417f6916eb8b)
1*fbcb7dbaSjhaslam /*
2*fbcb7dbaSjhaslam  * CDDL HEADER START
3*fbcb7dbaSjhaslam  *
4*fbcb7dbaSjhaslam  * The contents of this file are subject to the terms of the
5*fbcb7dbaSjhaslam  * Common Development and Distribution License (the "License").
6*fbcb7dbaSjhaslam  * You may not use this file except in compliance with the License.
7*fbcb7dbaSjhaslam  *
8*fbcb7dbaSjhaslam  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*fbcb7dbaSjhaslam  * or http://www.opensolaris.org/os/licensing.
10*fbcb7dbaSjhaslam  * See the License for the specific language governing permissions
11*fbcb7dbaSjhaslam  * and limitations under the License.
12*fbcb7dbaSjhaslam  *
13*fbcb7dbaSjhaslam  * When distributing Covered Code, include this CDDL HEADER in each
14*fbcb7dbaSjhaslam  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*fbcb7dbaSjhaslam  * If applicable, add the following below this CDDL HEADER, with the
16*fbcb7dbaSjhaslam  * fields enclosed by brackets "[]" replaced with your own identifying
17*fbcb7dbaSjhaslam  * information: Portions Copyright [yyyy] [name of copyright owner]
18*fbcb7dbaSjhaslam  *
19*fbcb7dbaSjhaslam  * CDDL HEADER END
20*fbcb7dbaSjhaslam  */
21*fbcb7dbaSjhaslam 
22*fbcb7dbaSjhaslam /*
23*fbcb7dbaSjhaslam  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*fbcb7dbaSjhaslam  * Use is subject to license terms.
25*fbcb7dbaSjhaslam  */
26*fbcb7dbaSjhaslam 
27*fbcb7dbaSjhaslam /*
28*fbcb7dbaSjhaslam  * Test to ensure that invalid stores to a global associative array
29*fbcb7dbaSjhaslam  * are caught correctly.
30*fbcb7dbaSjhaslam  */
31*fbcb7dbaSjhaslam 
32*fbcb7dbaSjhaslam #pragma D option quiet
33*fbcb7dbaSjhaslam 
34*fbcb7dbaSjhaslam int last_cmds[int][4];
35*fbcb7dbaSjhaslam 
36*fbcb7dbaSjhaslam BEGIN
37*fbcb7dbaSjhaslam {
38*fbcb7dbaSjhaslam 	errors = 0;
39*fbcb7dbaSjhaslam 	forward = 0;
40*fbcb7dbaSjhaslam 	backward = 0;
41*fbcb7dbaSjhaslam }
42*fbcb7dbaSjhaslam 
43*fbcb7dbaSjhaslam tick-1s
44*fbcb7dbaSjhaslam /!forward/
45*fbcb7dbaSjhaslam {
46*fbcb7dbaSjhaslam 	forward = 1;
47*fbcb7dbaSjhaslam 	last_cmds[1][4] = 0xdeadbeef;
48*fbcb7dbaSjhaslam }
49*fbcb7dbaSjhaslam 
50*fbcb7dbaSjhaslam tick-1s
51*fbcb7dbaSjhaslam /!backward/
52*fbcb7dbaSjhaslam {
53*fbcb7dbaSjhaslam 	backward = 1;
54*fbcb7dbaSjhaslam 	last_cmds[1][-5] = 0xdeadbeef;
55*fbcb7dbaSjhaslam }
56*fbcb7dbaSjhaslam 
57*fbcb7dbaSjhaslam tick-1s
58*fbcb7dbaSjhaslam /errors > 1/
59*fbcb7dbaSjhaslam {
60*fbcb7dbaSjhaslam 	exit(0);
61*fbcb7dbaSjhaslam }
62*fbcb7dbaSjhaslam 
63*fbcb7dbaSjhaslam tick-1s
64*fbcb7dbaSjhaslam /n++ > 5/
65*fbcb7dbaSjhaslam {
66*fbcb7dbaSjhaslam 	exit(1);
67*fbcb7dbaSjhaslam }
68*fbcb7dbaSjhaslam 
69*fbcb7dbaSjhaslam ERROR
70*fbcb7dbaSjhaslam /arg4 == DTRACEFLT_BADADDR/
71*fbcb7dbaSjhaslam {
72*fbcb7dbaSjhaslam 	errors++;
73*fbcb7dbaSjhaslam }
74