Fix: incorrect support for multi-context

* Zifei Tong <soariez@gmail.com> wrote:
> I did some debugging one this issue. The problem only occurs when we
> have more than one context field.
> So this will not work, too:
>
> lttng create
> lttng enable-event -a -u
> lttng add-context -u -t vpid
> lttng add-context -u -t vtid
> lttng start
> $@
> lttng stop
> sleep 1
> lttng view
> lttng destroy
>
> The problem I found out is wrong `fields` argument passed into
> `ustcomm_register_channel`.
> The `fields` argument passed is a pointer to the `event_field` of the
> first element in a `lttng_ctx_field` array, but not a
> `lttng_event_field` array as expected.

Fixes #529

Reported-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Revert "Fix (another) linker library order"

This reverts commit a51ac6d9a011ba10b0be396dc1e801b2fc829651.

Hrm, actually, these patches are wrong.

commit 725e63c5194bfdcde0a2a3507aca156ba36cf49f for instance:

"Libraries must be specified after the binary target."

 demo: demo.o
-       $(CC) -o $@ $(LIBS) $^
+       $(CC) -o $@ $^ $(LIBS)

the binary target here is "$@".

$^ is the source file name (demo.c).

this patch moves the source file name prior to the libraries, which is
incorrect (ref: gcc(1)). The input files should appear last.

So it breaks builds where $(LIBS) is non-empty.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Revert "Fix linker library order"

This reverts commit 725e63c5194bfdcde0a2a3507aca156ba36cf49f.

Hrm, actually, these patches are wrong.

commit 725e63c5194bfdcde0a2a3507aca156ba36cf49f for instance:

"Libraries must be specified after the binary target."

 demo: demo.o
-       $(CC) -o $@ $(LIBS) $^
+       $(CC) -o $@ $^ $(LIBS)

the binary target here is "$@".

$^ is the source file name (demo.c).

this patch moves the source file name prior to the libraries, which is
incorrect (ref: gcc(1)). The input files should appear last.

So it breaks builds where $(LIBS) is non-empty.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: memory leak on connection reset

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: memory leak for events without fields

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: "fields" leak on register

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tracepoint.c: Add coverity alloc/free annotations

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
snprintf: play nice with static checker

Coverity complains that we pass a singleton as an array. Transform it
into an array of size 1.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Revert "Revert "Fix linker library order""

This reverts commit 661805af83e2d4e7fa19432d6ae553460d6cd524.

The patch was OK in the first place. Explanation:

* Simon Marchi <simon.marchi@polymtl.ca> wrote:

Actually, $^ here is "demo.o", not "demo. Also, the libs should appear
after the objects on the command line. See the "-l" section in
http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html. On most setup
this doesn't matter, since -Wl,--no-as-needed was the default pretty
much everywhere. Ubuntu decided to use -Wl,--as-needed to avoid
unnecessary dependencies, so the order becomes important. If you try
to manual build on a recent Ubuntu you will get undefined references
to dlopen and such. So this patch is good.

If you read carefully the log sent by Alexandre, you see that it is
when building the shared libs in this directory
(lttng-ust-provider-ust-tests-demo.so) that the build fails. I don't
know why it fails, but Alexandre hinted that passing "-fPIE -pie" to
build a shared library is weird (it is usually -fPIC -pic). I am not
sure where that comes from. This behaviour only happens when building
the package, not when building manually.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Revert "Revert "Fix (another) linker library order""

This reverts commit a5b31eab4e1f190d68d51c47dabb60b64ee471e7.

The patch was OK in the first place. Explanation:

* Simon Marchi <simon.marchi@polymtl.ca> wrote:

Actually, $^ here is "demo.o", not "demo. Also, the libs should appear
after the objects on the command line. See the "-l" section in
http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html. On most setup
this doesn't matter, since -Wl,--no-as-needed was the default pretty
much everywhere. Ubuntu decided to use -Wl,--as-needed to avoid
unnecessary dependencies, so the order becomes important. If you try
to manual build on a recent Ubuntu you will get undefined references
to dlopen and such. So this patch is good.

If you read carefully the log sent by Alexandre, you see that it is
when building the shared libs in this directory
(lttng-ust-provider-ust-tests-demo.so) that the build fails. I don't
know why it fails, but Alexandre hinted that passing "-fPIE -pie" to
build a shared library is weird (it is usually -fPIC -pic). I am not
sure where that comes from. This behaviour only happens when building
the package, not when building manually.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add warning about default prefix and library paths to README

Fixes #467

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Remove 0.x TODO

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: missing dependency for liblttng-ust-tracepoint.so

Fixes #538

Reported-by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add parameter -f to rm in Makefile clean target

If the files we want to delete do not exist (for example after a failed
build), the make clean fails.

Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: make hello.cxx compile with g++

Move enumeration definition out of lttng_ust_lib_ring_buffer_config to
make them visible at global scope for C++ compilers.

Modify designated initializers: reordering initializers, add missing
initializers, reformat nested initializers, in order to make g++ compile.

Fixes #338

Signed-off-by: Zifei Tong <soariez@gmail.com>