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 mkdir $DIR
  35 cd $DIR
  36 
  37 cat > test.c <<EOF
  38 #include <unistd.h>
  39 #include <sys/sdt.h>
  40 
  41 int
  42 main(int argc, char **argv)
  43 {
  44         DTRACE_PROBE(test_prov, probe1);
  45 }
  46 EOF
  47 
  48 cat > prov.d <<EOF
  49 provider test_prov {
  50         probe probe1();
  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 -Zwqs /dev/stdin <<EOF
  73         test_prov*:::
  74         {
  75                 probeid = id;
  76         }
  77 
  78         tick-1sec
  79         /probeid == 0/
  80         {
  81                 printf("launching test\n");
  82                 system("./test");
  83         }
  84 




  34 mkdir $DIR
  35 cd $DIR
  36 
  37 cat > test.c <<EOF
  38 #include <unistd.h>
  39 #include <sys/sdt.h>
  40 
  41 int
  42 main(int argc, char **argv)
  43 {
  44         DTRACE_PROBE(test_prov, probe1);
  45 }
  46 EOF
  47 
  48 cat > prov.d <<EOF
  49 provider test_prov {
  50         probe probe1();
  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 
  65 gcc -m32 -o test test.o prov.o
  66 if [ $? -ne 0 ]; then
  67         print -u2 "failed to link final executable"
  68         exit 1
  69 fi
  70 
  71 script()
  72 {
  73         $dtrace -Zwqs /dev/stdin <<EOF
  74         test_prov*:::
  75         {
  76                 probeid = id;
  77         }
  78 
  79         tick-1sec
  80         /probeid == 0/
  81         {
  82                 printf("launching test\n");
  83                 system("./test");
  84         }
  85