[lttng-dev] Clang plugin providing automatic application instrumentation

wen qun wang xiaoxiao046 at gmail.com
Tue Mar 18 05:08:19 EDT 2014


Hi,everyone.At first ,thanks for jeremie's help. I have completed toolchain
to gain  an understanding of how the different pieces fit together.Then,
I'm going to through the studying the
demo(/lttng-ust-2.4.0/doc/examples/demo) of lttng-ust to understand the
working principle of lttng.But now,I am in trouble.
In /lttng-ust-2.4.0/doc/examples/demo/demo.c

##################
tracepoint(ust_test_demo2,done,42)
###################

I found the definition of tracepoint in
/lttng-ust-2.4.0/include/lttng/tracepoint.h

############################################################
#define tracepoint(provider, name, ...)    \
do {    \
STAP_PROBEV(provider, name, ## __VA_ARGS__);    \
if (caa_unlikely(__tracepoint_##provider##___##name.state)) \
__tracepoint_cb_##provider##___##name(__VA_ARGS__); \
} while (0)
#################################################################

then i found the definition of
"__tracepoint_cb_##provider##___##name(__VA_ARGS__)" in
/lttng-ust-2.4.0/include/lttng/tracepoint.h line 158

########################################################################
void __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \
{ \
struct tracepoint_probe *__tp_probe; \
\
if (caa_unlikely(!TP_RCU_LINK_TEST())) \
return; \
tp_rcu_read_lock_bp(); \
__tp_probe =
tp_rcu_dereference_bp(__tracepoint_##_provider##___##_name.probes); \
if (caa_unlikely(!__tp_probe)) \
goto end; \
do { \
void (*__tp_cb)(void) = __tp_probe->func; \
void *__tp_data = __tp_probe->data; \
\
URCU_FORCE_CAST(void (*)(_TP_ARGS_DATA_PROTO(__VA_ARGS__)), __tp_cb) \
(_TP_ARGS_DATA_VAR(__VA_ARGS__)); \
} while ((++__tp_probe)->func); \
end: \
tp_rcu_read_unlock_bp(); \
}
####################################################################

It seems that "__tracepoint_##_provider##___##_name"  in  "
__tracepoint_##_provider##___##_name.probes" is a struct of tracepoint.
we can found the macro TRACEPOINT_EVENT was used in
"lttng-ust-2.4.0\doc\examples\demo\ust_tests_demo.h".And the struct of
tracepoint was defined by the macro TRACEPOINT_EVENT.But the
__tracepoint_##_provider##___##_name.probes
was set to null.

#################################################
\lttng-ust-2.4.0\include\lttng\tracepoint.h
line 342
#define _DEFINE_TRACEPOINT(_provider, _name, _args) \
extern int __tracepoint_provider_##_provider; \
static const char __tp_strtab_##_provider##___##_name[] \
__attribute__((section("__tracepoints_strings"))) = \
#_provider ":" #_name; \
struct tracepoint __tracepoint_##_provider##___##_name \
__attribute__((section("__tracepoints"))) = \
{ \
__tp_strtab_##_provider##___##_name, \
0, \
NULL, \---------------------------------------------->here is the probes.
_TRACEPOINT_UNDEFINED_REF(_provider), \
_TP_EXTRACT_STRING(_args), \
{ }, \
}; \
static struct tracepoint * __tracepoint_ptr_##_provider##___##_name \
__attribute__((used, section("__tracepoints_ptrs"))) = \
&__tracepoint_##_provider##___##_name;
###################################################################

so i want to know that how the probes of the tracepoint struct  should be
initialized,I can't find the source code.
My english is poor,i hope you can understand what i mean. Thank you very
much.






2014-03-15 9:24 GMT+08:00 为王 <xiaoxiao046 at gmail.com>:

> thank you very much
>
>
> 2014-03-15 1:35 GMT+08:00 Jérémie Galarneau <
> jeremie.galarneau at efficios.com>:
>
> On Wed, Mar 12, 2014 at 6:05 AM, 为王 <xiaoxiao046 at gmail.com> wrote:
>> > Hi All,I am a graduate student from Beijing University of Posts and
>> > Telecommunications. Due to my
>> > experience in windows kernel development and debugging technique,I am
>> very
>> > interested in the lttng project.I want to make a contribution for the
>> Clang
>> > plugin providing automatic application instrumentation after reading the
>> > project ideas for gsoc2014.I am also interested in reverse engineering
>> and
>> > binary hack.
>> > The codes of lttng project have been downloaded for reading.Due to its
>> large
>> > amount,i couldn't figure out a good way to understand it.So,i want to
>> konw
>> > how should i proceed further.
>>
>> You should start by trying the complete toolchain to gain an
>> understanding of how the different pieces fit together. I wouldn't
>> suggest simply jumping into the code.
>>
>> Have a look at the guidelines posted on our GSoC 2014 wiki for more
>> information on how to submit a proposal [1].
>>
>> Let us know if you have more specific questions.
>>
>> Jérémie
>>
>> [1]
>> https://bugs.lttng.org/projects/lttng/wiki/Google_Summer_of_Code_2014#Guidelines-for-students-applying-to-GSoC
>>
>> > My english is poor,i hope you can understand what i mean. Thank you very
>> > much.
>> >
>> > _______________________________________________
>> > lttng-dev mailing list
>> > lttng-dev at lists.lttng.org
>> > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>> >
>>
>>
>>
>> --
>> Jérémie Galarneau
>> EfficiOS Inc.
>> http://www.efficios.com
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20140318/81f882ef/attachment-0001.html>


More information about the lttng-dev mailing list