[lttng-dev] Addition of the return address to liblttng-ust-libc-wrapper
Simon Marchi
simon.marchi at polymtl.ca
Fri Jan 16 15:32:56 EST 2015
On 16 January 2015 at 15:13, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
>
> ________________________________
>
> From: "Olivier Delbeke" <Olivier.Delbeke at awtce.be>
> To: lttng-dev at lists.lttng.org
> Sent: Tuesday, January 13, 2015 10:50:38 AM
> Subject: [lttng-dev] Addition of the return address to liblttng-ust-libc-wrapper
>
> Hi guys,
>
>
> I am using liblttng-ust-libc-wrapper to detect memory leaks in my applications.
> In order to identify not only the thread where the unfreed allocations are done, but also the calling function, I extended the liblttng-ust-libc-wrapper to log the "return address" (__builtin_return_address(0)) in addition to the parameters of malloc(). It solves my problem and does not affect Trace Compass.
> Was this the right thing to do ?
>
>
> You should be able to achieve the same thing with the "ip" context, e.g.:
>
> lttng create
> lttng enable-event -u -a
> lttng add-context -u -t ip
> lttng start
> ....
>
> All this dynamically without changing the instrumentation.
>
> Thanks,
>
> Mathieu
I might be wrong, but from what I understand, Olivier's patch recorded
the address of the caller of malloc. Adding the ip context will record
the ip of the location of the tracepoint macro call, which will always
be the same (an address in liblttng-ust-malloc's malloc).
Simon
More information about the lttng-dev
mailing list