Print this page
4474 DTrace Userland CTF Support
4475 DTrace userland Keyword
4476 DTrace tests should be better citizens
4479 pid provider types
4480 dof emulation missing checks
Reviewed by: Bryan Cantrill <bryan@joyent.com>


  23 #
  24 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  25 # Use is subject to license terms.
  26 #
  27 
  28 if [ $# != 1 ]; then
  29         echo expected one argument: '<'dtrace-path'>'
  30         exit 2
  31 fi
  32 
  33 dtrace=$1
  34 DIR=/var/tmp/dtest.$$
  35 
  36 mkdir $DIR
  37 cd $DIR
  38 
  39 cat > Makefile <<EOF
  40 all: main livelib.so deadlib.so
  41 
  42 main: main.o prov.o
  43         gcc -o main main.o
  44 
  45 main.o: main.c
  46         gcc -c main.c
  47 
  48 
  49 livelib.so: livelib.o prov.o
  50         gcc -shared -o livelib.so livelib.o prov.o -lc
  51 
  52 livelib.o: livelib.c prov.h
  53         gcc -c livelib.c
  54 
  55 prov.o: livelib.o prov.d
  56         $dtrace -G -s prov.d livelib.o
  57 
  58 prov.h: prov.d
  59         $dtrace -h -s prov.d
  60 
  61 
  62 deadlib.so: deadlib.o
  63         gcc -shared -o deadlib.so deadlib.o -lc
  64 
  65 deadlib.o: deadlib.c
  66         gcc -c deadlib.c
  67 
  68 clean:
  69         rm -f main.o livelib.o prov.o prov.h deadlib.o
  70 
  71 clobber: clean
  72         rm -f main livelib.so deadlib.so
  73 EOF
  74 
  75 cat > prov.d <<EOF
  76 provider test_prov {
  77         probe go();
  78 };
  79 EOF
  80 
  81 cat > livelib.c <<EOF
  82 #include "prov.h"
  83 
  84 void
  85 go(void)
  86 {




  23 #
  24 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  25 # Use is subject to license terms.
  26 #
  27 
  28 if [ $# != 1 ]; then
  29         echo expected one argument: '<'dtrace-path'>'
  30         exit 2
  31 fi
  32 
  33 dtrace=$1
  34 DIR=/var/tmp/dtest.$$
  35 
  36 mkdir $DIR
  37 cd $DIR
  38 
  39 cat > Makefile <<EOF
  40 all: main livelib.so deadlib.so
  41 
  42 main: main.o prov.o
  43         gcc -m32 -o main main.o
  44 
  45 main.o: main.c
  46         gcc -m32 -c main.c
  47 
  48 
  49 livelib.so: livelib.o prov.o
  50         gcc -m32 -shared -o livelib.so livelib.o prov.o -lc
  51 
  52 livelib.o: livelib.c prov.h
  53         gcc -m32 -fPIC -c livelib.c
  54 
  55 prov.o: livelib.o prov.d
  56         $dtrace -G -s prov.d livelib.o
  57 
  58 prov.h: prov.d
  59         $dtrace -h -s prov.d
  60 
  61 
  62 deadlib.so: deadlib.o
  63         gcc -m32 -shared -o deadlib.so deadlib.o -lc
  64 
  65 deadlib.o: deadlib.c
  66         gcc -m32 -fPIC -c deadlib.c
  67 
  68 clean:
  69         rm -f main.o livelib.o prov.o prov.h deadlib.o
  70 
  71 clobber: clean
  72         rm -f main livelib.so deadlib.so
  73 EOF
  74 
  75 cat > prov.d <<EOF
  76 provider test_prov {
  77         probe go();
  78 };
  79 EOF
  80 
  81 cat > livelib.c <<EOF
  82 #include "prov.h"
  83 
  84 void
  85 go(void)
  86 {