9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# CDDL HEADER START
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# The contents of this file are subject to the terms of the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# Common Development and Distribution License (the "License").
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# You may not use this file except in compliance with the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# or http://www.opensolaris.org/os/licensing.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# See the License for the specific language governing permissions
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# and limitations under the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# When distributing Covered Code, include this CDDL HEADER in each
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# If applicable, add the following below this CDDL HEADER, with the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# fields enclosed by brackets "[]" replaced with your own identifying
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# information: Portions Copyright [yyyy] [name of copyright owner]
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# CDDL HEADER END
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl# Use is subject to license terms.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomeeif [ $# != 1 ]; then
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee echo expected one argument: '<'dtrace-path'>'
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee exit 2
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomeefi
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomeedtrace=$1
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#
c090e5dfb10cc96e71e6b0f55bf98c18027b002cBryan Cantrill# Some variants of nm may exec a 64-bit version of themselves. DTrace uses
c090e5dfb10cc96e71e6b0f55bf98c18027b002cBryan Cantrill# libproc (which uses /proc) to find out when the traced process exits, but a
c090e5dfb10cc96e71e6b0f55bf98c18027b002cBryan Cantrill# 32-bit process can't examine a 64-bit one with libproc. The LD_NOEXEC_64
c090e5dfb10cc96e71e6b0f55bf98c18027b002cBryan Cantrill# variable prevents nm from re-execing itself.
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee#
c090e5dfb10cc96e71e6b0f55bf98c18027b002cBryan CantrillLD_NOEXEC_64=nono $dtrace -F -s /dev/stdin -c 'nm /bin/ls' stat <<EOF
23b5c241225a8ade2b6b9f06ebb891ee459e3b02tomee
9512fe850e98fdd448c638ca63fdd92a8a510255ahlpid\$target::\$1:entry
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl self->start = vtimestamp;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlpid\$target:::entry
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/self->start/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl trace(vtimestamp - self->start);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlpid\$target:::return
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/self->start/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl trace(vtimestamp - self->start);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlpid\$target::\$1:return
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/self->start/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl self->start = 0;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl exit(0);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlsyscall:::
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/self->start/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl trace(vtimestamp - self->start);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlfbt:::
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/self->start/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl trace(vtimestamp - self->start);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahlEOF