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 
  74         BEGIN
  75         {
  76                 spec = speculation();
  77                 speculate(spec);
  78                 printf("this is speculative!\n");
  79         }
  80 
  81         test_prov*:::
  82         {
  83                 probeid = id;
  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 
  75         BEGIN
  76         {
  77                 spec = speculation();
  78                 speculate(spec);
  79                 printf("this is speculative!\n");
  80         }
  81 
  82         test_prov*:::
  83         {
  84                 probeid = id;
  85         }