Zifei Tong [Thu, 30 May 2013 14:11:52 +0000 (10:11 -0400)]
Allow tracepoint providers to be compiled 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.
Relevant discussion:
> So each field need to be listed ? We usually don't put NULL
> initialization for structures that are always in zero-initialized
> memory. (coding style)
This is related to a known issue of g++:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55606 (Bug 55606 - sorry,
unimplemented: non-trivial designated initializers not supported).
g++'s 'trivial designated initializers' means no out-of-order
initialization, no missing
initialization (except the fields on the tail of a struct), and nested
initialization should be done in the form {.foo = {.bar = 1}} instead of
{.foo.bar = 1}. That's why I made such modification.
> Are those changes also compatible with the LLVM c++ compiler ?
Actually, clang++ have designated initializers better supported than g++.
All the modification about designated initializers are not required for
clang++. No need to add NULL initialization, reorder initializations or
change {.foo.bar = 1} into {.foo = {.bar = 1}}. These (ugly) hacks are just
to make g++ happy.
[ Updates done by Mathieu Desnoyers to fix merge conflicts. Updated
README. ]
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.
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.
* 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>
Move "hello-static-lib" to doc/examples and add non-automake Makefiles
The examples are now automatically built as part of the default make
target and plain Makefiles with no dependency on automake are provided
for clarity.
Update the manpage and README to reflect the change and remove lots of
trailing whitespace.
There is not much we can do for this compatibility bug in lttng-ust 2.0
and 2.1 (already stable). Adding this check so that starting with
lttng-ust 2.2, when liblttng-ust encounters a probe provider with a
provider version major number higher than it supports, it will reject
it.
Timer management is not called under ust_lock(). It is only called from
the consumer. Add internal locking for timer start/stop and
synchronization management.
In file included from ../include/lttng/ust-tracepoint-event.h:357,
from ../include/lttng/tracepoint-event.h:62,
from lttng-ust-cyg-profile.h:63,
from lttng-ust-cyg-profile.c:27:
././lttng-ust-cyg-profile.h: In function ‘__event_prepare_filter_stack__lttng_ust_cyg_profile___func_entry’:
././lttng-ust-cyg-profile.h:35: warning: cast from pointer to integer of different size
././lttng-ust-cyg-profile.h:35: warning: cast from pointer to integer of different size
././lttng-ust-cyg-profile.h:35: warning: cast from pointer to integer of different size
././lttng-ust-cyg-profile.h:35: warning: cast from pointer to integer of different size
././lttng-ust-cyg-profile.h: In function ‘__event_prepare_filter_stack__lttng_ust_cyg_profile___func_exit’:
././lttng-ust-cyg-profile.h:46: warning: cast from pointer to integer of different size
././lttng-ust-cyg-profile.h:46: warning: cast from pointer to integer of different size
././lttng-ust-cyg-profile.h:46: warning: cast from pointer to integer of different size
././lttng-ust-cyg-profile.h:46: warning: cast from pointer to integer of different size
CCLD liblttng-ust-cyg-profile.la
CC lttng-ust-cyg-profile-fast.lo
In file included from ../include/lttng/ust-tracepoint-event.h:357,
from ../include/lttng/tracepoint-event.h:62,
from lttng-ust-cyg-profile-fast.h:59,
from lttng-ust-cyg-profile-fast.c:27:
././lttng-ust-cyg-profile-fast.h: In function ‘__event_prepare_filter_stack__lttng_ust_cyg_profile_fast___func_entry’:
././lttng-ust-cyg-profile-fast.h:35: warning: cast from pointer to integer of different size
././lttng-ust-cyg-profile-fast.h:35: warning: cast from pointer to integer of different size
Optimisation: implement callsite hash table in tracepoint.c
Instead of iterating on every tracepoint callsite each time a probe is
registered/unregistered, use a hash table of callsites to only update
tracepoint sites matching the probe name.
Fix: tracepoint instrumentation constructor order issue
If the linker decides to run a constructor from a tracepoint probe
before the constructor from the application, a recent modification
(commit 558b9d86247004f8e9bbaf8c982f3b2b182093d1) allowed that the wrong
constructor execution order could prohibit the program's tracepoints
from being registered.
Paul Woegerer [Wed, 27 Mar 2013 14:16:26 +0000 (10:16 -0400)]
Fix: forwarding of call_site argument to field
I ran some tests with the new function entry/exit instrumentations.
The tracepoint provider for lttng_ust_cyg_profile:func_entry and
func_exit does not properly forward the call_site argument to the
call_site field. The patch below fixes the problem.
Removal of disabled tests. Fixes ./configure failing
in distribution package because by missing Makefiles
in tests/ust-basic-tracing and tests/ust-multi-test.
The "fast" .so (liblttng-ust-cyg-profile-fast.so) is for use-cases where
we expect a complete event stream to be recorded, so we can skip
duplicate information.
The verbose .so (liblttng-ust-cyg-profile.so) is for use-cases where
events discarded are expected, and the trace analyzer needs extra
information to be able to reconstruct the program flow.
Previously, we were seeing only 8 events (number of events written in a
single stream), but now we see 16 events (each event is dispatched into
two streams).
ustctl.c: In function 'ustctl_init':
ustctl.c:1772:2: warning: implicit declaration of function
'lttng_ring_buffer_client_overwrite_rt_init'
[-Wimplicit-function-declaration]
ustctl.c:1774:2: warning: implicit declaration of function
'lttng_ring_buffer_client_discard_rt_init'
[-Wimplicit-function-declaration]
ustctl.c: In function 'ustctl_exit':
ustctl.c:1781:2: warning: implicit declaration of function
'lttng_ring_buffer_client_discard_rt_exit'
[-Wimplicit-function-declaration]
ustctl.c:1783:2: warning: implicit declaration of function
'lttng_ring_buffer_client_overwrite_rt_exit'
[-Wimplicit-function-declaration]
Add channel wakeup fd, so consumer can keep its handle on the stream
wakeup_fd (for periodic timer flush), and yet still discover that an
application has closed a channel or exited.
Requires to be updated in locked-step with lttng-tools
"Add channel wakeup fd to monitor close"