19512fe85Sahl# 29512fe85Sahl# CDDL HEADER START 39512fe85Sahl# 49512fe85Sahl# The contents of this file are subject to the terms of the 59512fe85Sahl# Common Development and Distribution License (the "License"). 69512fe85Sahl# You may not use this file except in compliance with the License. 79512fe85Sahl# 89512fe85Sahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 99512fe85Sahl# or http://www.opensolaris.org/os/licensing. 109512fe85Sahl# See the License for the specific language governing permissions 119512fe85Sahl# and limitations under the License. 129512fe85Sahl# 139512fe85Sahl# When distributing Covered Code, include this CDDL HEADER in each 149512fe85Sahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 159512fe85Sahl# If applicable, add the following below this CDDL HEADER, with the 169512fe85Sahl# fields enclosed by brackets "[]" replaced with your own identifying 179512fe85Sahl# information: Portions Copyright [yyyy] [name of copyright owner] 189512fe85Sahl# 199512fe85Sahl# CDDL HEADER END 209512fe85Sahl# 219512fe85Sahl 229512fe85Sahl# 239512fe85Sahl# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 249512fe85Sahl# Use is subject to license terms. 259512fe85Sahl# 269512fe85Sahl 2723b5c241Stomeeif [ $# != 1 ]; then 2823b5c241Stomee echo expected one argument: '<'dtrace-path'>' 2923b5c241Stomee exit 2 3023b5c241Stomeefi 3123b5c241Stomee 3223b5c241Stomeedtrace=$1 339512fe85SahlDIR=/var/tmp/dtest.$$ 349512fe85Sahl 359512fe85Sahlmkdir $DIR 369512fe85Sahlcd $DIR 379512fe85Sahl 389512fe85Sahlppriv -s A=basic $$ 399512fe85Sahl 409512fe85Sahlcat > test.c <<EOF 419512fe85Sahl#include <sys/sdt.h> 429512fe85Sahl 439512fe85Sahlint 449512fe85Sahlmain(int argc, char **argv) 459512fe85Sahl{ 469512fe85Sahl DTRACE_PROBE(test_prov, zero); 479512fe85Sahl DTRACE_PROBE1(test_prov, one, 1); 489512fe85Sahl DTRACE_PROBE2(test_prov, two, 2, 3); 499512fe85Sahl DTRACE_PROBE3(test_prov, three, 4, 5, 7); 509512fe85Sahl DTRACE_PROBE4(test_prov, four, 7, 8, 9, 10); 519512fe85Sahl DTRACE_PROBE5(test_prov, five, 11, 12, 13, 14, 15); 529512fe85Sahl} 539512fe85SahlEOF 549512fe85Sahl 559512fe85Sahlcat > prov.d <<EOF 569512fe85Sahlprovider test_prov { 579512fe85Sahl probe zero(); 589512fe85Sahl probe one(uintptr_t); 599512fe85Sahl probe two(uintptr_t, uintptr_t); 609512fe85Sahl probe three(uintptr_t, uintptr_t, uintptr_t); 619512fe85Sahl probe four(uintptr_t, uintptr_t, uintptr_t, uintptr_t); 629512fe85Sahl probe five(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); 639512fe85Sahl}; 649512fe85SahlEOF 659512fe85Sahl 66*a386cc11SRobert Mustacchigcc -m32 -c test.c 679512fe85Sahlif [ $? -ne 0 ]; then 689512fe85Sahl print -u2 "failed to compile test.c" 699512fe85Sahl exit 1 709512fe85Sahlfi 7123b5c241Stomee$dtrace -G -32 -s prov.d test.o 729512fe85Sahlif [ $? -ne 0 ]; then 739512fe85Sahl print -u2 "failed to create DOF" 749512fe85Sahl exit 1 759512fe85Sahlfi 76*a386cc11SRobert Mustacchigcc -m32 -o test test.o prov.o 779512fe85Sahlif [ $? -ne 0 ]; then 789512fe85Sahl print -u2 "failed to link final executable" 799512fe85Sahl exit 1 809512fe85Sahlfi 819512fe85Sahl 829512fe85Sahlcd / 839512fe85Sahl/usr/bin/rm -rf $DIR 84