tst.linkpriv.ksh revision 178476
160107Sobrien#
28119Sasami# CDDL HEADER START
38119Sasami#
48119Sasami# The contents of this file are subject to the terms of the
58119Sasami# Common Development and Distribution License (the "License").
68119Sasami# You may not use this file except in compliance with the License.
78119Sasami#
88119Sasami# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
932822Syokota# or http://www.opensolaris.org/os/licensing.
108119Sasami# See the License for the specific language governing permissions
118119Sasami# and limitations under the License.
128119Sasami#
1332822Syokota# When distributing Covered Code, include this CDDL HEADER in each
148119Sasami# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
158119Sasami# If applicable, add the following below this CDDL HEADER, with the
168119Sasami# fields enclosed by brackets "[]" replaced with your own identifying
178119Sasami# information: Portions Copyright [yyyy] [name of copyright owner]
1832822Syokota#
1932822Syokota# CDDL HEADER END
208119Sasami#
2138141Syokota
228119Sasami#
238119Sasami# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
248119Sasami# Use is subject to license terms.
258119Sasami#
268119Sasami#ident	"%Z%%M%	%I%	%E% SMI"
278119Sasami
288119Sasamiif [ $# != 1 ]; then
298119Sasami	echo expected one argument: '<'dtrace-path'>'
308119Sasami	exit 2
318119Sasamifi
3232822Syokota
3332822Syokotadtrace=$1
348119SasamiDIR=/var/tmp/dtest.$$
358119Sasami
368119Sasamimkdir $DIR
378119Sasamicd $DIR
388119Sasami
398119Sasamicat > test.c <<EOF
408119Sasami#include <sys/sdt.h>
418119Sasami
428119Sasamiint
438119Sasamimain(int argc, char **argv)
448119Sasami{
458119Sasami	DTRACE_PROBE(test_prov, zero);
468119Sasami	DTRACE_PROBE1(test_prov, one, 1);
478119Sasami	DTRACE_PROBE2(test_prov, two, 2, 3);
488119Sasami	DTRACE_PROBE3(test_prov, three, 4, 5, 7);
4932822Syokota	DTRACE_PROBE4(test_prov, four, 7, 8, 9, 10);
508119Sasami	DTRACE_PROBE5(test_prov, five, 11, 12, 13, 14, 15);
518119Sasami}
528119SasamiEOF
538119Sasami
548119Sasamicat > prov.d <<EOF
558119Sasamiprovider test_prov {
568119Sasami	probe zero();
578119Sasami	probe one(uintptr_t);
588119Sasami	probe two(uintptr_t, uintptr_t);
598119Sasami	probe three(uintptr_t, uintptr_t, uintptr_t);
608119Sasami	probe four(uintptr_t, uintptr_t, uintptr_t, uintptr_t);
6143334Syokota	probe five(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
628119Sasami};
6332822SyokotaEOF
648119Sasami
658119Sasamicc -c test.c
668119Sasamiif [ $? -ne 0 ]; then
678119Sasami	print -u2 "failed to compile test.c"
688119Sasami	exit 1
698119Sasamifi
708119Sasami$dtrace -G -32 -s prov.d test.o
718119Sasamiif [ $? -ne 0 ]; then
728119Sasami	print -u2 "failed to create DOF"
738119Sasami	exit 1
748119Sasamifi
758119Sasamicc -o test test.o prov.o
768119Sasamiif [ $? -ne 0 ]; then
778119Sasami	print -u2 "failed to link final executable"
788119Sasami	exit 1
798119Sasamifi
808119Sasami
818119Sasamicd /
8238141Syokota/usr/bin/rm -rf $DIR
838119Sasami