[lttng-dev] lttng-dev Digest, Vol 66, Issue 24

Thibault, Daniel Daniel.Thibault at drdc-rddc.gc.ca
Tue Oct 29 12:29:40 EDT 2013


Date: Tue, 29 Oct 2013 09:50:05 +0800

> However, If one more tracepoint include file(sample_tracepoint2.h) added in app, compile failed.
>
> compile:
>
> gcc -I. -o sample sample.c -ldl -llttng-ust
> sample.c: In function main:sample.c:12: error: __tracepoint_sample2___bytes_in undeclared (first use in this function)
> sample.c:12: error: (Each undeclared identifier is reported only once
> sample.c:12: error: for each function it appears in.)
>
>   Does LTTng support compiling multiple tracepoint sources with app directly?  Yes, I can compile multiple tracepoint providers to share libs and link them to app through TRACEPOINT_PROBE_DYNAMIC_LINKAGE such as what doc/examples/demo does.

   The problem seems to be olne of missing steps.  First create:

sample_tracepoint.c

#define TRACEPOINT_CREATE_PROBES
#include "sample_tracepoint.h"

   And likewise sample_tracepoint2.c.  In sample.c, remove the #define TRACEPOINT_CREATE_PROBES line.  Finally, compile like this:

$ gcc -I. -c -o sample_tracepoint.o sample_tracepoint.c
$ gcc -I. -c -o sample_tracepoint2.o sample_tracepoint2.c
$ gcc -I. -c -o sample.o sample.c
$ gcc -L/usr/local/lib -o sample sample.o sample_tracepoint.o sample_tracepoint2.o -ldl -llttng-ust

   (the -L/usr/local/lib may be unnecessary, depending on your configuration)

   You can see another example of multiple tracepoint provider use in lttng-ust/doc/examples/demo

Daniel U. Thibault
Protection des systèmes et contremesures (PSC) | Systems Protection & Countermeasures (SPC)
Cyber sécurité pour les missions essentielles (CME) | Mission Critical Cyber Security (MCCS)
R & D pour la défense Canada - Valcartier (RDDC Valcartier) | Defence R&D Canada - Valcartier (DRDC Valcartier)
2459 route de la Bravoure
Québec QC  G3J 1X5
CANADA
Vox : (418) 844-4000 x4245
Fax : (418) 844-4538
NAC : 918V QSDJ <http://www.travelgis.com/map.asp?addr=918V%20QSDJ>
Gouvernement du Canada | Government of Canada
<http://www.valcartier.drdc-rddc.gc.ca/>



More information about the lttng-dev mailing list