aboutsummaryrefslogtreecommitdiff
path: root/cmd/dtrace/test/tst/common/pointers
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/dtrace/test/tst/common/pointers')
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.BadAlign.d50
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.ArrayVar.d47
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.DynamicVar.d50
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.agg.d42
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_DEREF_NONPTR.noptr.d46
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_DEREF_VOID.VoidPointerDeref.d52
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_OP_ARRFUN.ArrayAssignment.d61
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_OP_INCOMPAT.VoidPointerArith.d46
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_OP_LVAL.AddressChange.d50
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.NonPointerAccess.d59
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.badpointer.d50
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.BadPointerAccess.d51
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.badpointer.d44
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.InvalidAddress1.d52
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d52
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d50
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d52
-rw-r--r--cmd/dtrace/test/tst/common/pointers/err.InvalidAddress5.d75
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer1.d174
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer2.d71
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer3.d72
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.GlobalVar.d59
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.IntegerArithmetic1.d72
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic1.d58
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic2.d72
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic3.d61
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.PointerAssignment.d71
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.ValidPointer1.d49
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.ValidPointer2.d49
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.VoidCast.d59
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.basic1.d47
-rw-r--r--cmd/dtrace/test/tst/common/pointers/tst.basic2.d47
32 files changed, 1890 insertions, 0 deletions
diff --git a/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d b/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
new file mode 100644
index 000000000000..ab4106dbeef8
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: This test reproduces the alignment error.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ x = (int *) 64;
+ y = *x;
+ trace(y);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.ArrayVar.d b/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.ArrayVar.d
new file mode 100644
index 000000000000..b68320876d32
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.ArrayVar.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Trying to access the address of a user defined array variable should throw
+ * a D_ADDROF_VAR error.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Address Spaces
+ */
+
+#pragma D option quiet
+
+int a[5];
+int *p;
+
+BEGIN
+{
+ p = &a;
+
+ exit(0);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.DynamicVar.d b/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.DynamicVar.d
new file mode 100644
index 000000000000..028a30a4c108
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.DynamicVar.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Trying to access the address of a user defined dynamic variable should throw
+ * a D_ADDROF_VAR error.
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ * SECTION: Pointers and Arrays/Pointers to Dtrace Objects
+ */
+
+#pragma D option quiet
+
+int i;
+int *p;
+
+BEGIN
+{
+ i = 10;
+ p = &i;
+
+ printf("Integer: %d, Pointer: %d\n", i, *p);
+ exit(0);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.agg.d b/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.agg.d
new file mode 100644
index 000000000000..8b5926200e8f
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.agg.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test that the & operator fails with D_ADDROF_VAR if its operand
+ * is a dynamic variable such as an aggregation.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ * SECTION: Pointers and Arrays/Pointers to Dtrace Objects
+ */
+
+BEGIN
+{
+ @a = count();
+ trace(&@a);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_NONPTR.noptr.d b/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_NONPTR.noptr.d
new file mode 100644
index 000000000000..96d25b40dd9b
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_NONPTR.noptr.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: Can not dereference non-pointers
+ *
+ * SECTION: Pointers and Arrays/Pointer Safety
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int x;
+
+BEGIN
+{
+ b = *x;
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_VOID.VoidPointerDeref.d b/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_VOID.VoidPointerDeref.d
new file mode 100644
index 000000000000..f2fa5b31cb97
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_VOID.VoidPointerDeref.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Cannot dereference a void * pointer.
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ */
+
+#pragma D option quiet
+
+void *p;
+
+int array[3];
+
+BEGIN
+{
+ array[0] = 234;
+ array[1] = 334;
+ array[2] = 434;
+
+ p = &array[0];
+
+ printf("array[0]: %d, p: %d\n", array[0], *p);
+ exit(0);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_OP_ARRFUN.ArrayAssignment.d b/cmd/dtrace/test/tst/common/pointers/err.D_OP_ARRFUN.ArrayAssignment.d
new file mode 100644
index 000000000000..94814a7b7aae
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_OP_ARRFUN.ArrayAssignment.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: Arrays may not be assigned as a whole in D.
+ *
+ * SECTION: Pointers and Arrays/Pointer and Array Relationship
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array1[3];
+int array2[3];
+
+BEGIN
+{
+ array1[0] = 200;
+ array1[1] = 400;
+ array1[2] = 600;
+
+ array2[0] = 300;
+ array2[1] = 500;
+ array2[2] = 700;
+
+ array2 = array1;
+
+ printf("array1[0]: %d\tarray2[0]: %d\n", array1[0], array2[0]);
+ printf("array1[1]: %d\tarray2[1]: %d\n", array1[1], array2[1]);
+ printf("array1[2]: %d\tarray2[2]: %d\n", array1[2], array2[2]);
+
+ exit(0);
+
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_OP_INCOMPAT.VoidPointerArith.d b/cmd/dtrace/test/tst/common/pointers/err.D_OP_INCOMPAT.VoidPointerArith.d
new file mode 100644
index 000000000000..e81c2bd86cc0
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_OP_INCOMPAT.VoidPointerArith.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * May not apply pointer arithmetic to an object of type void *
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ */
+
+#pragma D option quiet
+
+void *p;
+
+BEGIN
+{
+ printf("p: %d\n", (int) p);
+ printf("p+1: %d\n", (int) (p+1));
+ printf("p+2: %d\n", (int) (p+2));
+ exit(0);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_OP_LVAL.AddressChange.d b/cmd/dtrace/test/tst/common/pointers/err.D_OP_LVAL.AddressChange.d
new file mode 100644
index 000000000000..9828240221a9
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_OP_LVAL.AddressChange.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: D pointers do not allow invalid address changes.
+ *
+ * SECTION: Pointers and Arrays/Pointer Safety
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ &`kmem_flags = (int *) 0x185ede4;
+ printf("Address of kmem_flags: %d\n", (int) kmemAddress);
+ printf("Value of kmem_flags: %d\n", `kmem_flags);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.NonPointerAccess.d b/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.NonPointerAccess.d
new file mode 100644
index 000000000000..6f2532770ddf
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.NonPointerAccess.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Accessing the members of a struct using the pointer notation using a
+ * nonpointer variable throws a D_OP_PTR error.
+ *
+ * SECTION: Structs and Unions/Pointers to Structs
+ *
+ */
+
+#pragma D option quiet
+
+struct myinput_struct {
+ int i;
+ char c;
+};
+
+struct myinput_struct f;
+
+BEGIN
+{
+ f.i = 10;
+ f.c = 'c';
+
+ printf("f->i: %d\tf->c: %c\n", f->i, f->c);
+ exit(0);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.badpointer.d b/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.badpointer.d
new file mode 100644
index 000000000000..b1524e539ae1
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.badpointer.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * -> can only be used with pointer operands.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Address Spaces
+ */
+
+#pragma D option quiet
+
+struct teststruct {
+ int a;
+ int b;
+};
+
+struct teststruct xyz;
+
+BEGIN
+{
+ xyz->a = 1;
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.BadPointerAccess.d b/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.BadPointerAccess.d
new file mode 100644
index 000000000000..75635773a6b8
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.BadPointerAccess.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Accessing a pointer to a struct like a non pointer throws a D_OP_SOU.
+ *
+ * SECTION: Structs and Unions/Pointers to Structs
+ *
+ */
+
+#pragma D option quiet
+
+struct myinput_struct {
+ int i;
+ char c;
+};
+
+struct myinput_struct *f;
+BEGIN
+{
+ f.i = 10;
+ f.c = 'c';
+
+ exit(0);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.badpointer.d b/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.badpointer.d
new file mode 100644
index 000000000000..1b351f3451c9
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.badpointer.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * -> can only be used with pointer to structs and unions.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Address Spaces
+ */
+
+#pragma D option quiet
+
+int *abc;
+
+BEGIN
+{
+ abc->a = 1;
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress1.d b/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress1.d
new file mode 100644
index 000000000000..9c9d2f0f905b
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress1.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: D pointers do not allow invalid pointer accesses.
+ *
+ * SECTION: Pointers and Arrays/Pointer Safety
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ kmemAddress = &`kmem_flags;
+ *kmemAddress = 20;
+ printf("Address of kmem_flags: %d\n", (int) kmemAddress);
+ printf("Value of kmem_flags: %d\n", `kmem_flags);
+ exit(0);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d b/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
new file mode 100644
index 000000000000..324f40113ae8
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: D pointers do not allow invalid pointer accesses.
+ *
+ * SECTION: Pointers and Arrays/Pointer Safety
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ x = (int *)alloca(sizeof (int));
+ trace(x);
+ y = (int *) (x - 3300778156056);
+ *y = 3;
+ trace(*y);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d b/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d
new file mode 100644
index 000000000000..39bd1140bdf1
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: D pointers do not allow invalid pointer accesses.
+ *
+ * SECTION: Pointers and Arrays/Pointer Safety
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ y = (int *) (-33007);
+ *y = 3;
+ trace(*y);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d b/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d
new file mode 100644
index 000000000000..9d6b144086b8
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: Demonstrating valid memory access.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ x = (int *)alloca(sizeof (int));
+ printf("Address x: %x\n", (int) x);
+ y = (int *) (x - 2);
+ *y = 3;
+ printf("Address y: %x\tValue: %d\n", (int) y, *y);
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress5.d b/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress5.d
new file mode 100644
index 000000000000..64b77289481f
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress5.d
@@ -0,0 +1,75 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Using integer arithmetic providing a non-aligned memory address will throw
+ * a runtime error.
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ *
+ * NOTES:
+ * This test doesn't apply to x86; for the time being, we're working
+ * around this with the preprocessor.
+ */
+
+#pragma D option quiet
+
+int array[3];
+uintptr_t uptr;
+int *p;
+int *q;
+int *r;
+
+BEGIN
+{
+#ifdef __i386
+ exit(1);
+#else
+ array[0] = 20;
+ array[1] = 40;
+ array[2] = 80;
+
+ uptr = (uintptr_t) &array[0];
+
+ p = (int *) (uptr);
+ q = (int *) (uptr + 2);
+ r = (int *) (uptr + 3);
+
+ printf("array[0]: %d\t*p: %d\n", array[0], *p);
+ printf("array[1]: %d\t*q: %d\n", array[1], *q);
+ printf("array[2]: %d\t*r: %d\n", array[2], *r);
+
+ exit(0);
+#endif
+}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer1.d b/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer1.d
new file mode 100644
index 000000000000..fb9db752cf76
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer1.d
@@ -0,0 +1,174 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: Declare arrays of different data types and verify that the
+ * addresses of the individual elements differ by an amount equal to the number
+ * elements separating them multiplied by the size of each element.
+ *
+ * SECTION: Pointers and Arrays/Array Declarations and Storage;
+ * Pointers and Arrays/Pointer Arithmetic
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+char char_array[5];
+short short_array[5];
+int int_array[5];
+long long_array[5];
+long long long_long_array[5];
+int8_t int8_array[5];
+int16_t int16_array[5];
+int32_t int32_array[5];
+int64_t int64_array[5];
+intptr_t intptr_array[5];
+uint8_t uint8_array[5];
+uint16_t uint16_array[5];
+uint32_t uint32_array[5];
+uint64_t uint64_array[5];
+uintptr_t uintptr_array[5];
+
+/*
+float float_array[5];
+double double_array[5];
+long double long_double_array[5];
+
+string string_array[5];
+*/
+
+struct record {
+ char ch;
+ int in;
+} struct_array[5];
+
+struct {
+ char ch;
+ int in;
+} anon_struct_array[5];
+
+union record {
+ char ch;
+ int in;
+} union_array[5];
+
+union {
+ char ch;
+ int in;
+} anon_union_array[5];
+
+enum colors {
+ RED,
+ GREEN,
+ BLUE
+} enum_array[5];
+
+BEGIN
+{
+ char_var0 = &char_array[0]; char_var2 = &char_array[2];
+ short_var0 = &short_array[0]; short_var3 = &short_array[3];
+ int_var3 = &int_array[3]; int_var5 = &int_array[5];
+
+ long_var0 = &long_array[0]; long_var4 = &long_array[4];
+ long_long_var0 = &long_long_array[0];
+ long_long_var2 = &long_long_array[2];
+ int8_var3 = &int8_array[3]; int8_var5 = &int8_array[5];
+
+ int16_var0 = &int16_array[0]; int16_var4 = &int16_array[4];
+ int32_var0 = &int32_array[0]; int32_var3 = &int32_array[3];
+ int64_var0 = &int64_array[0]; int64_var1 = &int64_array[1];
+
+ uintptr_var0 = &uintptr_array[0]; uintptr_var2 = &uintptr_array[2];
+ struct_var0 = &struct_array[0]; struct_var2 = &struct_array[2];
+ anon_struct_var3 = &anon_struct_array[3];
+ anon_struct_var5 = &anon_struct_array[5];
+
+ union_var0 = &union_array[0]; union_var3 = &union_array[3];
+ anon_union_var0 = &anon_union_array[0];
+ anon_union_var4 = &anon_union_array[4];
+ enum_var0 = &enum_array[0]; enum_var2 = &enum_array[2];
+
+ printf("char_var2 - char_var0: %d\n",
+ (int) char_var2 - (int) char_var0);
+ printf("short_var3 - short_var0: %d\n",
+ (int) short_var3 - (int) short_var0);
+ printf("int_var5 - int_var3: %d\n", (int) int_var5 - (int) int_var3);
+
+ printf("long_var4 - long_var0: %d\n",
+ (int) long_var4 - (int) long_var0);
+ printf("long_long_var2 - long_long_var0: %d\n",
+ (int) long_long_var2 - (int) long_long_var0);
+ printf("int8_var5 - int8_var3: %d\n",
+ (int) int8_var5 - (int) int8_var3);
+
+ printf("int16_var4 - int16_var0: %d\n",
+ (int) int16_var4 - (int) int16_var0);
+ printf("int32_var3 - int32_var0: %d\n",
+ (int) int32_var3 - (int) int32_var0);
+ printf("int64_var1 - int64_var0: %d\n",
+ (int) int64_var1 - (int) int64_var0);
+
+ printf("uintptr_var2 - uintptr_var0: %d\n",
+ (int) uintptr_var2 - (int) uintptr_var0);
+ printf("struct_var2 - struct_var0: %d\n",
+ (int) struct_var2 - (int) struct_var0);
+ printf("anon_struct_var5 - anon_struct_var3: %d\n",
+ (int) anon_struct_var5 - (int) anon_struct_var3);
+
+ printf("union_var3 - union_var0: %d\n",
+ (int) union_var3 - (int) union_var0);
+ printf("anon_union_var4 - anon_union_var0: %d\n",
+ (int) anon_union_var4 - (int) anon_union_var0);
+ printf("enum_var2 - enum_var0: %d\n",
+ (int) enum_var2 - (int) enum_var0);
+ exit(0);
+}
+
+END
+/(2 != ((int) char_var2 - (int) char_var0)) ||
+ (6 != ((int) short_var3 - (int) short_var0)) ||
+ (8 != ((int) int_var5 - (int) int_var3)) ||
+ ((32 != ((int) long_var4 - (int) long_var0)) &&
+ (16 != ((int) long_var4 - (int) long_var0))) ||
+ (16 != ((int) long_long_var2 - (int) long_long_var0)) ||
+ (2 != ((int) int8_var5 - (int) int8_var3))
+ || (8 != ((int) int16_var4 - (int) int16_var0)) ||
+ (12 != ((int) int32_var3 - (int) int32_var0)) ||
+ (8 != ((int) int64_var1 - (int) int64_var0)) ||
+ ((16 != ((int) uintptr_var2 - (int) uintptr_var0))
+ && (8 != ((int) uintptr_var2 - (int) uintptr_var0))) ||
+ (16 != ((int) struct_var2 - (int) struct_var0)) ||
+ (16 != ((int) anon_struct_var5 - (int) anon_struct_var3))
+ || (12 != ((int) union_var3 - (int) union_var0)) ||
+ (16 != ((int) anon_union_var4 - (int) anon_union_var0)) ||
+ (8 != ((int) enum_var2 - (int) enum_var0))/
+{
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer2.d b/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer2.d
new file mode 100644
index 000000000000..bf645398797e
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer2.d
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: D permits the use of array [] index notation with both pointer
+ * variables and array variables.
+ *
+ * SECTION: Pointers and Arrays/Pointer and Array Relationship
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array[5];
+BEGIN
+{
+ array[0] = 100;
+ array[1] = 200;
+ array[2] = 300;
+ array[3] = 400;
+ array[4] = 500;
+
+ p = &array[0];
+
+ printf("array[0]: %d\tp[0]: %d\n", array[0], p[0]);
+ printf("array[1]: %d\tp[1]: %d\n", array[1], p[1]);
+ printf("array[2]: %d\tp[2]: %d\n", array[2], p[2]);
+ printf("array[3]: %d\tp[3]: %d\n", array[3], p[3]);
+ printf("array[4]: %d\tp[4]: %d\n", array[4], p[4]);
+
+ exit(0);
+
+}
+
+END
+/(array[0] != p[0]) || (array[1] != p[1]) || (array[2] != p[2]) ||
+ (array[3] != p[3]) || (array[4] != p[4])/
+{
+ printf("Error");
+ exit(1);
+}
+
+
+
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer3.d b/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer3.d
new file mode 100644
index 000000000000..a0be13069785
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer3.d
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: In D, the an array variable can be assigned to a pointer.
+ *
+ * SECTION: Pointers and Arrays/Pointer and Array Relationship
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array[5];
+int *p;
+
+BEGIN
+{
+ array[0] = 100;
+ array[1] = 200;
+ array[2] = 300;
+ array[3] = 400;
+ array[4] = 500;
+
+ p = array;
+
+ printf("array[0]: %d\tp[0]: %d\n", array[0], p[0]);
+ printf("array[1]: %d\tp[1]: %d\n", array[1], p[1]);
+ printf("array[2]: %d\tp[2]: %d\n", array[2], p[2]);
+ printf("array[3]: %d\tp[3]: %d\n", array[3], p[3]);
+ printf("array[4]: %d\tp[4]: %d\n", array[4], p[4]);
+
+ exit(0);
+
+}
+
+END
+/(array[0] != p[0]) || (array[1] != p[1]) || (array[2] != p[2]) ||
+ (array[3] != p[3]) || (array[4] != p[4])/
+{
+ printf("Error");
+ exit(1);
+}
+
+
+
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.GlobalVar.d b/cmd/dtrace/test/tst/common/pointers/tst.GlobalVar.d
new file mode 100644
index 000000000000..8b7f36e395a0
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.GlobalVar.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: Pointer declarations are global.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ i = 0;
+ kmemAddress = &`kmem_flags;
+ kmemValue = *kmemAddress;
+ printf("Address of kmem_flags: %x\n", (int) kmemAddress);
+ printf("Value of kmem_flags: %d\n", kmemValue);
+}
+
+profile:::tick-1sec
+/(i < 1) && (&`kmem_flags == kmemAddress) && (*kmemAddress == kmemValue)/
+{
+ exit(1);
+}
+
+END
+/(&`kmem_flags == kmemAddress) && (*kmemAddress == kmemValue)/
+{
+ exit(0);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.IntegerArithmetic1.d b/cmd/dtrace/test/tst/common/pointers/tst.IntegerArithmetic1.d
new file mode 100644
index 000000000000..99cbd7e5ee2a
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.IntegerArithmetic1.d
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Integer arithmetic can be performed on pointers by casting to uintptr_t.
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array[3];
+uintptr_t uptr;
+int *p;
+int *q;
+int *r;
+
+BEGIN
+{
+ array[0] = 20;
+ array[1] = 40;
+ array[2] = 80;
+
+ uptr = (uintptr_t) &array[0];
+
+ p = (int *) (uptr);
+ q = (int *) (uptr + 4);
+ r = (int *) (uptr + 8);
+
+ printf("array[0]: %d\t*p: %d\n", array[0], *p);
+ printf("array[1]: %d\t*q: %d\n", array[1], *q);
+ printf("array[2]: %d\t*r: %d\n", array[2], *r);
+
+ exit(0);
+}
+
+END
+/(20 != *p) || (40 != *q) || (80 != *r)/
+{
+ printf("Error");
+ exit(1);
+}
+
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic1.d b/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic1.d
new file mode 100644
index 000000000000..3a96832530e6
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic1.d
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Pointer arithmetic implicitly adjusts the underlying address by
+ * multiplying or dividing the operands by the size of the type referenced
+ * by the pointer.
+ *
+ * SECTION: Pointers and Arrays/Pointer Arithmetic
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int *x;
+
+BEGIN
+{
+ printf("x: %x\n", (int) x);
+ printf("x + 1: %x\n", (int) (x+1));
+ printf("x + 2: %x\n", (int) (x+2));
+ exit(0);
+}
+
+END
+/(0 != (int) x) || (4 != (int) (x+1)) || (8 != (int) (x+2))/
+{
+ printf("Error");
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic2.d b/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic2.d
new file mode 100644
index 000000000000..ac55eb448cbf
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic2.d
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * D pointers can be used to refer to consecutive storage locations like
+ * arrays.
+ *
+ * SECTION: Pointers and Arrays/Pointer and Array Relationship
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array[5];
+BEGIN
+{
+ array[0] = 100;
+ array[1] = 200;
+ array[2] = 300;
+ array[3] = 400;
+ array[4] = 500;
+
+ p = &array[0];
+
+ printf("array[0]: %d\t*p: %d\n", array[0], *p);
+ printf("array[1]: %d\t*(p+1): %d\n", array[1], *(p+1));
+ printf("array[2]: %d\t*(p+2): %d\n", array[2], *(p+2));
+ printf("array[3]: %d\t*(p+3): %d\n", array[3], *(p+3));
+ printf("array[4]: %d\t*(p+4): %d\n", array[4], *(p+4));
+
+ exit(0);
+
+}
+
+END
+/(array[0] != *p) || (array[1] != *(p+1)) || (array[2] != *(p+2))
+ || (array[3] != *(p+3)) || (array[4] != *(p+4))/
+{
+ printf("Error");
+ exit(1);
+}
+
+
+
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic3.d b/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic3.d
new file mode 100644
index 000000000000..a4f4bfc4834d
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic3.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Pointer arithmetic implicitly adjusts the underlying address by
+ * multiplying or dividing the operands by the size of the type referenced
+ * by the pointer.
+ *
+ * SECTION: Pointers and Arrays/Pointer Arithmetic
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int *x;
+int *y;
+int a[5];
+
+BEGIN
+{
+ x = &a[0];
+ y = &a[2];
+
+ printf("y-x: %x\n", (int) (y-x));
+ exit(0);
+}
+
+END
+/(2 != (int) (y-x)) /
+{
+ printf("Error");
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.PointerAssignment.d b/cmd/dtrace/test/tst/common/pointers/tst.PointerAssignment.d
new file mode 100644
index 000000000000..3a4968695dcf
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.PointerAssignment.d
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: Pointers assignment simply copies over the pointer address in the
+ * variable on the right hand side into the variable on the left hand side.
+ *
+ * SECTION: Pointers and Arrays/Pointer and Array Relationship
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array[3];
+int *ptr1;
+int *ptr2;
+
+BEGIN
+{
+ array[0] = 200;
+ array[1] = 400;
+ array[2] = 600;
+
+ ptr1 = array;
+ ptr2 = ptr1;
+
+ ptr2[0] = 400;
+ ptr2[1] = 800;
+ ptr2[2] = 1200;
+
+ printf("array[0]: %d\tptr2[0]: %d\n", array[0], ptr2[0]);
+ printf("array[1]: %d\tptr2[1]: %d\n", array[1], ptr2[1]);
+ printf("array[2]: %d\tptr2[2]: %d\n", array[2], ptr2[2]);
+
+ exit(0);
+
+}
+
+END
+/(array[0] != 400) || (array[1] != 800) || (array[2] != 1200)/
+{
+ printf("Error");
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer1.d b/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer1.d
new file mode 100644
index 000000000000..5d9db388cbb3
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer1.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: Demonstrating valid memory access.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ x = (int *)alloca(sizeof (int));
+ printf("Address x: %x\n", (int) x);
+ y = (int *) (x);
+ *y = 3;
+ printf("Address y: %x\tValue: %d\n", (int) y, *y);
+
+ exit(0);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer2.d b/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer2.d
new file mode 100644
index 000000000000..26d698aea3b2
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer2.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: Demonstrating valid memory access.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ x = (int *)alloca(sizeof (int));
+ printf("Address x: %x\n", (int) x);
+ y = (int *) (x + 2);
+ *y = 3;
+ printf("Address y: %x\tValue: %d\n", (int) y, *y);
+
+ exit(0);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.VoidCast.d b/cmd/dtrace/test/tst/common/pointers/tst.VoidCast.d
new file mode 100644
index 000000000000..296fdf408fc7
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.VoidCast.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Can dereference a void * pointer only by casting it to another type.
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ */
+
+#pragma D option quiet
+
+void *p;
+
+int array[3];
+
+BEGIN
+{
+ array[0] = 234;
+ array[1] = 334;
+ array[2] = 434;
+
+ p = &array[0];
+ newp = (int *) p;
+
+ printf("array[0]: %d, newp: %d\n", array[0], *newp);
+ exit(0);
+}
+
+END
+/234 != *newp/
+{
+ exit(1);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.basic1.d b/cmd/dtrace/test/tst/common/pointers/tst.basic1.d
new file mode 100644
index 000000000000..bf3154a0d2cf
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.basic1.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: Pointers can be stored in variables.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ kmemAddress = &`kmem_flags;
+ kmemValue = *kmemAddress;
+ printf("Address of kmem_flags: %x\n", (int) kmemAddress);
+ printf("Value of kmem_flags: %d\n", kmemValue);
+ exit(0);
+}
diff --git a/cmd/dtrace/test/tst/common/pointers/tst.basic2.d b/cmd/dtrace/test/tst/common/pointers/tst.basic2.d
new file mode 100644
index 000000000000..6b72b632e53d
--- /dev/null
+++ b/cmd/dtrace/test/tst/common/pointers/tst.basic2.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION: Pointers can be stored in associative arrays.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ assoc_array["kmemAddress"] = &`kmem_flags;
+ kmemValue = *(assoc_array["kmemAddress"]);
+ printf("Address of kmem_flags: %x\n", (int) assoc_array["kmemAddress"]);
+ printf("Value of kmem_flags: %d\n", kmemValue);
+ exit(0);
+}