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>


  34 
  35 mkdir $DIR
  36 cd $DIR
  37 
  38 cat > test.c <<EOF
  39 #include <sys/sdt.h>
  40 
  41 int
  42 main(int argc, char **argv)
  43 {
  44         DTRACE_PROBE(test_prov, zero);
  45 }
  46 EOF
  47 
  48 cat > prov.d <<EOF
  49 provider test_prov {
  50         probe zero();
  51 };
  52 EOF
  53 
  54 gcc -c test.c
  55 if [ $? -ne 0 ]; then
  56         print -u2 "failed to compile test.c"
  57         exit 1
  58 fi
  59 $dtrace -G -32 -s prov.d test.o
  60 if [ $? -ne 0 ]; then
  61         print -u2 "failed to create DOF"
  62         exit 1
  63 fi
  64 gcc -o test test.o prov.o
  65 if [ $? -ne 0 ]; then
  66         print -u2 "failed to link final executable"
  67         exit 1
  68 fi
  69 
  70 script()
  71 {
  72         $dtrace -wZs /dev/stdin <<EOF
  73         BEGIN
  74         {
  75                 system("$DIR/test");
  76         }
  77 
  78         test_prov*:::
  79         {
  80                 seen = 1;
  81         }
  82 
  83         proc:::exit
  84         /progenyof(\$pid) && execname == "test"/


  34 
  35 mkdir $DIR
  36 cd $DIR
  37 
  38 cat > test.c <<EOF
  39 #include <sys/sdt.h>
  40 
  41 int
  42 main(int argc, char **argv)
  43 {
  44         DTRACE_PROBE(test_prov, zero);
  45 }
  46 EOF
  47 
  48 cat > prov.d <<EOF
  49 provider test_prov {
  50         probe zero();
  51 };
  52 EOF
  53 
  54 gcc -m32 -c test.c
  55 if [ $? -ne 0 ]; then
  56         print -u2 "failed to compile test.c"
  57         exit 1
  58 fi
  59 $dtrace -G -32 -s prov.d test.o
  60 if [ $? -ne 0 ]; then
  61         print -u2 "failed to create DOF"
  62         exit 1
  63 fi
  64 gcc -m32 -o test test.o prov.o
  65 if [ $? -ne 0 ]; then
  66         print -u2 "failed to link final executable"
  67         exit 1
  68 fi
  69 
  70 script()
  71 {
  72         $dtrace -wZs /dev/stdin <<EOF
  73         BEGIN
  74         {
  75                 system("$DIR/test");
  76         }
  77 
  78         test_prov*:::
  79         {
  80                 seen = 1;
  81         }
  82 
  83         proc:::exit
  84         /progenyof(\$pid) && execname == "test"/