1# 2# CDDL HEADER START 3# 4# The contents of this file are subject to the terms of the 5# Common Development and Distribution License (the "License"). 6# You may not use this file except in compliance with the License. 7# 8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9# or http://www.opensolaris.org/os/licensing. 10# See the License for the specific language governing permissions 11# and limitations under the License. 12# 13# When distributing Covered Code, include this CDDL HEADER in each 14# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15# If applicable, add the following below this CDDL HEADER, with the 16# fields enclosed by brackets "[]" replaced with your own identifying 17# information: Portions Copyright [yyyy] [name of copyright owner] 18# 19# CDDL HEADER END 20# 21 22# 23# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26#pragma ident "@(#)tst.entryreturn.ksh 1.1 06/08/28 SMI" 27 28DIR=/var/tmp/dtest.$$ 29 30mkdir $DIR 31cd $DIR 32 33cat > test.c <<EOF 34#include <sys/sdt.h> 35 36int 37main(int argc, char **argv) 38{ 39 DTRACE_PROBE(test_prov, entry); 40 DTRACE_PROBE(test_prov, __entry); 41 DTRACE_PROBE(test_prov, foo__entry); 42 DTRACE_PROBE(test_prov, carpentry); 43 DTRACE_PROBE(test_prov, miniatureturn); 44 DTRACE_PROBE(test_prov, foo__return); 45 DTRACE_PROBE(test_prov, __return); 46 /* 47 * Unfortunately, a "return" probe is not currently possible due to 48 * the conflict with a reserved word. 49 */ 50 DTRACE_PROBE(test_prov, done); 51} 52EOF 53 54cat > prov.d <<EOF 55provider test_prov { 56 probe entry(); 57 probe __entry(); 58 probe foo__entry(); 59 probe carpentry(); 60 probe miniatureturn(); 61 probe foo__return(); 62 probe __return(); 63 probe done(); 64}; 65EOF 66 67cc -c test.c 68if [ $? -ne 0 ]; then 69 print -u2 "failed to compile test.c" 70 exit 1 71fi 72dtrace -G -32 -s prov.d test.o 73if [ $? -ne 0 ]; then 74 print -u2 "failed to create DOF" 75 exit 1 76fi 77cc -o test test.o prov.o 78if [ $? -ne 0 ]; then 79 print -u2 "failed to link final executable" 80 exit 1 81fi 82 83script() 84{ 85 dtrace -wqZFs /dev/stdin <<EOF 86 BEGIN 87 { 88 system("$DIR/test"); 89 printf("\n"); 90 } 91 92 test_prov*:::done 93 /progenyof(\$pid)/ 94 { 95 exit(0); 96 } 97 98 test_prov*::: 99 /progenyof(\$pid)/ 100 { 101 printf("\n"); 102 } 103EOF 104} 105 106script | cut -c5- 107status=$? 108 109cd / 110/usr/bin/rm -rf $DIR 111 112exit $status 113