-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
I started playing with bpftrace and bcc tools, but I cannot get bpftrace to work with usdt probes. bcc's trace works fine.
Issue:
$ sudo ./build/src/bpftrace -e 'usdt:/home/david/git/bpftrace/a.out:testprobe { time("%H:%M:%S "); printf("%-6d %d\n", pid, arg0); }'
Attaching 1 probe...
Error finding location for probe: usdt:/home/david/git/bpftrace/a.out:testprobebcc on the same binary
$ sudo ../../bcc/tools/trace.py 'u:/home/david/git/bpftrace/a.out:testprobe "%d" retval'
PID TID COMM FUNC -
7442 7442 a.out testprobe 1547067909
7442 7442 a.out testprobe 1547067910example code from here
$ cat test.c
#include <sys/sdt.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdio.h>
long int myclock() {
struct timeval tv;
gettimeofday(&tv, NULL);
//printf("%ld\n", tv.tv_sec);
DTRACE_PROBE1(test-app, testprobe, tv.tv_sec);
return tv.tv_sec;
}
int main(int argc, char **argv)
{
while(1) {
myclock();
sleep(1);
}
return 0;
}Using an uretprobe on the function works though
$ sudo ./build/src/bpftrace -e 'uretprobe:/home/david/git/bpftrace/a.out:myclock { time("%H:%M:%S "); printf("%-6d %d\n", pid, retval); }'
Attaching 1 probe...
22:13:17 7660 1547068397
22:13:18 7660 1547068398What am I doing wrong? I am on HEAD on both projects..
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels