[lttng-dev] [PATCH 1/2] Base-address tracing for dlopen and dlclose

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Nov 13 08:51:30 EST 2013



----- Original Message -----
> From: "Paul Woegerer" <Paul_Woegerer at mentor.com>
> To: "Mathieu Desnoyers" <mathieu.desnoyers at efficios.com>
> Cc: lttng-dev at lists.lttng.org
> Sent: Wednesday, November 13, 2013 8:46:56 AM
> Subject: Re: [PATCH 1/2] Base-address tracing for dlopen and dlclose
> 
> Hi Mathieu,
> 
> Thanks for the review.
> Comments see below:
> 
> On 11/13/2013 02:25 PM, Mathieu Desnoyers wrote:
> > ----- Original Message -----
> >> Provide an LD_PRELOAD library to allow tracing of calls to dlopen and
> >> dlclose.  Tracing the lttng-ust internal use of dlopen and dlclose is
> >> prevented.
> > Why do we need to prevent tracing lttng-ust internal use of dlopen/dlclose
> > ?
> 
> I assumed this would be beneficial to have (less noise in  the trace
> data). But if you don't like that we can also leave it out. You will see
> lots of
> 
> ust_baddr:push: { cpu_id = X }, { baddr = 0xXXXXXXXX, sopath =
> "/.../liblttng-ust-tracepoint.so.0.0.0", size = A, mtime = B }
> 
> events in the trace though (I attached a sample to demonstrate this).

I try not to hide anything from the users. If the viewer cares about this, they can always filter out when they read the traces.

Moreover, I'd really like not to modify tracepoint.h if possible for instrumentation ABI compatibility reasons.

> 
> >> +void *dlopen(const char *filename, int flag)
> >> +{
> >> +	void *handle = _lttng_ust_dl_libc_dlopen(filename, flag);
> >> +	if (handle) {
> >> +		struct link_map *p = NULL;
> >> +		if (dlinfo(handle, RTLD_DI_LINKMAP, &p) != -1 && p != NULL
> >> +			&& p->l_addr != 0)
> > Maybe add one extra tab above for readability.
> 
> No problem. I can do that.
> 
> Do you want me to resend the patch without lttng_ust_dlopen/close handling ?

Yes, please,

Thanks!

Mathieu

> 
> --
> Paul
> 
> > Same here.
> >
> > Thanks,
> >
> > Mathieu
> >
> >> +			lttng_ust_baddr_pop((void *) p->l_addr);
> >> +	}
> >> +	return _lttng_ust_dl_libc_dlclose(handle);
> >> +}
> >> +
> >> +static void __attribute__((destructor))
> >> +lttng_ust_baddr_handle_fini(void);
> >> +static void
> >> +lttng_ust_baddr_handle_fini(void)
> >> +{
> >> +	if (__lttng_ust_baddr_handle) {
> >> +		int ret = _lttng_ust_dl_libc_dlclose(__lttng_ust_baddr_handle);
> >> +		if (ret)
> >> +			fprintf(stderr, "%s\n", dlerror());
> >> +	}
> >> +}
> >> --
> >> 1.8.4.2
> >>
> >>
> 
> 
> --
> Paul Woegerer, SW Development Engineer
> Sourcery Analyzer <http://go.mentor.com/sourceryanalyzer>
> Mentor Graphics, Embedded Software Division
> 
> 

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



More information about the lttng-dev mailing list