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