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

Philippe Proulx eeppeliteloop at gmail.com
Mon Aug 10 15:52:08 EDT 2015


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
>



More information about the lttng-dev mailing list