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>


  28 #
  29 # This test verifies that performing a dlclose(3dl) on a library doesn't
  30 # cause existing pid provider probes to become invalid.
  31 #
  32 
  33 if [ $# != 1 ]; then
  34         echo expected one argument: '<'dtrace-path'>'
  35         exit 2
  36 fi
  37 
  38 dtrace=$1
  39 DIR=/var/tmp/dtest.$$
  40 
  41 mkdir $DIR
  42 cd $DIR
  43 
  44 cat > Makefile <<EOF
  45 all: main livelib.so deadlib.so
  46 
  47 main: main.o prov.o
  48         gcc -o main main.o
  49 
  50 main.o: main.c
  51         gcc -c main.c
  52 
  53 
  54 livelib.so: livelib.o prov.o
  55         gcc -shared -o livelib.so livelib.o prov.o -lc
  56 
  57 livelib.o: livelib.c prov.h
  58         gcc -c livelib.c
  59 
  60 prov.o: livelib.o prov.d
  61         $dtrace -G -s prov.d livelib.o
  62 
  63 prov.h: prov.d
  64         $dtrace -h -s prov.d
  65 
  66 
  67 deadlib.so: deadlib.o
  68         gcc -shared -o deadlib.so deadlib.o -lc
  69 
  70 deadlib.o: deadlib.c
  71         gcc -c deadlib.c
  72 
  73 clean:
  74         rm -f main.o livelib.o prov.o prov.h deadlib.o
  75 
  76 clobber: clean
  77         rm -f main livelib.so deadlib.so
  78 EOF
  79 
  80 cat > prov.d <<EOF
  81 provider test_prov {
  82         probe go();
  83 };
  84 EOF
  85 
  86 cat > livelib.c <<EOF
  87 #include "prov.h"
  88 
  89 void
  90 go(void)
  91 {




  28 #
  29 # This test verifies that performing a dlclose(3dl) on a library doesn't
  30 # cause existing pid provider probes to become invalid.
  31 #
  32 
  33 if [ $# != 1 ]; then
  34         echo expected one argument: '<'dtrace-path'>'
  35         exit 2
  36 fi
  37 
  38 dtrace=$1
  39 DIR=/var/tmp/dtest.$$
  40 
  41 mkdir $DIR
  42 cd $DIR
  43 
  44 cat > Makefile <<EOF
  45 all: main livelib.so deadlib.so
  46 
  47 main: main.o prov.o
  48         gcc -m32 -o main main.o
  49 
  50 main.o: main.c
  51         gcc -m32 -c main.c
  52 
  53 
  54 livelib.so: livelib.o prov.o
  55         gcc -m32 -shared -o livelib.so livelib.o prov.o -lc
  56 
  57 livelib.o: livelib.c prov.h
  58         gcc -m32 -fPIC -c livelib.c
  59 
  60 prov.o: livelib.o prov.d
  61         $dtrace -G -s prov.d livelib.o
  62 
  63 prov.h: prov.d
  64         $dtrace -h -s prov.d
  65 
  66 
  67 deadlib.so: deadlib.o
  68         gcc -m32 -shared -o deadlib.so deadlib.o -lc
  69 
  70 deadlib.o: deadlib.c
  71         gcc -m32 -fPIC -c deadlib.c
  72 
  73 clean:
  74         rm -f main.o livelib.o prov.o prov.h deadlib.o
  75 
  76 clobber: clean
  77         rm -f main livelib.so deadlib.so
  78 EOF
  79 
  80 cat > prov.d <<EOF
  81 provider test_prov {
  82         probe go();
  83 };
  84 EOF
  85 
  86 cat > livelib.c <<EOF
  87 #include "prov.h"
  88 
  89 void
  90 go(void)
  91 {