<font size=2 face="sans-serif">Hi,</font>
<br>
<br><font size=2 face="sans-serif">> </font><tt><font size=2>Presumably
source.c contains at least the tracepoint() calls?</font></tt>
<br>
<br><font size=2 face="sans-serif">Not at first. This file begins as a
simple C file, and my instrumentor is parsing it, automatically generating
source_tp.h and source_tp.c, and then embeds the #include line and the
tracepoint() calls into source.c itself.</font>
<br>
<br><font size=2 face="sans-serif">> </font><tt><font size=2>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))</font></tt>
<br>
<br><font size=2 face="sans-serif">I want to compile a single C file into
a single object file, so that I do not need to change anything in my project's
existing build, except to tell it to use my automated instrumentation tool
before compiling.</font>
<br>
<br><font size=2 face="sans-serif">Here's what I mean -</font>
<br>
<br><font size=2 face="sans-serif">In the standard work mode, I use 2 C
files: (1) my source.c which contains:</font>
<br>
<ol>
<li value=1><font size=2 face="sans-serif">Headers + Declarations</font>
<li value=2><font size=2 face="sans-serif">Include of source_tp.h (which
gives declarations tracepoint functions __tracepoint_cb_<provider>___<tp-name>()
among other things)</font>
<li value=3><font size=2 face="sans-serif">My own function definitions
with calls to tracepoint()</font></ol>
<br><font size=2 face="sans-serif">And (2) is source_tp.c which contains
(by defining </font><tt><font size=2>TRACEPOINT_DEFINE</font></tt><font size=2 face="sans-serif">
and including source_tp.h):</font>
<br>
<ol>
<li value=1><font size=2 face="sans-serif">Various declarations</font>
<li value=2><font size=2 face="sans-serif">Definitions, for example the
functions named __tracepoint_cb_<provider>___<tp-name>(), etc.</font></ol>
<br><font size=2 face="sans-serif">This means that I need to add source_tp.c
as a dependency of my build and explain how to create it, but also, to
have manually added the tracepoint() calls and the include of source_tp.h.</font>
<br>
<br><font size=2 face="sans-serif">What I would like, is to take a pre-processed
version of source.c (after cpp but before the addition of tracepoint calls),
and to end up with a new file that contains:</font>
<br>
<ol>
<li value=1><font size=2 face="sans-serif">Headers + Declarations</font>
<li value=2><font size=2 face="sans-serif">Declarations of tracepoint functions
__tracepoint_cb_<provider>___<tp-name>() among other things)</font>
<li value=3><font size=2 face="sans-serif">My own function definitions
with the macro calls to tracepoint() already "unrolled".</font>
<li value=4><font size=2 face="sans-serif">Lttng function definitions,
i.e. the functions named __tracepoint_cb_<provider>___<tp-name>(),
etc.</font>
<li value=5></ol><font size=2 face="sans-serif">This file can then be compiled
directly to a single .o file which contains everything I need, and is a
single unit containing my code and tracepoint provider code.</font>
<br>
<br><font size=2 face="sans-serif">Right now, I have a working instrumentor,
which requires a rather complex (read - slow...) procedure in order to
end up with a unified .o file.</font>
<br>
<br><font size=2 face="sans-serif">I am looking to streamline this process
and make it faster.</font>
<br>
<br><font size=2 color=#000080 face="sans-serif">Amit Margalit</font>
<br><font size=2 color=#808000 face="sans-serif">IBM XIV </font><font size=2 face="sans-serif">-
<i>Storage Reinvented</i></font>
<br><font size=2 face="sans-serif">XIV-NAS Development Team</font>
<br><font size=2 face="sans-serif">Tel. 03</font><font size=2 face="Arial">-689-7774</font>
<br><font size=2 face="Arial">Fax. 03-689-7230</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From:      
 </font><font size=1 face="sans-serif">"Thibault, Daniel"
<Daniel.Thibault@drdc-rddc.gc.ca></font>
<br><font size=1 color=#5f5f5f face="sans-serif">To:      
 </font><font size=1 face="sans-serif">"lttng-dev@lists.lttng.org"
<lttng-dev@lists.lttng.org></font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date:      
 </font><font size=1 face="sans-serif">10/22/2013 10:31 PM</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject:    
   </font><font size=1 face="sans-serif">Re: [lttng-dev]
UST - Is it possible to merge my source file and the tracepoint file?</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>-----Message d'origine-----<br>
Date: Mon, 21 Oct 2013 16:16:30 +0300<br>
From: Amit Margalit <AMITM@il.ibm.com><br>
<br>
Consider the following situation:<br>
<br>
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.<br>
<br>
This is the standard work mode.<br>
<br>
Now I want to automate this procedure, which will cause me to generate
new C files, and new headers for many of my sources.<br>
<br>
How can I rewrite my source.c so it contains everything I need?<br>
<br>
Amit Margalit<br>
------------------------------<br>
   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)<br>
<br>
   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.<br>
<br>
Daniel U. Thibault<br>
Protection des systèmes et contremesures (PSC) | Systems Protection &
Countermeasures (SPC)<br>
Cyber sécurité pour les missions essentielles (CME) | Mission Critical
Cyber Security (MCCS)<br>
R & D pour la défense Canada - Valcartier (RDDC Valcartier) | Defence
R&D Canada - Valcartier (DRDC Valcartier)<br>
2459 route de la Bravoure<br>
Québec QC  G3J 1X5<br>
CANADA<br>
Vox : (418) 844-4000 x4245<br>
Fax : (418) 844-4538<br>
NAC : 918V QSDJ <</font></tt><a href="http://www.travelgis.com/map.asp?addr=918V%20QSDJ"><tt><font size=2>http://www.travelgis.com/map.asp?addr=918V%20QSDJ</font></tt></a><tt><font size=2>><br>
Gouvernement du Canada | Government of Canada<br>
<</font></tt><a href="http://www.valcartier.drdc-rddc.gc.ca/"><tt><font size=2>http://www.valcartier.drdc-rddc.gc.ca/</font></tt></a><tt><font size=2>><br>
 LinkedIn: <</font></tt><a href="http://ca.linkedin.com/in/daniel-u-thibault/"><tt><font size=2>http://ca.linkedin.com/in/daniel-u-thibault/</font></tt></a><tt><font size=2>><br>
 Research Gate: <</font></tt><a href=https://www.researchgate.net/profile/Daniel_Thibault/><tt><font size=2>https://www.researchgate.net/profile/Daniel_Thibault/</font></tt></a><tt><font size=2>><br>
<br>
_______________________________________________<br>
lttng-dev mailing list<br>
lttng-dev@lists.lttng.org<br>
</font></tt><a href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev"><tt><font size=2>http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</font></tt></a><tt><font size=2><br>
<br>
</font></tt>
<br>