[lttng-dev] UST - Is it possible to merge my source file and the tracepoint file?

Thibault, Daniel Daniel.Thibault at drdc-rddc.gc.ca
Tue Oct 22 15:29:55 EDT 2013


-----Message d'origine-----
Date: Mon, 21 Oct 2013 16:16:30 +0300
From: Amit Margalit <AMITM at il.ibm.com>

Consider the following situation:

I wrote a header (lttng_tp_hdr.h) containing several tracepoints, matching some locations I want to instrument in one of my source files (let's call it source.c). I created a C file for this header (lttng_tp_src.c) and compiled it into object. I then compiled source.c into source.o and I link the two objects together.

This is the standard work mode.

Now I want to automate this procedure, which will cause me to generate new C files, and new headers for many of my sources.

How can I rewrite my source.c so it contains everything I need?

Amit Margalit
------------------------------
   Presumably source.c contains at least the tracepoint() calls?  Do you wish the tracepoint provider (lttng_tp_hdr.h + lttng_tp_src.c) to be statically included in each linked object (possibly through a shared static library (.a)), or would you rather have your various objects all share a tracepoint provider library (.so)?  In the latter case, would you prefer the tracepoint provider library to be a dependency (static awareness: the instrumented apps won't run at all unless they can find the .so) or not (meaning you'll need to LD_PRELOAD the .so to turn tracing on)?  (There's also the case where the apps control their own traceability by using dlopen() and dlclose() with the tracepoint provider .so)

   Typically, you need add just the tracepoint() calls and an "#include tracepointprovider.h" in the sources, and you control compilation with the -D TRACEPOINT_DEFINE and -D TRACEPOINT_PROBE_DYNAMIC_LINKAGE switches.

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/>
 LinkedIn: <http://ca.linkedin.com/in/daniel-u-thibault/>
 Research Gate: <https://www.researchgate.net/profile/Daniel_Thibault/>



More information about the lttng-dev mailing list