From owner-freebsd-dtrace@FreeBSD.ORG Wed Jun 3 14:21:14 2015 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB998E5 for ; Wed, 3 Jun 2015 14:21:14 +0000 (UTC) (envelope-from mikael.ostlund.93@gmail.com) Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [IPv6:2a00:1450:400c:c00::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B9B51282 for ; Wed, 3 Jun 2015 14:21:14 +0000 (UTC) (envelope-from mikael.ostlund.93@gmail.com) Received: by wgme6 with SMTP id e6so10606447wgm.2 for ; Wed, 03 Jun 2015 07:21:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RVh6OPLw4/MnNpXf9L9f7wjCDC7SIVkU/UjfI+GWeR8=; b=DJeLGuZXHW7m42pXOovZzP0fkPxpDrfvhIZvgazlWV/4MngxIRra2oDnpk0w469qUS KjkVKrH38McnOwKiUn5ZbLWBxeoGeSk9NuPfBFIrXUaNoFbkwd19Sql9YZUXSPfkjWYa AIatckraEPEfcsAfNbSKR0k2/09sEM6hHue5cnpNEgJ2NABP8q54yNeM+WICb7keRL0D vAHqlK2DkFoO3YozWHqepQuVSo9+kOe2nog+6fQKwdjy5FAdhhSYruyj64cglUgnfWzG yERcT8epi9hkKvPDWeQvq2M6lIQv6yCqgS9hwMXL4pvXNf7iXAh/IIKCm4N6cOPNVcQN JO1w== MIME-Version: 1.0 X-Received: by 10.195.13.1 with SMTP id eu1mr62339474wjd.131.1433341272489; Wed, 03 Jun 2015 07:21:12 -0700 (PDT) Received: by 10.28.97.66 with HTTP; Wed, 3 Jun 2015 07:21:12 -0700 (PDT) In-Reply-To: References: Date: Wed, 3 Jun 2015 16:21:12 +0200 Message-ID: Subject: Re: Static probing From: =?UTF-8?Q?Mikael_=C3=96stlund?= To: Eric Badger Cc: "freebsd-dtrace@freebsd.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2015 14:21:14 -0000 Thank you, worked straight away. 2015-06-03 15:17 GMT+02:00 Eric Badger : > 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 =C3=96stlund > 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" >