[lttng-dev] Using LLTNG within shared library (not dlopen-ed).

Sergei Dyshel qyron.private at gmail.com
Mon Aug 10 16:18:44 EDT 2015


Hi Phillipe,

Thank you for quick answer! I studied that thread but I see that it refers
to well-known "dlclose" problem: trace provider as part of dlclose-ed .so
is unloaded before lttng-ust is unloaded which leads to segfault.

But in my case both .so containing tracepoints (and trace provider) and
lttng-ust are linked to application at link-time. So both are supposed load
before application starts and unload after it ends.

Also, it would be very inconvenient for me to put trace provider into
separate ".so" for some reasons.


-- 
Regards,
Sergei Dyshel

On Mon, Aug 10, 2015 at 10:52 PM, Philippe Proulx <eeppeliteloop at gmail.com>
wrote:

> On Mon, Aug 10, 2015 at 1:27 PM, Sergei Dyshel <qyron.private at gmail.com>
> wrote:
> > Hi all,
> >
> > I have some code using traces compiled as shared object (together with
> trace
> > provider).
> > This ".so" is linked to main code during compile-time.
> > When I run main application and try to read traces after that I get
> errors
> > about corrupted trace file.
> >
> > I've read docs about dynamical linking of trace provider which recommends
> > compiling trace provider into separate .so and using LD_PRELOAD to
> preload
> > it. But that is only needed for shared objects loaded with "dlopen". In
> my
> > case "dlclose" isn't called and shared object is unloaded on the exit
> (i.e.
> > after all traces produced).
> >
> > So this shouldn't be a problem... Am I right?
>
> Hello there,
>
> See if this thread helps:
> <http://lists.lttng.org/pipermail/lttng-dev/2014-December/023953.html>.
>
> I'm not the author of LTTng-UST and I do not have a comprehensive
> understanding
> of its inner mechanics, but I believe that it's good practice to always use
> LD_PRELOAD with a tracepoint provider that is not statically linked with
> the
> application.
>
> Phil
>
> > --
> > Regards,
> > Sergei Dyshel
> >
> > _______________________________________________
> > lttng-dev mailing list
> > lttng-dev at lists.lttng.org
> > http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20150810/c8dab351/attachment.html>


More information about the lttng-dev mailing list