dtrace/userland causing segmentation fault

Javier Liendo javier at liendo.net
Tue Jan 18 06:41:53 UTC 2011


hello freebsd gurus...

i'm currently using FreeBSD 9.0-CURRENT-201101...

dtrace is enable and working

[root@ ~]# dtrace -l | tail -5
41473    profile                                                     tick-1000
41474    profile                                                     tick-5000
41475    profile                                                     tick-1sec
41476 database5533                db                              main
query-done
41477 database5533                db                              main
query-start

i´m trying to use dtrace with a very basic userland program and i´m
100% of the time getting segmentation faults...

------ probes definition file ------
[root@ ~]# cat simple_probes.d
provider simple {
  probe loop(int);
};

------ simple program ------
[root@ ~]# cat simple.c
#include <stdio.h>
#include "simple_probes.h"
int main() {
  int i;
  i=0;
  while(1) {
    printf("%d\n",i);
    i++;
    SIMPLE_LOOP(i);
  }
  return(0);
}

------ the steps i use to get the program compiled are ------
[root@ ~]# dtrace -C -h -s simple_probes.d
[root@ ~]# gcc -c simple.c
[root@ ~]# dtrace -G -s simple_probes.d simple.o
[root@ ~]# gcc -lelf -o simple simple_probes.o simple.o

------ but when i run the program i always get segmentation fault >:( ------
[root@ ~]# ./simple
0
Segmentation fault: 11 (core dumped)

i´ve been banging my head against a wall trying to troubleshoot this
issue with obviously no success...

have any of the freebsd gurus found a similar behavior in the past
regarding userland dtrace?

any pointers/links/words of encouragement will be greatly appreciated...

regards,

javier


More information about the freebsd-questions mailing list