[lttng-dev] Addition of the return address to liblttng-ust-libc-wrapper

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Fri Jan 16 15:37:29 EST 2015


----- Original Message -----
> From: "Simon Marchi" <simon.marchi at polymtl.ca>
> To: "Mathieu Desnoyers" <mathieu.desnoyers at efficios.com>
> Cc: "Olivier Delbeke" <Olivier.Delbeke at awtce.be>, lttng-dev at lists.lttng.org
> Sent: Friday, January 16, 2015 3:32:56 PM
> Subject: Re: [lttng-dev] Addition of the return address to liblttng-ust-libc-wrapper
> 
> 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).
> 

Good point! In that case, adding the caller address as tracepoint parameter
could make sense indeed. Another approach would be to implement a full stack
dump as a context.

Thanks,

Mathieu

> Simon
> 

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



More information about the lttng-dev mailing list