6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl#
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# CDDL HEADER START
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl#
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# The contents of this file are subject to the terms of the
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# Common Development and Distribution License (the "License").
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# You may not use this file except in compliance with the License.
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl#
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# or http://www.opensolaris.org/os/licensing.
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# See the License for the specific language governing permissions
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# and limitations under the License.
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl#
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# When distributing Covered Code, include this CDDL HEADER in each
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# If applicable, add the following below this CDDL HEADER, with the
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# fields enclosed by brackets "[]" replaced with your own identifying
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# information: Portions Copyright [yyyy] [name of copyright owner]
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl#
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# CDDL HEADER END
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl#
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl#
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# Use is subject to license terms.
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl#
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl# ident "%Z%%M% %I% %E% SMI"
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahlif [ $# != 1 ]; then
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl echo expected one argument: '<'dtrace-path'>'
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl exit 2
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahlfi
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahllibdir=${TMPDIR:-/tmp}/libdep.$$
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahldtrace=$1
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahlsetup_libs()
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl{
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl mkdir $libdir
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl cat > $libdir/liba.$$.d <<EOF
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl#pragma D depends_on library libb.$$.d
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahlinline int foo = bar;
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahlEOF
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl cat > $libdir/libb.$$.d <<EOF
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl#pragma D depends_on module doogle_knows_all_probes
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahlinline int bar = 0xd0061e;
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahlEOF
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl}
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahlsetup_libs
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl$dtrace -L$libdir -e
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahl
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahlstatus=$?
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahlrm -rf $libdir
6009dbc6db3fe0e2890761d3d562bb4c4b9bf0beahlreturn $status