Date: Wed, 3 Jun 2015 13:17:33 +0000 From: Eric Badger <eric_badger@dell.com> To: =?iso-8859-1?Q?Mikael_=D6stlund?= <mikael.ostlund.93@gmail.com>, "freebsd-dtrace@freebsd.org" <freebsd-dtrace@freebsd.org> Subject: RE: Static probing Message-ID: <e85300bf53e141a1987151a002b62643@mspexmb1.Beer.Town> In-Reply-To: <CAGFZuoSC=yMMkOaNHvCU3nhEZov5z4P1Za-kzohEt6_TmjX21A@mail.gmail.com> References: <CAGFZuoSC=yMMkOaNHvCU3nhEZov5z4P1Za-kzohEt6_TmjX21A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
You must have DTrace generate a .o file to provide the missing function. Something like:
dtrace -h -s provider.d
cc -c dtracetest.c -o dtracetest.o
dtrace -G -s provider.d dtracetest.o
cc dtracetest.o provider.o -o dtracetest -lelf
The standard makefile bsd.prog.mk also knows how to handle .d files in the SRCS list and will take care of things for you.
Eric
________________________________________
From: Mikael Östlund <mikael.ostlund.93@gmail.com>
Sent: Wednesday, June 03, 2015 3:17 AM
To: freebsd-dtrace@freebsd.org
Subject: Static probing
Hello,
I'm experimenting with DTrace on my system and I'm not able to use static
probing in my code.
Here's my c code:
#include "provider.h"
int main(void) {
TESTPROVIDER_TEST_START("hello");
return (0);
}
And here's my provider.d file:
provider testprovider {
probe test__start(char *);
probe test__done(char *);
};
This is the error message I get when I try to compile my c file:
# gcc dtracetest.c
/tmp//ccjWNu6v.o: In function `main':
dtracetest.c:(.text+0xa): undefined reference to
`__dtrace_testprovider___test__start'
collect2: error: ld returned 1 exit status
(Same message no matter what compiler I try), any ideas?
_______________________________________________
freebsd-dtrace@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace
To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e85300bf53e141a1987151a002b62643>
