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 17DIR=/var/tmp/dtest.$$ 18mkdir $DIR 19cd $DIR 20 21cat > foo.c <<EOF 22#include <stdio.h> 23 24void 25foo() 26{ 27 printf("in foo\n"); 28} 29 30void 31main() 32{ 33 foo(); 34} 35EOF 36 37if ! gcc -m32 -S -o foo.orig.s foo.c ; then 38 print -u 2 "failed to compile foo in $DIR" 39 exit 1 40fi 41 42# 43# There's the right way, the wrong way, and the Max Power way! 44# 45cat foo.orig.s | sed 's/foo/foø/g' > foo.s 46gcc -o foo foo.s 47 48if ! 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 52fi 53 54cd 55rm -rf $DIR 56exit 0 57