12633Sahl# 22633Sahl# CDDL HEADER START 32633Sahl# 42633Sahl# The contents of this file are subject to the terms of the 52633Sahl# Common Development and Distribution License (the "License"). 62633Sahl# You may not use this file except in compliance with the License. 72633Sahl# 82633Sahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 92633Sahl# or http://www.opensolaris.org/os/licensing. 102633Sahl# See the License for the specific language governing permissions 112633Sahl# and limitations under the License. 122633Sahl# 132633Sahl# When distributing Covered Code, include this CDDL HEADER in each 142633Sahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 152633Sahl# If applicable, add the following below this CDDL HEADER, with the 162633Sahl# fields enclosed by brackets "[]" replaced with your own identifying 172633Sahl# information: Portions Copyright [yyyy] [name of copyright owner] 182633Sahl# 192633Sahl# CDDL HEADER END 202633Sahl# 212633Sahl 222633Sahl# 23*4926Sjhaslam# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 242633Sahl# Use is subject to license terms. 252633Sahl# 26*4926Sjhaslam# ident "%Z%%M% %I% %E% SMI" 272633Sahl 282633Sahl# 292633Sahl# This test is a bit naughty; it's assuming that ld.so.1 has an implementation 302633Sahl# of calloc(3C), and that it's implemented in terms of the ld.so.1 312633Sahl# implementation of malloc(3C). If you're reading this comment because 322633Sahl# those assumptions have become false, please accept my apologies... 332633Sahl# 342804Stomeeif [ $# != 1 ]; then 352804Stomee echo expected one argument: '<'dtrace-path'>' 362804Stomee exit 2 372804Stomeefi 382804Stomee 392804Stomeedtrace=$1 402804Stomee 412804Stomee$dtrace -qs /dev/stdin -c "/usr/bin/echo" <<EOF 422633Sahlpid\$target:ld.so.1:calloc:entry 432633Sahl{ 442633Sahl self->calloc = 1; 452633Sahl} 462633Sahl 472633Sahlpid\$target:ld.so.1:malloc:entry 482633Sahl/self->calloc/ 492633Sahl{ 502633Sahl @[umod(ucaller), ufunc(ucaller)] = count(); 512633Sahl} 522633Sahl 532633Sahlpid\$target:ld.so.1:calloc:return 542633Sahl/self->calloc/ 552633Sahl{ 562633Sahl self->calloc = 0; 572633Sahl} 582633Sahl 592633SahlEND 602633Sahl{ 612633Sahl printa("%A %A\n", @); 622633Sahl} 632633SahlEOF 642633Sahl 652633Sahlexit 0 66