tst.linkpriv.ksh revision 288413
1209814Sjchandra# 2209814Sjchandra# CDDL HEADER START 3209814Sjchandra# 4209814Sjchandra# The contents of this file are subject to the terms of the 5209814Sjchandra# Common Development and Distribution License (the "License"). 6209814Sjchandra# You may not use this file except in compliance with the License. 7209814Sjchandra# 8209814Sjchandra# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9209814Sjchandra# or http://www.opensolaris.org/os/licensing. 10209814Sjchandra# See the License for the specific language governing permissions 11209814Sjchandra# and limitations under the License. 12209814Sjchandra# 13209814Sjchandra# When distributing Covered Code, include this CDDL HEADER in each 14209814Sjchandra# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15209814Sjchandra# If applicable, add the following below this CDDL HEADER, with the 16209814Sjchandra# fields enclosed by brackets "[]" replaced with your own identifying 17209814Sjchandra# information: Portions Copyright [yyyy] [name of copyright owner] 18209814Sjchandra# 19209814Sjchandra# CDDL HEADER END 20215270Simp# 21211280Sjchandra 22211280Sjchandra# 23209814Sjchandra# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24209814Sjchandra# Use is subject to license terms. 25209814Sjchandra# 26209814Sjchandra#ident "%Z%%M% %I% %E% SMI" 27209814Sjchandra 28209814Sjchandraif [ $# != 1 ]; then 29209814Sjchandra echo expected one argument: '<'dtrace-path'>' 30209814Sjchandra exit 2 31209814Sjchandrafi 32209814Sjchandra 33209814Sjchandradtrace=$1 34209814SjchandraDIR=/var/tmp/dtest.$$ 35209814Sjchandra 36209814Sjchandramkdir $DIR 37209814Sjchandracd $DIR 38209814Sjchandra 39209814Sjchandracat > test.c <<EOF 40209814Sjchandra#include <sys/sdt.h> 41209814Sjchandra 42209814Sjchandraint 43209814Sjchandramain(int argc, char **argv) 44209814Sjchandra{ 45209814Sjchandra DTRACE_PROBE(test_prov, zero); 46209814Sjchandra DTRACE_PROBE1(test_prov, one, 1); 47209814Sjchandra DTRACE_PROBE2(test_prov, two, 2, 3); 48209814Sjchandra DTRACE_PROBE3(test_prov, three, 4, 5, 7); 49209814Sjchandra DTRACE_PROBE4(test_prov, four, 7, 8, 9, 10); 50209814Sjchandra DTRACE_PROBE5(test_prov, five, 11, 12, 13, 14, 15); 51209814Sjchandra} 52209814SjchandraEOF 53215085Sjchandra 54209814Sjchandracat > prov.d <<EOF 55209814Sjchandraprovider test_prov { 56209814Sjchandra probe zero(); 57209814Sjchandra probe one(uintptr_t); 58209814Sjchandra probe two(uintptr_t, uintptr_t); 59209814Sjchandra probe three(uintptr_t, uintptr_t, uintptr_t); 60209814Sjchandra probe four(uintptr_t, uintptr_t, uintptr_t, uintptr_t); 61209814Sjchandra probe five(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); 62209814Sjchandra}; 63209814SjchandraEOF 64209814Sjchandra 65209814Sjchandracc -c test.c 66209814Sjchandraif [ $? -ne 0 ]; then 67209814Sjchandra print -u2 "failed to compile test.c" 68209814Sjchandra exit 1 69209814Sjchandrafi 70209814Sjchandra$dtrace -G -s prov.d test.o 71209814Sjchandraif [ $? -ne 0 ]; then 72209814Sjchandra print -u2 "failed to create DOF" 73209814Sjchandra exit 1 74209814Sjchandrafi 75209814Sjchandracc -o test test.o prov.o 76209814Sjchandraif [ $? -ne 0 ]; then 77209814Sjchandra print -u2 "failed to link final executable" 78209814Sjchandra exit 1 79209814Sjchandrafi 80209814Sjchandra 81209814Sjchandracd / 82209814Sjchandra/bin/rm -rf $DIR 83209814Sjchandra