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 389512fe85Sahlcat > test.c <<EOF 399512fe85Sahl#include <sys/sdt.h> 409512fe85Sahl 419512fe85Sahlint 429512fe85Sahlmain(int argc, char **argv) 439512fe85Sahl{ 449512fe85Sahl DTRACE_PROBE(test_prov, zero); 459512fe85Sahl DTRACE_PROBE1(test_prov, one, 1); 469512fe85Sahl DTRACE_PROBE2(test_prov, two, 2, 3); 479512fe85Sahl DTRACE_PROBE3(test_prov, three, 4, 5, 7); 489512fe85Sahl DTRACE_PROBE4(test_prov, four, 7, 8, 9, 10); 499512fe85Sahl DTRACE_PROBE5(test_prov, five, 11, 12, 13, 14, 15); 509512fe85Sahl} 519512fe85SahlEOF 529512fe85Sahl 539512fe85Sahlcat > prov.d <<EOF 549512fe85Sahlprovider test_prov { 559512fe85Sahl probe zero(); 569512fe85Sahl probe one(uintptr_t); 579512fe85Sahl probe two(uintptr_t, uintptr_t); 589512fe85Sahl probe three(uintptr_t, uintptr_t, uintptr_t); 599512fe85Sahl probe four(uintptr_t, uintptr_t, uintptr_t, uintptr_t); 609512fe85Sahl probe five(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); 619512fe85Sahl}; 629512fe85SahlEOF 639512fe85Sahl 64*a386cc11SRobert Mustacchigcc -m32 -c test.c 659512fe85Sahlif [ $? -ne 0 ]; then 669512fe85Sahl print -u2 "failed to compile test.c" 679512fe85Sahl exit 1 689512fe85Sahlfi 6923b5c241Stomee$dtrace -G -32 -s prov.d test.o 709512fe85Sahlif [ $? -ne 0 ]; then 719512fe85Sahl print -u2 "failed to create DOF" 729512fe85Sahl exit 1 739512fe85Sahlfi 74*a386cc11SRobert Mustacchigcc -m32 -o test test.o prov.o 759512fe85Sahlif [ $? -ne 0 ]; then 769512fe85Sahl print -u2 "failed to link final executable" 779512fe85Sahl exit 1 789512fe85Sahlfi 799512fe85Sahl 809512fe85Sahlcd / 819512fe85Sahl/usr/bin/rm -rf $DIR 82