<div dir="ltr">Thanks for your help.<div>It seems that set_tracepoint is called by the void __tracepoint_register_##_provider##___##_name(\lttng-ust-2.4.0\include\lttng\tracepoint.h line 182).</div><div>But there is no function which invoke the function __tracepoint_register_##_provider##___##_name,so when is the function __tracepoint_register_##_provider##___##_name is called?</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-18 19:55 GMT+08:00 Zifei Tong <span dir="ltr"><<a href="mailto:zifeitong@gmail.com" target="_blank">zifeitong@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
Please check the set_tracepoint() function in liblttng-ust/tracepoint.c<br>
<br>
/*<br>
* Sets the probe callback corresponding to one tracepoint.<br>
*/<br>
static void set_tracepoint(struct tracepoint_entry **entry, struct<br>
tracepoint *elem, int active);<br>
<br>
I think probes are connected to tracepoints when user enable<br>
corresponding events.<br>
<br>
Hope that helps.<br>
<span class="HOEnZb"><font color="#888888"><br>
Zifei Tong<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Tue, Mar 18, 2014 at 5:08 PM, wen qun wang <<a href="mailto:xiaoxiao046@gmail.com">xiaoxiao046@gmail.com</a>> wrote:<br>
> Hi,everyone.At first ,thanks for jeremie's help. I have completed toolchain<br>
> to gain an understanding of how the different pieces fit together.Then, I'm<br>
> going to through the studying the demo(/lttng-ust-2.4.0/doc/examples/demo)<br>
> of lttng-ust to understand the working principle of lttng.But now,I am in<br>
> trouble.<br>
> In /lttng-ust-2.4.0/doc/examples/demo/demo.c<br>
><br>
> ##################<br>
> tracepoint(ust_test_demo2,done,42)<br>
> ###################<br>
><br>
> I found the definition of tracepoint in<br>
> /lttng-ust-2.4.0/include/lttng/tracepoint.h<br>
><br>
> ############################################################<br>
> #define tracepoint(provider, name, ...) \<br>
> do { \<br>
> STAP_PROBEV(provider, name, ## __VA_ARGS__); \<br>
> if (caa_unlikely(__tracepoint_##provider##___##name.state)) \<br>
> __tracepoint_cb_##provider##___##name(__VA_ARGS__); \<br>
> } while (0)<br>
> #################################################################<br>
><br>
> then i found the definition of<br>
> "__tracepoint_cb_##provider##___##name(__VA_ARGS__)" in<br>
> /lttng-ust-2.4.0/include/lttng/tracepoint.h line 158<br>
><br>
> ########################################################################<br>
> void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \<br>
> { \<br>
> struct tracepoint_probe *__tp_probe; \<br>
> \<br>
> if (caa_unlikely(!TP_RCU_LINK_TEST())) \<br>
> return; \<br>
> tp_rcu_read_lock_bp(); \<br>
> __tp_probe =<br>
> tp_rcu_dereference_bp(__tracepoint_##_provider##___##_name.probes); \<br>
> if (caa_unlikely(!__tp_probe)) \<br>
> goto end; \<br>
> do { \<br>
> void (*__tp_cb)(void) = __tp_probe->func; \<br>
> void *__tp_data = __tp_probe->data; \<br>
> \<br>
> URCU_FORCE_CAST(void (*)(_TP_ARGS_DATA_PROTO(__VA_ARGS__)), __tp_cb) \<br>
> (_TP_ARGS_DATA_VAR(__VA_ARGS__)); \<br>
> } while ((++__tp_probe)->func); \<br>
> end: \<br>
> tp_rcu_read_unlock_bp(); \<br>
> }<br>
> ####################################################################<br>
><br>
> It seems that "__tracepoint_##_provider##___##_name" in<br>
> "__tracepoint_##_provider##___##_name.probes" is a struct of tracepoint.<br>
> we can found the macro TRACEPOINT_EVENT was used in<br>
> "lttng-ust-2.4.0\doc\examples\demo\ust_tests_demo.h".And the struct of<br>
> tracepoint was defined by the macro TRACEPOINT_EVENT.But the<br>
> __tracepoint_##_provider##___##_name.probes was set to null.<br>
><br>
> #################################################<br>
> \lttng-ust-2.4.0\include\lttng\tracepoint.h line 342<br>
> #define _DEFINE_TRACEPOINT(_provider, _name, _args) \<br>
> extern int __tracepoint_provider_##_provider; \<br>
> static const char __tp_strtab_##_provider##___##_name[] \<br>
> __attribute__((section("__tracepoints_strings"))) = \<br>
> #_provider ":" #_name; \<br>
> struct tracepoint __tracepoint_##_provider##___##_name \<br>
> __attribute__((section("__tracepoints"))) = \<br>
> { \<br>
> __tp_strtab_##_provider##___##_name, \<br>
> 0, \<br>
> NULL, \---------------------------------------------->here is the probes.<br>
> _TRACEPOINT_UNDEFINED_REF(_provider), \<br>
> _TP_EXTRACT_STRING(_args), \<br>
> { }, \<br>
> }; \<br>
> static struct tracepoint * __tracepoint_ptr_##_provider##___##_name \<br>
> __attribute__((used, section("__tracepoints_ptrs"))) = \<br>
> &__tracepoint_##_provider##___##_name;<br>
> ###################################################################<br>
><br>
> so i want to know that how the probes of the tracepoint struct should be<br>
> initialized,I can't find the source code.<br>
> My english is poor,i hope you can understand what i mean. Thank you very<br>
> much.<br>
><br>
><br>
><br>
><br>
><br>
><br>
> 2014-03-15 9:24 GMT+08:00 ΪÍõ <<a href="mailto:xiaoxiao046@gmail.com">xiaoxiao046@gmail.com</a>>:<br>
>><br>
>> thank you very much<br>
>><br>
>><br>
>> 2014-03-15 1:35 GMT+08:00 J¨¦r¨¦mie Galarneau<br>
>> <<a href="mailto:jeremie.galarneau@efficios.com">jeremie.galarneau@efficios.com</a>>:<br>
>><br>
>>> On Wed, Mar 12, 2014 at 6:05 AM, ΪÍõ <<a href="mailto:xiaoxiao046@gmail.com">xiaoxiao046@gmail.com</a>> wrote:<br>
>>> > Hi All,I am a graduate student from Beijing University of Posts and<br>
>>> > Telecommunications. Due to my<br>
>>> > experience in windows kernel development and debugging technique,I am<br>
>>> > very<br>
>>> > interested in the lttng project.I want to make a contribution for the<br>
>>> > Clang<br>
>>> > plugin providing automatic application instrumentation after reading<br>
>>> > the<br>
>>> > project ideas for gsoc2014.I am also interested in reverse engineering<br>
>>> > and<br>
>>> > binary hack.<br>
>>> > The codes of lttng project have been downloaded for reading.Due to its<br>
>>> > large<br>
>>> > amount,i couldn't figure out a good way to understand it.So,i want to<br>
>>> > konw<br>
>>> > how should i proceed further.<br>
>>><br>
>>> You should start by trying the complete toolchain to gain an<br>
>>> understanding of how the different pieces fit together. I wouldn't<br>
>>> suggest simply jumping into the code.<br>
>>><br>
>>> Have a look at the guidelines posted on our GSoC 2014 wiki for more<br>
>>> information on how to submit a proposal [1].<br>
>>><br>
>>> Let us know if you have more specific questions.<br>
>>><br>
>>> J¨¦r¨¦mie<br>
>>><br>
>>> [1]<br>
>>> <a href="https://bugs.lttng.org/projects/lttng/wiki/Google_Summer_of_Code_2014#Guidelines-for-students-applying-to-GSoC" target="_blank">https://bugs.lttng.org/projects/lttng/wiki/Google_Summer_of_Code_2014#Guidelines-for-students-applying-to-GSoC</a><br>
>>><br>
>>> > My english is poor,i hope you can understand what i mean. Thank you<br>
>>> > very<br>
>>> > much.<br>
>>> ><br>
>>> > _______________________________________________<br>
>>> > lttng-dev mailing list<br>
>>> > <a href="mailto:lttng-dev@lists.lttng.org">lttng-dev@lists.lttng.org</a><br>
>>> > <a href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" target="_blank">http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a><br>
>>> ><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> J¨¦r¨¦mie Galarneau<br>
>>> EfficiOS Inc.<br>
>>> <a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a><br>
>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> lttng-dev mailing list<br>
> <a href="mailto:lttng-dev@lists.lttng.org">lttng-dev@lists.lttng.org</a><br>
> <a href="http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" target="_blank">http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a><br>
><br>
</div></div></blockquote></div><br></div>