[lttng-dev] Need Help In trace generation for malloc(), free() calls etc

Jonathan Rajotte-Julien jonathan.rajotte-julien at efficios.com
Wed May 13 11:33:12 EDT 2020


Hi Abhinav,

Please refrain from using screenshots when pastebin could be used (code,
commands, etc).

On Wed, May 13, 2020 at 10:29:22AM +0530, Abhinav Ranjan via lttng-dev wrote:
>   Hello Sir,
> I am Abhinav from India.
> *Kindly Ignore the previous email.*
> Actually I am very new to the Embedded System Engineering profession. In
> fact I have been asked to do an independent project to instrumenting a c
> application using  LLTng concept to find/trace calls to malloc(), free()
> calls. In fact i tried capturing the same as below steps but didn't
> understand why after using LD_PRELOAD also malloc() and free() calls were
> not traced. I am not sure whether my app was correct!!
> 
>  I followed the steps provided to create executable using -lltng-ust -ldl
> 2.I executed it as: LD_PRELOAD=liblttng-ust-libc-wrapper.so ./executable
> (initially as ./exe arg))
> 3. Then I followed commands to create , capture the events. and destroyed
> it.

Based on the screenshot "creation_trace.PNG", it seems that you enable only the
event you defined (malloc_trace_investigation). Keep in mind that the libc
wrapper defines its own tracepoints and tracepoint providers.

It the case of the libc wrapper the tracepoint providers available are:
lttng_ust_libc and lttng_ust_pthread

Both have multiple tracepoints defined under them.

Hence what you want for you experiment is something like this:

    lttng enable-event -u malloc_trace:investigation
    lttng enable-event -u 'lttng_ust_libc:*'

Keep in mind that you can list the events available for a currently running app
using:

   lttng list -u


The app must be running for the listing work.

Cheers.


More information about the lttng-dev mailing list