1 #!/bin/ksh -p 2 # 3 # This file and its contents are supplied under the terms of the 4 # Common Development and Distribution License ("CDDL"), version 1.0. 5 # You may only use this file in accordance with the terms of version 6 # 1.0 of the CDDL. 7 # 8 # A full copy of the text of the CDDL should have accompanied this 9 # source. A copy of the CDDL is also available via the Internet at 10 # http://www.illumos.org/license/CDDL. 11 # 12 13 # 14 # Copyright (c) 2013 Joyent, Inc. All rights reserved. 15 # 16 17 DIR=/var/tmp/dtest.$$ 18 mkdir $DIR 19 cd $DIR 20 21 cat > foo.c <<EOF 22 #include <stdio.h> 23 24 void 25 foo() 26 { 27 printf("in foo\n"); 28 } 29 30 void 31 main() 32 { 33 foo(); 34 } 35 EOF 36 37 if ! gcc -m32 -S -o foo.orig.s foo.c ; then 38 print -u 2 "failed to compile foo in $DIR" 39 exit 1 40 fi 41 42 # 43 # There's the right way, the wrong way, and the Max Power way! 44 # 45 cat foo.orig.s | sed 's/foo/foø/g' > foo.s 46 gcc -o foo foo.s 47 48 if ! dtrace -n 'pid$target:a.out:f*:entry{printf("probefunc: %s\n", \ 49 probefunc)}' -qc ./foo ; then 50 print -u 2 "dtrace failed in $DIR" 51 exit 1 52 fi 53 54 cd 55 rm -rf $DIR 56 exit 0