lttng-ust.git
9 years agoFix: perform volatile load of tracepoint state
Mathieu Desnoyers [Mon, 22 Jun 2015 14:30:02 +0000 (10:30 -0400)] 
Fix: perform volatile load of tracepoint state

Because tracepoint state is updated by lttng-ust threads, and read by
application threads, we need to perform a volatile load of that state.

Not having the volatile load can cause the compiler to optimize away the
reload of that state, keeping a local copy instead. For instance, a main
program consisting of a loop could keep the tracepoint state on its
stack or in registers without ever reloading it from memory.

Perform a volatile load (CMM_LOAD_SHARED()) of the tracepoint state.
Add the matching volatile store (CMM_STORE_SHARED()) in tracepoint.c for
the state update.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd demo-tracelog to gitignore file
Mathieu Desnoyers [Thu, 18 Jun 2015 18:42:56 +0000 (14:42 -0400)] 
Add demo-tracelog to gitignore file

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd aarch64 support to configure
Michael Jeanson [Thu, 18 Jun 2015 14:41:55 +0000 (10:41 -0400)] 
Add aarch64 support to configure

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoImplement cpu_id context for filtering
Mathieu Desnoyers [Sat, 13 Jun 2015 09:27:07 +0000 (11:27 +0200)] 
Implement cpu_id context for filtering

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoust cyg-profile: use same class for entry and exit
Mathieu Desnoyers [Wed, 10 Jun 2015 11:32:30 +0000 (13:32 +0200)] 
ust cyg-profile: use same class for entry and exit

Share same serialization functions for entry and exit events.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: function instrumentation ip context
Mathieu Desnoyers [Wed, 10 Jun 2015 11:27:18 +0000 (13:27 +0200)] 
Fix: function instrumentation ip context

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: liblttng-ust-dl ip context
Mathieu Desnoyers [Wed, 10 Jun 2015 11:20:31 +0000 (13:20 +0200)] 
Fix: liblttng-ust-dl ip context

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoRemove caller field from malloc events
Mathieu Desnoyers [Wed, 10 Jun 2015 11:17:33 +0000 (13:17 +0200)] 
Remove caller field from malloc events

This duplicates info now available in the "ip" context.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: pthread wrapper ip context
Mathieu Desnoyers [Wed, 10 Jun 2015 11:15:28 +0000 (13:15 +0200)] 
Fix: pthread wrapper ip context

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: lttng-ust-malloc ip context
Mathieu Desnoyers [Wed, 10 Jun 2015 11:15:09 +0000 (13:15 +0200)] 
Fix: lttng-ust-malloc ip context

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAllow TP_IP_PARAM arg name to be configured
Mathieu Desnoyers [Wed, 10 Jun 2015 11:14:08 +0000 (13:14 +0200)] 
Allow TP_IP_PARAM arg name to be configured

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agotracelog: use same class for all loglevels
Mathieu Desnoyers [Wed, 10 Jun 2015 06:54:37 +0000 (08:54 +0200)] 
tracelog: use same class for all loglevels

Each loglevel can be serialized by the exact same serialization
function. Therefore, use a single tracepoint class for all those.

This diminishes the code size of the probe, and therefore its impact on
the instruction cache.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agofix tracelog namespacing of loglevels
Mathieu Desnoyers [Tue, 9 Jun 2015 14:38:21 +0000 (16:38 +0200)] 
fix tracelog namespacing of loglevels

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd tracelog documentation to lttng-ust(3)
Mathieu Desnoyers [Tue, 9 Jun 2015 14:21:00 +0000 (16:21 +0200)] 
Add tracelog documentation to lttng-ust(3)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoImplement demo-tracelog example
Mathieu Desnoyers [Tue, 9 Jun 2015 13:55:07 +0000 (15:55 +0200)] 
Implement demo-tracelog example

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoImplement tracelog API
Mathieu Desnoyers [Tue, 9 Jun 2015 11:56:47 +0000 (13:56 +0200)] 
Implement tracelog API

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: fetch caller address from tracef()
Mathieu Desnoyers [Tue, 9 Jun 2015 09:51:06 +0000 (11:51 +0200)] 
Fix: fetch caller address from tracef()

Don't fetch the address within the ust trampoline, but rather the caller
address.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoRename helper providers and events for consistency
Antoine Busque [Mon, 25 May 2015 23:17:09 +0000 (19:17 -0400)] 
Rename helper providers and events for consistency

This patch renders uniform the provider names of UST helpers by making
them all start with the "lttng_ust_" prefix. Also, the helper formerly
known as "ust_baddr" is now "lttng_ust_dl", and its "push" and "pop"
events are now "dlopen" and "dlclose", respectively. This is in line
with the other helpers, for which the name of the provider reflects
the name of the library, and the names of events correspond to those
of the traced functions.

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoRefactor state dump system
Antoine Busque [Mon, 25 May 2015 23:12:30 +0000 (19:12 -0400)] 
Refactor state dump system

This patch refactors the state dump system. The state dump provider is
now "lttng_ust_statedump". Each process' state dump is now delimited
by a pair of "start" and "end" events. These events mark the beginning
and end of the state dump, which happens once per traced application
per session. Note that for a given (process, session) pair, begin/end
events are serialized and will match. However, in a session, state
dumps from different processes may be interleaved. The vpid context
should be used to identify which events belong to which process.

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoRefactor Python agent
Philippe Proulx [Wed, 1 Apr 2015 00:09:54 +0000 (20:09 -0400)] 
Refactor Python agent

This patch refactors the whole LTTng-UST Python agent.
Notorious changes are:

  * Python module "lttng_agent" moved to Python package
    "lttngust". This removes "agent" from the name, which
    really is an implementation detail. "lttngust" is used
    because "lttng" would clash with LTTng-tools Python
    bindings.
  * Python package instead of simple module. Splitting the
    code in various modules will make future development
    easier.
  * Use daemon threads to make sure logging with tracing
    support is available as long as the regular threads live,
    while making sure that the application exits instantly when
    its regular threads die.
  * Create client threads and register to session daemons
    at import time. This allows the package to be usable just
    by importing it (no need to instanciate any specific class
    or call any specific function).
  * Do not use a semaphore + sleep to synchronize client threads
    with the importing thread: use a blocking synchronized
    queue with appropriate timeouts.
  * Add debug statements at strategic locations, enabled by
    setting the $LTTNG_UST_PYTHON_DEBUG environment variable
    to 1 before importing the package.
  * Override the default session daemon registration timeout
    with $LTTNG_UST_PYTHON_REGISTER_TIMEOUT (ms).
  * Override the default session daemon registration retry
    delay with $LTTNG_UST_PYTHON_REGISTER_RETRY_DELAY (ms).
  * Honor $LTTNG_HOME (to retrieve session daemon TCP ports).
  * Do not use an absolute path when loading the tracepoint
    provider shared object. Users should use the
    $LD_LIBRARY_PATH environment variable to override the
    default library path when running Python instead.
  * Do not keep an event dictionary since this brings issues
    when enabling/disabling events with the same name in
    different sessions.
  * Make sure the reference count does not go below 0,
    which could happen when destroying a session which contains
    events that are disabled already.
  * Minor improvements to make the code more Pythonic.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: building probe providers with C++ compiler
Mathieu Desnoyers [Thu, 7 May 2015 17:25:04 +0000 (13:25 -0400)] 
Fix: building probe providers with C++ compiler

Robert Daniels wrote:
> > I'm attempting to use lttng userspace tracing with a C++ application
> > on an ARM platform. I'm using GCC 4.8.4 on Linux 3.14 with the 2.6
> > release of lttng. I've compiled lttng-modules, lttng-ust, and
> > lttng-tools and have been able to get a simple test working with C
> > code.  When I attempt to run the hello.cxx test on my target it will
> > segfault.
>
>
> I spent a little time digging into this issue and finally discovered the
> cause of my segfault with ARM C++ tracepoints.
>
> There is a struct called 'lttng_event' in ust-events.h which contains an
> empty union 'u'.  This was the cause of my issue.  Under C, this empty union
> compiles to a zero byte member while under C++ it compiles to a one byte
> member, and in my case was four-byte aligned which caused my C++ code to
> have the 'cds_list_head node' offset incorrectly by four bytes.  This lead
> to an incorrect linked list structure which caused my issue.
>
> Since this union is empty, I simply removed it from the struct and everything
> worked correctly.
>
> I don't know the history or purpose behind this empty union so I'd like to
> know if this is a safe fix.  If it is I can submit a patch with the union
> removed.

That's a very nice catch!

We do not support building tracepoint probe provider with
g++ yet, as stated in lttng-ust(3):

"- Note for C++ support: although an application instrumented with
   tracepoints can be compiled with g++, tracepoint probes should be
   compiled with gcc (only tested with gcc so far)."

However, if it works fine with this fix, then I'm tempted to take it,
especially because removing the empty union does not appear to affect
the layout of struct lttng_event as seen from liblttng-ust, which must
be compiled with a C compiler,  and from probe providers compiled with
a C compiler. So all we are changing is the layout of a probe provider
compiled with a C++ compiler, which is anyway buggy at the moment,
because it is not compatible with the layout expected by liblttng-ust
compiled with a C compiler.

Reported-by: Robert Daniels <robert.daniels@vantagecontrols.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: use lttng_secure_getenv to handle env. vars. involving paths
Mathieu Desnoyers [Thu, 23 Apr 2015 22:45:05 +0000 (18:45 -0400)] 
Fix: use lttng_secure_getenv to handle env. vars. involving paths

This is a security fix for applications linked against liblttng-ust
which are exposed as setuid binaries.

A malicious user which can run those applications could target those
environment variable paths to locations that would allow it to create
files in various areas of the filesystem.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Don't wait during registration if clock_gettime() fails
Jérémie Galarneau [Thu, 23 Apr 2015 17:07:38 +0000 (13:07 -0400)] 
Fix: Don't wait during registration if clock_gettime() fails

get_constructor_timeout() currently returns -1 which, according to
the lttng-ust(3) man page and lttng_ust_init() implementation,
"waits forever".

This changes the behavior to match what is expressed in the comments.

Comments in get_constructor_timeout() and get_timeout() are also
modified to match the following convention:

-1: wait forever
0: don't wait
1: wait for "constructor_delay_ms"

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: getcpu/clock plugin handle leak
Mathieu Desnoyers [Tue, 14 Apr 2015 22:13:19 +0000 (18:13 -0400)] 
Fix: getcpu/clock plugin handle leak

Keep the handle to the shared object in a static variable. Use it to
check whether it has already been initialized.

We don't allow dlclose() for now though, so it technically leaks, but at
least we keep a reference to the handle.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add missing new ldl dependency for liblttng-ust-ctl
Mathieu Desnoyers [Tue, 14 Apr 2015 18:07:36 +0000 (14:07 -0400)] 
Fix: add missing new ldl dependency for liblttng-ust-ctl

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add missing getenv wrapper
Mathieu Desnoyers [Fri, 10 Apr 2015 22:46:27 +0000 (18:46 -0400)] 
Fix: add missing getenv wrapper

Required for old glibc.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add missing lttng-clock.c
Mathieu Desnoyers [Fri, 10 Apr 2015 22:31:28 +0000 (18:31 -0400)] 
Fix: add missing lttng-clock.c

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add missing ust-clock.h
Mathieu Desnoyers [Fri, 10 Apr 2015 22:24:04 +0000 (18:24 -0400)] 
Fix: add missing ust-clock.h

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoclock plugin example: use shift and mul
Mathieu Desnoyers [Sun, 12 Oct 2014 11:27:24 +0000 (13:27 +0200)] 
clock plugin example: use shift and mul

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoImplement getcpu override
Mathieu Desnoyers [Thu, 2 Oct 2014 21:03:35 +0000 (17:03 -0400)] 
Implement getcpu override

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoImplement clock override plugin support
Mathieu Desnoyers [Wed, 1 Oct 2014 21:59:01 +0000 (17:59 -0400)] 
Implement clock override plugin support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd tracepoint_enabled() macro
Dmitri Shubin [Fri, 27 Mar 2015 19:34:11 +0000 (15:34 -0400)] 
Add tracepoint_enabled() macro

Allows application to check if given probe is enabled.
It's useful when data it passes to tracepoint is expensive to compute.

Signed-off-by: Dmitri Shubin <dmitri.shubin@orc-group.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoMove file creation/unlink from liblttng-ust-ctl to consumerd
Mathieu Desnoyers [Tue, 16 Dec 2014 01:24:22 +0000 (20:24 -0500)] 
Move file creation/unlink from liblttng-ust-ctl to consumerd

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoImplement file-backed ring buffer
Mathieu Desnoyers [Tue, 8 Jul 2014 14:11:09 +0000 (10:11 -0400)] 
Implement file-backed ring buffer

Allow using the --shm-path option in LTTng to specify the location of
the files backing the UST ring buffer. Useful for trace extraction upon
crash, especially by using a persistent memory filesystem as storage for
the files.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: oot build: missing top_builddir include
Jonathan Rajotte [Mon, 23 Mar 2015 19:37:57 +0000 (15:37 -0400)] 
Fix: oot build: missing top_builddir include

lttng/tracepoint.h need lttng/ust-config.h which is
generated on build. When in oot build mode ust_config.h is located in
$(top_builddir)/include/. Only $(top_srcdir)/include/ was defined as
includes source.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Mismatching code and console output in log4j example
Jérémie Galarneau [Mon, 23 Feb 2015 21:22:53 +0000 (16:22 -0500)] 
Fix: Mismatching code and console output in log4j example

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoUpdate manpage about LTTNG_UST_DEBUG effect
Mathieu Desnoyers [Wed, 4 Feb 2015 22:41:32 +0000 (17:41 -0500)] 
Update manpage about LTTNG_UST_DEBUG effect

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoDon't output to stderr from lib unless DEBUG is activated
Mathieu Desnoyers [Wed, 4 Feb 2015 22:39:01 +0000 (17:39 -0500)] 
Don't output to stderr from lib unless DEBUG is activated

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoRemove usterr.h, use usterr-signal-safe.h everywhere instead
Mathieu Desnoyers [Wed, 4 Feb 2015 22:33:59 +0000 (17:33 -0500)] 
Remove usterr.h, use usterr-signal-safe.h everywhere instead

Remove minimally used code.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: out-of-tree build: wrong file path for sed input
Jonathan Rajotte [Mon, 26 Jan 2015 16:50:31 +0000 (11:50 -0500)] 
Fix: out-of-tree build: wrong file path for sed input

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: make dist: python agent file handling
Jonathan Rajotte [Mon, 26 Jan 2015 16:50:30 +0000 (11:50 -0500)] 
Fix: make dist: python agent file handling

Fresh make dist attempt to package a build time file:lttng_agent.py and
make dist attempt to package a non-existent file.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: java-agent: out-of-tree path to java manifest
Jonathan Rajotte [Fri, 23 Jan 2015 18:22:11 +0000 (13:22 -0500)] 
Fix: java-agent: out-of-tree path to java manifest

This should also be backported to stable-2.6.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd return address to liblttng-ust-libc-wrapper
Olivier Delbeke [Mon, 19 Jan 2015 19:14:16 +0000 (14:14 -0500)] 
Add return address to liblttng-ust-libc-wrapper

Signed-off-by: Olivier Delbeke <olivier.delbeke@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: missing parenthesis in offset_align_floor
Mathieu Desnoyers [Fri, 16 Jan 2015 16:33:00 +0000 (11:33 -0500)] 
Fix: missing parenthesis in offset_align_floor

Is currently unused. Triggers a compile error when used.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add ustctl_has_perf_counters
Mathieu Desnoyers [Mon, 12 Jan 2015 22:11:32 +0000 (17:11 -0500)] 
Fix: add ustctl_has_perf_counters

Allow sessiond to report whether performance counters are supported by
UST on the architecture as soon as the user try to enable a perf counter
context.

Fixes #851

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add urcu-bp TLS fixup
Mathieu Desnoyers [Mon, 12 Jan 2015 18:27:53 +0000 (13:27 -0500)] 
Fix: add urcu-bp TLS fixup

When performing a library base address statedump, the UST threads can
grab the RCU read-side lock, which touch a TLS. We should "pre-fault"
this TLS in the constructor to eliminate a deadlock involving libc
dynamic loader lock.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add missing poll.h include
Mathieu Desnoyers [Mon, 12 Jan 2015 16:09:18 +0000 (11:09 -0500)] 
Fix: add missing poll.h include

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: get_subbuf: bound number of consumerd retry
Mathieu Desnoyers [Mon, 5 Jan 2015 02:06:19 +0000 (21:06 -0500)] 
Fix: get_subbuf: bound number of consumerd retry

When an application traced with per-UID buffers vanishes between its
reserve and commit ring buffer operations (e.g. segfault), it may cause
the consumer daemon to enter an endless loop, awaiting for the
application to complete its commit.

Fix this situation by bounding the number of retry using an adaptative
approach: try actively for a few times, and then try a few more times
with a 10ms delay between attempts.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: man: you can't link a lib with a static lib
Philippe Proulx [Wed, 26 Nov 2014 21:50:56 +0000 (16:50 -0500)] 
Fix: man: you can't link a lib with a static lib

Fixes: #825
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: context alignment not properly handled
Mathieu Desnoyers [Mon, 1 Dec 2014 23:18:13 +0000 (18:18 -0500)] 
Fix: context alignment not properly handled

This issue affects only architectures without efficient unaligned
accesses, only when a context field with larger alignment follows a
context field with smaller alignment. It generates unreadable traces
when such context fields are enabled in this configuration.

Fixes #867

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Shorthand option -cp not supported in all version of Java
Christian Babeux [Fri, 28 Nov 2014 21:39:50 +0000 (16:39 -0500)] 
Fix: Shorthand option -cp not supported in all version of Java

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: allow tracepoints to build with --std=c99
Mathieu Desnoyers [Mon, 17 Nov 2014 16:36:10 +0000 (17:36 +0100)] 
Fix: allow tracepoints to build with --std=c99

std=c99 without #define __USE_BSD does not work for tracepoint header,
due to missing endianness macros. Force their definition in the
ust-endian.h wrapper if they are missing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoBump UST ABI for new release cycle
Mathieu Desnoyers [Thu, 13 Nov 2014 22:04:41 +0000 (17:04 -0500)] 
Bump UST ABI for new release cycle

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: remove "disabled" flag for new release cycle
Mathieu Desnoyers [Wed, 12 Nov 2014 23:12:35 +0000 (18:12 -0500)] 
Cleanup: remove "disabled" flag for new release cycle

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: filter attach vs event enable race
Mathieu Desnoyers [Wed, 12 Nov 2014 23:08:04 +0000 (18:08 -0500)] 
Fix: filter attach vs event enable race

In order to correctly handle the use-case where events are enabled
_after_ trace is started, and _after_ applications are already being
traced, the event should be created in a "disabled" state, so that it
does not trace events until its filter is attached.

This fix needs to be done both in lttng-tools and lttng-ust. In order to
keep ABI compatibility between tools and ust within a stable release
cycle, we introduce a new "disabled" within struct lttng_ust_event
padding (previously zeroed). Newer LTTng-UST checks this flag, and
fallback on the old racy behavior (enabling the event on creation) if it
is unset.

Therefore, old session daemon works with newer lttng-ust of the same
stable release, and vice-versa. However, building lttng-tools requires
an upgraded lttng-ust, which contains the communication protocol with
the new "disabled" field.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add a configure check for weak symbols support
Christian Babeux [Wed, 12 Nov 2014 19:35:21 +0000 (14:35 -0500)] 
Fix: add a configure check for weak symbols support

Fixes #236

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix coverity warning about sizeof(void **) != sizeof(void *)
Mathieu Desnoyers [Wed, 12 Nov 2014 21:05:36 +0000 (16:05 -0500)] 
Fix coverity warning about sizeof(void **) != sizeof(void *)

The size of the copied data is actually void *, not void **.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: off-by-one in sequence filter comparator
Mathieu Desnoyers [Sat, 8 Nov 2014 17:16:41 +0000 (12:16 -0500)] 
Fix: off-by-one in sequence filter comparator

If we pass the following sequence as event input:
- field name "seqfield2"
- seq. len.: 4
- sequence array: "testA" (5 characters),

The following filters do not have the intended effect:
* 'seqfield2=="testA"'
  - expected: no match.
  - actual behavior: match.

* 'seqfield2=="test"'
  - expected: match.
  - actual behavior: no match.

This is caused by an off-by-one in the comparison with sequence length
in the filter bytecode interpreter.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Java Agent JAR file symlink should be created after objects install
Christian Babeux [Tue, 4 Nov 2014 21:28:19 +0000 (16:28 -0500)] 
Fix: Java Agent JAR file symlink should be created after objects install

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Add versioning to liblttng-ust-agent JAR
Christian Babeux [Mon, 3 Nov 2014 20:12:26 +0000 (15:12 -0500)] 
Fix: Add versioning to liblttng-ust-agent JAR

The liblttng-ust-agent JAR need versioning. The manifest file contains the
appropriate information about the JAR, such as the current version.

A symlink is also created and installed in order to point to the latest
version of the JAR.

e.g: liblttng-ust-agent.jar -> liblttng-ust-agent-1.0.0.jar

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Warn when log4j version is too old
Christian Babeux [Fri, 31 Oct 2014 19:33:59 +0000 (15:33 -0400)] 
Fix: Warn when log4j version is too old

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoUpdate Java agent documentation
Christian Babeux [Fri, 31 Oct 2014 19:33:40 +0000 (15:33 -0400)] 
Update Java agent documentation

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Try loading classes using the thread context class loader
Jérémie Galarneau [Fri, 31 Oct 2014 18:03:47 +0000 (14:03 -0400)] 
Fix: Try loading classes using the thread context class loader

LTTngAgent should load classes using the current thread context's
class loader and then try using the system class loader if a
ClassNotFoundException is thrown.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAdd Python agent support
David Goulet [Thu, 9 Oct 2014 17:21:02 +0000 (13:21 -0400)] 
Add Python agent support

This adds a new library in this repository being the
liblttng-ust-python-agent. It contains the Python agent and a library
for the tracepoints used by the agent.

To enable the python agent, use --enable-python-agent to build it.

This new agent is bound to the LTTng python domain in lttng-tools which
implements the -p,--python option for agent's command.

It works and tested for python 2.7.x and 3.x

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoUpdate version name
Mathieu Desnoyers [Mon, 20 Oct 2014 22:57:50 +0000 (18:57 -0400)] 
Update version name

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.6.0-rc1
Mathieu Desnoyers [Mon, 20 Oct 2014 22:54:31 +0000 (18:54 -0400)] 
Version 2.6.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAdd missing file to gitignore
Mathieu Desnoyers [Thu, 16 Oct 2014 15:03:40 +0000 (17:03 +0200)] 
Add missing file to gitignore

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: preserve example files' timestamps when copying
Jérémie Galarneau [Thu, 16 Oct 2014 13:45:19 +0000 (09:45 -0400)] 
Fix: preserve example files' timestamps when copying

This fixes an issue where examples were always being rebuilt
when performing an out of tree build since the examples were
being copied to the build directory with a timestamp more
recent than the already-built example objects.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Abort loading log4j agent classes when detected log4j version is too old
Christian Babeux [Thu, 2 Oct 2014 20:31:56 +0000 (16:31 -0400)] 
Fix: Abort loading log4j agent classes when detected log4j version is too old

The Java Log4j agent rely on the getTimeStamp() method that was
introduced in log4j 1.2.15. This fix implement a runtime detection of
the log4j library capabilities and abort the loading of the relevant
agent classes if the version used is too old.

Thus, log4j tracing will be deactivated on older version of the
library.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoCleanup: Remove the no longer needed liblttng-ust-jul folder
Christian Babeux [Thu, 25 Sep 2014 16:08:11 +0000 (12:08 -0400)] 
Cleanup: Remove the no longer needed liblttng-ust-jul folder

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Wrong CLASSPATH when building liblttng-ust-java oot
Christian Babeux [Thu, 25 Sep 2014 16:07:32 +0000 (12:07 -0400)] 
Fix: Wrong CLASSPATH when building liblttng-ust-java oot

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Wrong CLASSPATH when building liblttng-ust-java-agent oot
Christian Babeux [Wed, 24 Sep 2014 19:44:05 +0000 (15:44 -0400)] 
Fix: Wrong CLASSPATH when building liblttng-ust-java-agent oot

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoRename public structure to avoid collisions
Simon Marchi [Wed, 13 Aug 2014 23:10:41 +0000 (19:10 -0400)] 
Rename public structure to avoid collisions

Since nobody raised any concern about this, I submit the patch for
merging. You can find the original discussion here:

  http://lists.lttng.org/pipermail/lttng-dev/2014-July/023364.html

(the rest of the message is identical to the RFC post)

When trying to use lttng-ust with a program that defines its own struct
tracepoint, a name collision arises and compilation fails (see example
lower).

I suggest the following renames (the problem only showed up with struct
tracepoint in my case, but let's be proactive):

 * struct tracepoint -> struct lttng_ust_tracepoint
 * struct tracepoint_probe -> struct lttng_ust_tracepoint_probe
 * struct tracepoint_dlopen -> struct lttng_ust_tracepoint_dlopen

Strictly speaking, those names are part of the public API of LTTng, so I
understand that it would be a felony to rename it, since it breaks the
holy API. However, those structures are only used through some macros,
and I am not aware of any sensible use case where a user of lttng-ust
would directly reference those structures. Therefore, it should not break
any existing code. If you do have such a use case, where it would break
your code, please jump in the discussion.

This should not break any application instrumented and built before the
change. Tested by building "hello" before and tracing it after the
change.

Here is an example of error due to the name collision. This is when
building gdb, which I try to instrument with lttng-ust.

In file included from /usr/local/include/lttng/tracepoint.h:28:0,
                 from ust_tracepoints.h:15,
                 from inf-ptrace.c:38:
/usr/local/include/lttng/tracepoint-types.h:32:8: error: redefinition of
‘struct tracepoint’
 struct tracepoint {
        ^
In file included from inferior.h:37:0,
                 from inf-ptrace.c:22:
breakpoint.h:817:8: note: originally defined here
 struct tracepoint
        ^
Makefile:1088: recipe for target 'inf-ptrace.o' failed
make: *** [inf-ptrace.o] Error 1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoRefactor liblttng-ust-jul in liblttng-ust-agent
Christian Babeux [Mon, 15 Sep 2014 03:11:30 +0000 (23:11 -0400)] 
Refactor liblttng-ust-jul in liblttng-ust-agent

This is a major refactor of the initial implementation of the UST JUL
agent. The agent now support the log4j logging backend.

The agent can now be built in three different configurations:

1) Java agent with JUL support:

$ ./configure --enable-java-agent-jul

2) Java agent with Log4j support:

$ export CLASSPATH=$CLASSPATH:/path/to/log4j.jar
$ ./configure --enable-java-agent-log4j

3) Java agent with JUL + Log4j support

$ export CLASSPATH=$CLASSPATH:/path/to/log4j.jar
$ ./configure --enable-java-agent-all

To build the agent with log4j support, make sure that the log4j jar
is in your Java classpath.

The configure script will automatically detect the appropriate Java
binaries to use in order to build the Java agent.

The name of the agent jar file is now "liblttng-ust-agent.jar".
It will be installed in the arch-agnostic "$prefix/share/java" path
e.g: "/usr/share/java".

In order to support older applications using the "org.lttng.ust.jul"
package, a transitional package is built with the same name.

All applications should move to use the "org.lttng.ust.agent" package.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoBuild the liblttng-ust-java library using the new M4 macros
Christian Babeux [Mon, 15 Sep 2014 03:30:45 +0000 (23:30 -0400)] 
Build the liblttng-ust-java library using the new M4 macros

The liblttng-ust-java can now be built without passing paths to
the JDK:

$ ./configure --enable-jni-interface

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAdd M4 macros helpers to build Java programs
Christian Babeux [Mon, 15 Sep 2014 03:28:38 +0000 (23:28 -0400)] 
Add M4 macros helpers to build Java programs

These M4 were taken from the autoconf archive [1].

[1] - http://www.gnu.org/software/autoconf-archive

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoModernize README using Markdown
Philippe Proulx [Wed, 17 Sep 2014 03:29:06 +0000 (23:29 -0400)] 
Modernize README using Markdown

This commit also:

  * adds a project description at the top
  * simplifies the steps to build/link a user
    application with LTTng-UST and provides examples
    of commands
  * updates the Package contents list

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoDocumentation: clarify event name in lttng-ust.3
Mathieu Desnoyers [Thu, 11 Sep 2014 15:19:05 +0000 (11:19 -0400)] 
Documentation: clarify event name in lttng-ust.3

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAdd cscope to gitignore
Mathieu Desnoyers [Tue, 9 Sep 2014 14:09:13 +0000 (10:09 -0400)] 
Add cscope to gitignore

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoconfigure.ac: fix "missing jni.h" error message
Philippe Proulx [Tue, 2 Sep 2014 20:12:55 +0000 (16:12 -0400)] 
configure.ac: fix "missing jni.h" error message

DIR in --with-java-jdk=DIR must point to the JDK base
directory, not the actual JDK include directory.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: remove references to trace_printf()
Mathieu Desnoyers [Wed, 13 Aug 2014 16:27:46 +0000 (12:27 -0400)] 
Fix: remove references to trace_printf()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoChange JUL agent to use the new ABI
David Goulet [Fri, 8 Aug 2014 16:48:48 +0000 (12:48 -0400)] 
Change JUL agent to use the new ABI

Two things have changed, the agent port file created by the session
daemon, the name is now "agent.port". The second thing is that upon
registration, the agent needs to send its domain which is here
LTTNG_DOMAIN_JUL (val: 3).

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.5.0
Mathieu Desnoyers [Wed, 16 Jul 2014 22:18:11 +0000 (18:18 -0400)] 
Version 2.5.0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoMutex while updating statedump_pending is not needed
Mathieu Desnoyers [Wed, 16 Jul 2014 21:40:53 +0000 (17:40 -0400)] 
Mutex while updating statedump_pending is not needed

Take care of coverity warning ** CID 1226392:  Data race condition  (MISSING_LOCK)
/liblttng-ust/lttng-ust-comm.c: 1704 in lttng_ust_sockinfo_session_enabled()

It's not that the lock is missing, it's that we don't need to hold the
lock when doing the other modification.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoRevert "Turn base address dump into experimental feature"
Paul Woegerer [Mon, 14 Jul 2014 08:38:25 +0000 (10:38 +0200)] 
Revert "Turn base address dump into experimental feature"

This reverts commit b11abb674e50c67e3410ab2bd5d0a263e88b73ba.

Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: document ust_fork_mutex nesting
Mathieu Desnoyers [Wed, 16 Jul 2014 14:35:43 +0000 (10:35 -0400)] 
Fix: document ust_fork_mutex nesting

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoBugfix for #745 deadlock with baddr statedump+fork
Paul Woegerer [Mon, 14 Jul 2014 08:38:24 +0000 (10:38 +0200)] 
Bugfix for #745 deadlock with baddr statedump+fork

Fixes #745

Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoMove enablers syncing after the channel registration
Francis Deslauriers [Thu, 10 Jul 2014 22:22:14 +0000 (18:22 -0400)] 
Move enablers syncing after the channel registration

Fixes possible race condition where an event registration is received
before its channel registration by the consumer.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAdd lttng_ust_notrace to static inline functions
Paul Woegerer [Mon, 7 Jul 2014 14:04:21 +0000 (16:04 +0200)] 
Add lttng_ust_notrace to static inline functions

The static inline functions
__tracepoint_provider_mismatch_<TRACEPOINT_PROVIDER> and
__tracepoint_provider_check_<TRACEPOINT_PROVIDER> are missing the
lttng_ust_notrace attribute to prevent them from getting instrumented
with -finstrument-functions (if e.g. defined in CFLAGS). This patch is
adding the attribute to those functions.

Signed-off-by: Paul Woegerer <paul_woegerer@mentor.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agolttng ust: support ppc64le within configure
Michel Normand [Mon, 30 Jun 2014 16:12:19 +0000 (12:12 -0400)] 
lttng ust: support ppc64le within configure

Takes care of https://bugzilla.redhat.com/show_bug.cgi?id=1114691

Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.5.0-rc2
Mathieu Desnoyers [Fri, 27 Jun 2014 14:07:32 +0000 (10:07 -0400)] 
Version 2.5.0-rc2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: lttng-ust-jul: set thread in daemon mode
David Goulet [Thu, 26 Jun 2014 19:07:54 +0000 (15:07 -0400)] 
Fix: lttng-ust-jul: set thread in daemon mode

This way, when the JVM stops the main thread, the agent's thread will be
automatically shutdown thus making the .dispose() call optional.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoJUL: use root logger to capture events
David Goulet [Wed, 18 Jun 2014 18:08:24 +0000 (14:08 -0400)] 
JUL: use root logger to capture events

The JUL agent now uses the root logger ("") to capture all events. This
allows us to remove the Timer thread and cleanup a huge portion of the
code base. It simplifies a great deal the internal structure of the
agent since we don't have to monitor the Logger object anymore.

Since tracepoint filtering is done in UST, we just the LTTng handler to
the root logger and send everything to UST.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: Wrong configure check for UST perf event counters context support
Christian Babeux [Thu, 26 Jun 2014 15:42:28 +0000 (11:42 -0400)] 
Fix: Wrong configure check for UST perf event counters context support

When building on non-x86 platforms, the build errors out with the following:

  CC       lttng-context-perf-counters.lo
lttng-context-perf-counters.c:95:2: error: #error "Perf event counters are only supported on x86 so far."
lttng-context-perf-counters.c: In function 'read_perf_counter':
lttng-context-perf-counters.c:114:4: warning: implicit declaration of function 'rdpmc' [-Wimplicit-function-declaration]
make[2]: *** [lttng-context-perf-counters.lo] Error 1

The configure script checks for the presence of the "perf_event.h" header to enable support for
perf events counters. However, the current implementation is only available on x86,
hence the build fails on platform where the perf header is available.

Fix this issue by detecting the architecture we are currently building and wether
to enable or not the support for perf event counters context.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: multiple providers in same C file failure
Mathieu Desnoyers [Tue, 10 Jun 2014 16:17:08 +0000 (12:17 -0400)] 
Fix: multiple providers in same C file failure

If we have a C file in an application that is meant to contain both the
instrumentation and the provider, build fails if we have more than one
provider.

Fixed by putting back definitions to the state they were when defined by
tracepoint.h after a probe provider is created. This allows the next
tracepoint provider to define its tracepoints.

Fixes #805

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: header inclusion guard typo in lttng-ust-tracef-provider.h
Gerlando Falauto [Tue, 3 Jun 2014 08:01:58 +0000 (10:01 +0200)] 
Fix: header inclusion guard typo in lttng-ust-tracef-provider.h

Fix typo potentially allowing for multiple inclusions.

Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: 2.5.0-rc1 changelog has off-by-one date
Mathieu Desnoyers [Wed, 28 May 2014 14:24:08 +0000 (10:24 -0400)] 
Fix: 2.5.0-rc1 changelog has off-by-one date

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoVersion 2.5.0-rc1
Mathieu Desnoyers [Wed, 28 May 2014 14:18:27 +0000 (10:18 -0400)] 
Version 2.5.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: out of tree build for lib Java and JUL
David Goulet [Tue, 27 May 2014 15:03:42 +0000 (11:03 -0400)] 
Fix: out of tree build for lib Java and JUL

Reported-by: Daniel Olivier <daniel.olivier@ericsson.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: default loglevel is DEBUG
Mathieu Desnoyers [Fri, 23 May 2014 14:28:41 +0000 (10:28 -0400)] 
Fix: default loglevel is DEBUG

Include "tracef" events when no explicit loglevel is specified. (for
usability)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.051474 seconds and 5 git commands to generate.