[lttng-dev] I'm still getting empty ust traces using tracef

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Jun 21 16:21:51 EDT 2023


On 6/20/23 18:02, Brian Hutchinson wrote:
> On Thu, May 11, 2023 at 2:14 PM Mathieu Desnoyers
> <mathieu.desnoyers at efficios.com> wrote:
>>
>> On 2023-05-11 14:13, Mathieu Desnoyers via lttng-dev wrote:
>>> On 2023-05-11 12:36, Brian Hutchinson via lttng-dev wrote:
>>>> ... more background.  I've always used ltt in the kernel so I don't
>>>> have much experience with the user side of it and especially
>>>> multi-threaded, multi-core so I'm probably missing some fundamental
>>>> concepts that I need to understand.
>>>
>>> Which are the exact versions of LTTng-UST and LTTng-Tools you are using
>>> now ? (2.13.N or which git commit ?)
>>>
>>
>> Also, can you try using lttng-ust stable-2.13 branch, which includes the following commit ?
>>
>> commit be2ca8b563bab81be15cbce7b9f52422369f79f7
>> Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
>> Date:   Tue Feb 21 14:29:49 2023 -0500
>>
>>       Fix: Reevaluate LTTNG_UST_TRACEPOINT_DEFINE each time tracepoint.h is included
>>
>>       Fix issues with missing symbols in use-cases where tracef.h is included
>>       before defining LTTNG_UST_TRACEPOINT_DEFINE, e.g.:
>>
>>        #include <lttng/tracef.h>
>>        #define LTTNG_UST_TRACEPOINT_DEFINE
>>        #include <provider.h>
>>
>>       It is caused by the fact that tracef.h includes tracepoint.h in a
>>       context which has LTTNG_UST_TRACEPOINT_DEFINE undefined, and this is not
>>       re-evaluated for the following includes.
>>
>>       Fix this by lifting the definition code in tracepoint.h outside of the
>>       header include guards, and #undef the old LTTNG_UST__DEFINE_TRACEPOINT
>>       before re-defining it to its new semantic. Use a new
>>       _LTTNG_UST_TRACEPOINT_DEFINE_ONCE include guard within the
>>       LTTNG_UST_TRACEPOINT_DEFINE defined case to ensure symbols are not
>>       duplicated.
>>
>>       Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
>>       Change-Id: I0ef720435003a7ca0bfcf29d7bf27866c5ff8678
>>
> 
> I applied this patch and if I use "tracef" type calls in our
> application that is made up of a bunch of static libs ... the UST
> trace calls work.  I verified that traces that were called from
> several different static libs all worked.
> 
> But as soon as I include a "tracepoint" style tracepoint (that uses
> trace provider include files etc.) then doing a "lttng list -u"
> returns "None" for UST events.
> 
> Is there some kind of rule that says a file can't use both tracef and
> tracepoint calls?  Is there something special you have to do to use
> tracef and tracepoints in same file?  Doing so appears to have broken
> everything.

It should just work.

Can you provide a minimal example of the compile unit having this
issue ?

Also you mention "static libs". Make sure you do *not* define 
"LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE" in this case. See the 
lttng-ust(3) man page for details (section "Statically linking the 
tracepoint provider").

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com



More information about the lttng-dev mailing list