lttng-ust.git
8 years agoGenerate and export the sequence number
Julien Desfossez [Mon, 15 Jun 2015 20:33:47 +0000 (16:33 -0400)] 
Generate and export the sequence number

This allows the viewer to identify the gaps between trace packets.

This is a locked-step with the corresponding commit in lttng-tools.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAdd stream instance id to the packet header
Julien Desfossez [Mon, 15 Jun 2015 15:04:58 +0000 (11:04 -0400)] 
Add stream instance id to the packet header

This new field allows the viewer to distinguish between trace files
belonging to the same packet stream (in LTTng: the same CPU in the same
channel).

This is a locked-step with the corresponding commit in lttng-tools.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Acked-by: Mathieu.Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: print empty line after AC_OUTPUT
Philippe Proulx [Mon, 29 Feb 2016 18:14:01 +0000 (13:14 -0500)] 
configure.ac: print empty line after AC_OUTPUT

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: macros with no arguments do not need ()
Philippe Proulx [Mon, 29 Feb 2016 18:13:36 +0000 (13:13 -0500)] 
configure.ac: macros with no arguments do not need ()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: standardize indentation to tabs
Philippe Proulx [Mon, 29 Feb 2016 18:08:53 +0000 (13:08 -0500)] 
configure.ac: standardize indentation to tabs

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: move AC_PROG_SED() close to other AC_PROG_*()
Philippe Proulx [Sat, 27 Feb 2016 09:39:36 +0000 (04:39 -0500)] 
configure.ac: move AC_PROG_SED() close to other AC_PROG_*()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: test -a -> shell's && (more portable)
Philippe Proulx [Sat, 27 Feb 2016 09:37:54 +0000 (04:37 -0500)] 
configure.ac: test -a -> shell's && (more portable)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: use test "x$var" = "xyes"
Philippe Proulx [Sat, 27 Feb 2016 09:32:11 +0000 (04:32 -0500)] 
configure.ac: use test "x$var" = "xyes"

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: AM_CONDITIONAL() accepts two arguments
Philippe Proulx [Sat, 27 Feb 2016 09:30:31 +0000 (04:30 -0500)] 
configure.ac: AM_CONDITIONAL() accepts two arguments

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: use dnl at appropriate places
Philippe Proulx [Sat, 27 Feb 2016 09:28:57 +0000 (04:28 -0500)] 
configure.ac: use dnl at appropriate places

Use dnl where such a comment makes no sense in the outputted
configure script.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: if -> AS_IF()
Philippe Proulx [Sat, 27 Feb 2016 09:22:31 +0000 (04:22 -0500)] 
configure.ac: if -> AS_IF()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: case -> AS_CASE()
Philippe Proulx [Sat, 27 Feb 2016 09:13:33 +0000 (04:13 -0500)] 
configure.ac: case -> AS_CASE()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: add missing quotes in macro calls
Philippe Proulx [Sat, 27 Feb 2016 09:00:28 +0000 (04:00 -0500)] 
configure.ac: add missing quotes in macro calls

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: use macros for version name and description
Philippe Proulx [Sat, 27 Feb 2016 08:59:33 +0000 (03:59 -0500)] 
configure.ac: use macros for version name and description

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoconfigure.ac: do not use shell eval for known values
Philippe Proulx [Sat, 27 Feb 2016 08:07:14 +0000 (03:07 -0500)] 
configure.ac: do not use shell eval for known values

The version parts are known at Autoconf time, thus it makes no
sense to do string manipulation using the user's shell.

Just dnl the V_EXTRA definition when there's no extra version.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAdd CONTRIBUTING.md
Philippe Proulx [Sat, 20 Feb 2016 01:55:06 +0000 (20:55 -0500)] 
Add CONTRIBUTING.md

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoOutput "(null)" when ctf_string()'s arg is NULL
Philippe Proulx [Wed, 17 Feb 2016 23:04:42 +0000 (18:04 -0500)] 
Output "(null)" when ctf_string()'s arg is NULL

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: disable use of __builtin_return_address(0) on 32-bit PowerPC
Mathieu Desnoyers [Wed, 17 Feb 2016 23:18:17 +0000 (18:18 -0500)] 
Fix: disable use of __builtin_return_address(0) on 32-bit PowerPC

It causes stack corruption in the tracepoint event probes.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: java agent 32-bit pointer to jlong warning
Mathieu Desnoyers [Tue, 16 Feb 2016 16:05:10 +0000 (11:05 -0500)] 
Fix: java agent 32-bit pointer to jlong warning

Fix the following compiler warning on 32-bit:

15:07:12 lttng_ust_context.c: In function 'Java_org_lttng_ust_agent_context_LttngContextApi_registerProvider':
15:07:12 lttng_ust_context.c:377:17: warning: cast from pointer to
integer of different size [-Wpointer-to-int-cast]
15:07:12   provider_ref = (jlong) provider;

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Use Java 6 syntax in JUL examples
Michael Jeanson [Mon, 15 Feb 2016 19:29:58 +0000 (14:29 -0500)] 
Fix: Use Java 6 syntax in JUL examples

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: add missing example file to dist tarball
Mathieu Desnoyers [Fri, 12 Feb 2016 23:30:06 +0000 (18:30 -0500)] 
Fix: add missing example file to dist tarball

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: add missing header to dist tarball
Mathieu Desnoyers [Fri, 12 Feb 2016 23:25:37 +0000 (18:25 -0500)] 
Fix: add missing header to dist tarball

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: add missing LttngContextApi.java to dist tarball
Mathieu Desnoyers [Fri, 12 Feb 2016 23:14:16 +0000 (18:14 -0500)] 
Fix: add missing LttngContextApi.java to dist tarball

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPass the Java app context information using two separate arrays
Alexandre Montplaisir [Fri, 12 Feb 2016 20:28:07 +0000 (15:28 -0500)] 
Pass the Java app context information using two separate arrays

Instead of using one array with length limits for strings, we can
pass two separate arrays: the first will continue to contain fixed-
size entries, but instead of 256 bytes for strings, we will use
4-byte offsets to a second array, which will contain only those
variable-length strings.

The advantage is that we pass less bytes overall, and we don't
limit the context names or values to 256 bytes anymore.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Correctly report filter notifications on Java agent teardown
Alexandre Montplaisir [Fri, 12 Feb 2016 16:51:47 +0000 (11:51 -0500)] 
Fix: Correctly report filter notifications on Java agent teardown

If a Java agent gets disposed, it should not just clear() all its
tracked event rules: it should first send corresponding filter change
notifications indicating that these rules are not tracked anymore.

This fixes a problem where if event rules were still enabled on agent
tear down, the filter notifier's own tracked events would become out
of sync.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAdd some logging to the AbstractLttngAgent
Alexandre Montplaisir [Fri, 12 Feb 2016 00:45:47 +0000 (19:45 -0500)] 
Add some logging to the AbstractLttngAgent

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Clear tracked application contexts upon closing a Java agent
Alexandre Montplaisir [Fri, 12 Feb 2016 00:37:44 +0000 (19:37 -0500)] 
Fix: Clear tracked application contexts upon closing a Java agent

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoIntroduce a verbose mode for the Java agent
Alexandre Montplaisir [Thu, 4 Feb 2016 23:37:37 +0000 (18:37 -0500)] 
Introduce a verbose mode for the Java agent

If the LTTNG_UST_DEBUG environment variable is defined, log messages
from the Java agent will be sent to stderr. This is in line with the
rest of UST.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoImplement Java agent application context retrieval
Alexandre Montplaisir [Thu, 7 Jan 2016 22:43:34 +0000 (17:43 -0500)] 
Implement Java agent application context retrieval

Java application can now register an IContextInfoRetriever to provide
context information. This information can be used for filtering:

  lttng enable-event -j myevent --filter '$app.retriever:context=="something"'

or for saving in the trace directly by enabling the context:

  lttng add-context -j -t '$app.retriever:context'

See the "ApplicationContextExample.java" program for an example of
utilization.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoTurn ISessiondCommand into an abstract class
Alexandre Montplaisir [Fri, 8 Jan 2016 20:28:07 +0000 (15:28 -0500)] 
Turn ISessiondCommand into an abstract class

This will allow us to define common methods to read strings passed on
the socket, which many commands (including upcoming ones) need to do.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoSplit the JNI APIs in separate classes
Alexandre Montplaisir [Mon, 4 Jan 2016 20:11:11 +0000 (15:11 -0500)] 
Split the JNI APIs in separate classes

Isolate the "native" methods in their own class, to better reflect
what is present in the equivalent C files.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAdd app context support to ust-ctl protocol
Jérémie Galarneau [Wed, 27 Jan 2016 03:48:21 +0000 (22:48 -0500)] 
Add app context support to ust-ctl protocol

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoHandle application context cmd
Mathieu Desnoyers [Wed, 3 Feb 2016 22:07:27 +0000 (17:07 -0500)] 
Handle application context cmd

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoImplement dynamic types, and application context provider support
Mathieu Desnoyers [Wed, 13 Jan 2016 21:52:26 +0000 (16:52 -0500)] 
Implement dynamic types, and application context provider support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: handle negative range for LTTNG_UST_REGISTER_TIMEOUT
Mathieu Desnoyers [Fri, 12 Feb 2016 20:44:10 +0000 (15:44 -0500)] 
Fix: handle negative range for LTTNG_UST_REGISTER_TIMEOUT

We should not consider values below -1 as valid timeout values, this is
is unexpected and could lead to EINVAL errors returned by sem_timedwait.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Ensure the Java JUL messages are correctly formatted
Alexandre Montplaisir [Thu, 4 Feb 2016 05:32:01 +0000 (00:32 -0500)] 
Fix: Ensure the Java JUL messages are correctly formatted

It is possible for log records to contain messages that need some
formatting, for example if the string contains localized elements
or if the log(Level, String, Object[]) method is used.

In these cases, we need to make sure to format the string and not
pass the "raw" string to the tracepoint.

This only applies to the JUL API. log4j 1.2.x did not handle such
formatting, although log4j 2.x does.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: double-free on error sending fields
Mathieu Desnoyers [Fri, 15 Jan 2016 16:31:29 +0000 (11:31 -0500)] 
Fix: double-free on error sending fields

Found by Coverity:
*** CID 1348462:    (USE_AFTER_FREE)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAdd CTF enum type support to tracepoint event
Mathieu Desnoyers [Sat, 9 Jan 2016 19:44:30 +0000 (14:44 -0500)] 
Add CTF enum type support to tracepoint event

Derived from initial implementation by:
Geneviève Bastien <gbastien+lttng@versatic.net>

Bump UST communication protocol version to 6.1 (minor version increase)
since we're adding enumeration notification command.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: missing _GNU_SOURCE define
Jonathan Rajotte [Mon, 4 Jan 2016 22:31:57 +0000 (17:31 -0500)] 
Fix: missing _GNU_SOURCE define

O_CLOEXEC requires _GNU_SOURCE.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agopython-lttngust/setup.py.in: update setup() fields
Philippe Proulx [Fri, 27 Nov 2015 18:04:44 +0000 (13:04 -0500)] 
python-lttngust/setup.py.in: update setup() fields

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoRefactor Python agent build and install
Philippe Proulx [Fri, 27 Nov 2015 17:39:51 +0000 (12:39 -0500)] 
Refactor Python agent build and install

Since the Python agent's tracepoint provider,
liblttng-ust-python-agent, does not depend on Python, it can
always be built and installed alongside LTTng-UST.

The Python package of this agent is completely independent
from the rest of the tree, thus it is isolated in its own
directory. This also eases the creation of distribution
packages because the packager can selectively build and
install the Python package without also building/installing the
tracepoint provider.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: remove debugging print() call from Python agent
Philippe Proulx [Tue, 27 Oct 2015 23:06:56 +0000 (19:06 -0400)] 
Fix: remove debugging print() call from Python agent

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: header size larger than 256 bytes
Mathieu Desnoyers [Sun, 25 Oct 2015 15:25:31 +0000 (11:25 -0400)] 
Fix: header size larger than 256 bytes

When adding large context (e.g. callstack), headers larger than 256
bytes cause discrepancy between calculated size and size written into
the trace buffers. This generates a corrupted trace and triggers a
warning in ring buffer backend, which triggers a safety net disabling
tracing for the current channel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoPython agent: Support Agent protocol v2.0
Jérémie Galarneau [Fri, 23 Oct 2015 21:12:50 +0000 (17:12 -0400)] 
Python agent: Support Agent protocol v2.0

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Java agent protocol network endianness consistency
Jérémie Galarneau [Fri, 23 Oct 2015 21:12:51 +0000 (17:12 -0400)] 
Fix: Java agent protocol network endianness consistency

Considering the Agent Protocol is bumped to v2.0 as of 2.8.x,
this patch revisits the unfortunate decision of communicating
in host-endianness from the session daemon to the agents, and
in big endian from the agents to the session daemon.

This change does not affect the Python agent which was erroneously
(although quite reasonably) assuming communications were occurring
in network endianness.

This issue does not affect versions 2.7 and below because the loglevel
was not used.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: examples jul: add missing files to make dist
Mathieu Desnoyers [Thu, 22 Oct 2015 21:29:45 +0000 (17:29 -0400)] 
Fix: examples jul: add missing files to make dist

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Filer -> Filter typo in example
Mathieu Desnoyers [Thu, 22 Oct 2015 21:26:25 +0000 (17:26 -0400)] 
Fix: Filer -> Filter typo in example

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Return the correct list of available Java events
Alexandre Montplaisir [Wed, 9 Sep 2015 19:07:24 +0000 (15:07 -0400)] 
Fix: Return the correct list of available Java events

The "lttng list -j/-l" command should list the events that are currently
offered by Java application and available to be enabled.

Due to some confusion in the implementation of the corresponding agent
command response, it was actually returning the list of events that were
enabled in the tracing session.

Rectify this by sending the list of loggers of the corresponding domain
that have one or more LTTng log handlers attached. The interface method
was also renamed from listEnabledEvents() to listAvailableEvents() to
make it more representative.

Fixes: #933
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd a toString() to Java agent's EventRule
Alexandre Montplaisir [Tue, 15 Sep 2015 17:57:09 +0000 (13:57 -0400)] 
Add a toString() to Java agent's EventRule

Helps with debugging and eventually for pretty-printing.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd API stubs for the Java context info retrievers
Alexandre Montplaisir [Thu, 3 Sep 2015 18:00:28 +0000 (14:00 -0400)] 
Add API stubs for the Java context info retrievers

A context info retriever will allow an application to define their own
context information, and have it available in the resulting UST traces.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoReceive the event filter string in the Java agent
Alexandre Montplaisir [Wed, 9 Sep 2015 23:46:08 +0000 (19:46 -0400)] 
Receive the event filter string in the Java agent

Update to agent protocol 2.0, which now sends the filter string as part
of the "enable event" command.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoDocument the Java filter notification model
Alexandre Montplaisir [Thu, 3 Sep 2015 16:42:15 +0000 (12:42 -0400)] 
Document the Java filter notification model

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd filter change notification mechanism to the Java agent
Alexandre Montplaisir [Thu, 27 Aug 2015 23:50:36 +0000 (19:50 -0400)] 
Add filter change notification mechanism to the Java agent

Java applications can now register to receive notifications of event
filtering rules being changed in the tracing session. This can be
used to implement application-specific filtering on the Java side,
to reduce the amount of events sent through JNI.

To do so, they need to implement a IFilterChangeListener and register
it to the FilterChangeNotifier. The listener's callbacks will
be invoked by the LTTng agent when the tracing session(s) change.

A new example file is provided to demo this usage.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoManage complete "event rules" in the Java agent
Alexandre Montplaisir [Thu, 27 Aug 2015 00:10:50 +0000 (20:10 -0400)] 
Manage complete "event rules" in the Java agent

Instead of just tracking which event names are enabled in the tracing
session, we can track the complete name/filter/loglevel tuple. This
allows the same event name to be specified multiple times but with
different parameters.

Right now the sessiond does not send the filter string, a new protocol
version will be required to do so. But we can prepare for it in the
meantime.

The agent will continue to use the event names to decide if events
should be sent through JNI or not. However, full rules will be useable
for other purposes, like the upcoming filter notifications.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoIntroduce a new client listener interface for the Java agent
Alexandre Montplaisir [Sat, 29 Aug 2015 02:41:04 +0000 (22:41 -0400)] 
Introduce a new client listener interface for the Java agent

Decouple the TCP client from the implementation of the LTTng Java agent.
Instead of using AbstractLttngAgent directly, the TCP client (and the
command subclasses) can deal with the new ILttngTcpClientListener
interface. The agent will implement this interface.

This will also allow easier testing of the TCP client and its protocol,
since test classess can now implement their own listener and verify the
contents of each command.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoTurn ILttngAgentResponse into an abstract class
Alexandre Montplaisir [Tue, 25 Aug 2015 23:04:27 +0000 (19:04 -0400)] 
Turn ILttngAgentResponse into an abstract class

This allows defining a default behavior for the getBytes() method.
That behavior consists of only returning the integer return code,
which is what most (but not all) subclasses use.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoRemove stale tests/java-jul test
Mathieu Desnoyers [Thu, 22 Oct 2015 20:51:49 +0000 (16:51 -0400)] 
Remove stale tests/java-jul test

This test has been superseded by lttng-tools tests and
https://github.com/lttng/lttng-ust-java-tests .

This test was not in configure.ac nor had any automake Makefile.am
anyway.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: live timer calculation error
Mikael Beckius [Tue, 12 May 2015 09:04:34 +0000 (11:04 +0200)] 
Fix: live timer calculation error

There is an calculation error for live timer. Variable
chan->switch_timer_interval is based on microsecond, and it is not right
to assign chan->switch_timer_interval mod 1000000 to var tv_nsec which
is based on nanosecond.

Signed-off-by: Mikael Beckius <mikael.beckius@windriver.com>
Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix python agent build/install/uninstall with DESTDIR specified
Jonathan Rajotte [Fri, 16 Oct 2015 19:07:31 +0000 (15:07 -0400)] 
Fix python agent build/install/uninstall with DESTDIR specified

Remove the install_files.txt record since it's simpler to delete the
complete folder on uninstall.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Don't (re)define STAP_PROBEV
Stelios Bounanos [Wed, 14 Oct 2015 16:31:36 +0000 (17:31 +0100)] 
Fix: Don't (re)define STAP_PROBEV

Define a new LTTNG_STAP_PROBEV macro to avoid clobbering STAP_PROBEV or
emitting unwanted sdt probes when lttng-ust has been built without sdt
support.

Signed-off-by: Stelios Bounanos <sb@enotty.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: don't dereference NULL pointers
Mathieu Desnoyers [Mon, 21 Sep 2015 20:44:38 +0000 (16:44 -0400)] 
Fix: don't dereference NULL pointers

Detected by scan-build.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: Remove unused values
Mathieu Desnoyers [Mon, 21 Sep 2015 20:01:06 +0000 (16:01 -0400)] 
Cleanup: Remove unused values

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Value stored to 'has_waited' is never read
Mathieu Desnoyers [Mon, 21 Sep 2015 19:57:36 +0000 (15:57 -0400)] 
Fix: Value stored to 'has_waited' is never read

Reported by scan-build.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Argument with 'nonnull' attribute passed null
Mathieu Desnoyers [Mon, 21 Sep 2015 19:47:09 +0000 (15:47 -0400)] 
Fix: Argument with 'nonnull' attribute passed null

Reported by scan-build
API Argument with 'nonnull' attribute passed null libringbuffer
/ring_buffer_backend.c 380
API Argument with 'nonnull' attribute passed null libringbuffer
/ring_buffer_backend.c  420

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: Unnecessary bit shift
Jonathan Rajotte [Mon, 21 Sep 2015 18:31:33 +0000 (14:31 -0400)] 
Cleanup: Unnecessary bit shift

Reported by cppcheck [1].

[1]
https://ci.lttng.org/view/Code%20quality/job/lttng-ust_master_cppcheck/5/cppcheckResult/source.10/

Proposed-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoClean-up: remove extraneous "found" parameters in ust-elf
Antoine Busque [Mon, 21 Sep 2015 18:19:43 +0000 (14:19 -0400)] 
Clean-up: remove extraneous "found" parameters in ust-elf

In lttng-ust-elf.c, static functions used to extract build ID or debug
link information had an extraneous `found` parameter, carrying no more
information than could be obtained by checking the other out
parameters against NULL. The resulting simplified logic should also
prevent static analysis tools from misidentifying resource leaks.

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: sysconf() unchecked return value
Mathieu Desnoyers [Mon, 21 Sep 2015 17:43:08 +0000 (13:43 -0400)] 
Fix: sysconf() unchecked return value

Fix Coverity bug:

CID 1021259 (#1 of 1): Improper use of negative value
(NEGATIVE_RETURNS)5. negative_returns: sysconf(_SC_PAGESIZE) is passed
to a parameter that cannot be negative.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agodoc: add Python example
Philippe Proulx [Sat, 5 Sep 2015 17:47:13 +0000 (13:47 -0400)] 
doc: add Python example

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Python agent: do not register twice to same port
Philippe Proulx [Sat, 5 Sep 2015 17:38:01 +0000 (13:38 -0400)] 
Fix: Python agent: do not register twice to same port

It is possible that one of the session daemons left its agent.port
file on the file system, for example when killed with SIGKILL. It
is also common that both those session daemons use the same port for
listening to agent connections. In this case, if one session daemon
is running, but two agent.port files exist, the Python agent would
connect its two threads to the same session daemon, leading to
everything done twice: list shows events twice, tracing records
events twice, etc.

This patch ensures that if two agent.port files are found and have
the same content, only one thread is used.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: potential leaks in error paths
Antoine Busque [Tue, 8 Sep 2015 21:33:18 +0000 (17:33 -0400)] 
Fix: potential leaks in error paths

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: double free in liblttng-ust-dl
Antoine Busque [Tue, 8 Sep 2015 21:24:16 +0000 (17:24 -0400)] 
Fix: double free in liblttng-ust-dl

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: make check in OOT build with absolute path
Michael Jeanson [Fri, 4 Sep 2015 21:31:31 +0000 (17:31 -0400)] 
Fix: make check in OOT build with absolute path

The previous patch fixed the out of tree build when the configure script
was called with a path relative to the builddir but still failed when
the path was absolute. This works with both.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: elf: leaks on error paths
Mathieu Desnoyers [Fri, 4 Sep 2015 06:00:09 +0000 (02:00 -0400)] 
Fix: elf: leaks on error paths

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: coding style
Mathieu Desnoyers [Fri, 4 Sep 2015 05:50:56 +0000 (01:50 -0400)] 
Cleanup: coding style

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: elf: use off_t for offsets, size_t for len
Mathieu Desnoyers [Fri, 4 Sep 2015 05:48:58 +0000 (01:48 -0400)] 
Cleanup: elf: use off_t for offsets, size_t for len

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: eliminate implicit sign-extension
Mathieu Desnoyers [Fri, 4 Sep 2015 05:43:31 +0000 (01:43 -0400)] 
Cleanup: eliminate implicit sign-extension

Coverity reported:

CID 1321723 (#1 of 1): Unintended sign extension
(SIGN_EXTENSION)sign_extension: Suspicious implicit sign extension:
elf->ehdr->e_shentsize with type unsigned short (16 bits, unsigned) is
promoted in index * elf->ehdr->e_shentsize to type int (32 bits,
signed), then sign-extended to type unsigned long (64 bits, unsigned).
If index * elf->ehdr->e_shentsize is greater than 0x7FFFFFFF, the upper
bits of the result will all be 1.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: elf: NULL pointer dereference
Mathieu Desnoyers [Fri, 4 Sep 2015 05:35:47 +0000 (01:35 -0400)] 
Fix: elf: NULL pointer dereference

Coverity reported:
CID 1321730 (#1 of 1): Dereference null return value (NULL_RETURNS)15.
dereference: Dereferencing a pointer that might be null _build_id when
calling lttng_ust_read.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add missing ust-elf.h header to dist
Michael Jeanson [Thu, 3 Sep 2015 20:14:41 +0000 (16:14 -0400)] 
Fix: add missing ust-elf.h header to dist

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: make check in out of tree build
Michael Jeanson [Thu, 3 Sep 2015 20:11:38 +0000 (16:11 -0400)] 
Fix: make check in out of tree build

Use the elf data files from the source dir when running make check in an
out of tree builddir and add the data files to dist.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: old gcc warnings
Mathieu Desnoyers [Tue, 1 Sep 2015 17:29:39 +0000 (13:29 -0400)] 
Fix: old gcc warnings

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: old gcc warning
Mathieu Desnoyers [Tue, 1 Sep 2015 16:55:02 +0000 (12:55 -0400)] 
Fix: old gcc warning

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: remove stale lttng-ust-elf.h from makefile
Mathieu Desnoyers [Mon, 31 Aug 2015 22:34:18 +0000 (18:34 -0400)] 
Fix: remove stale lttng-ust-elf.h from makefile

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: elf: uninitialized ret
Mathieu Desnoyers [Mon, 31 Aug 2015 22:25:02 +0000 (18:25 -0400)] 
Fix: elf: uninitialized ret

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: test elf: handle NULL debug file
Mathieu Desnoyers [Mon, 31 Aug 2015 21:27:39 +0000 (17:27 -0400)] 
Fix: test elf: handle NULL debug file

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agotest: elf move constants to top of implementation
Mathieu Desnoyers [Mon, 31 Aug 2015 21:25:07 +0000 (17:25 -0400)] 
test: elf move constants to top of implementation

Declare them static const.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: elf test prog arg checking
Mathieu Desnoyers [Mon, 31 Aug 2015 21:19:20 +0000 (17:19 -0400)] 
Fix: elf test prog arg checking

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agobaddr statedump: remove dependency on file streams
Mathieu Desnoyers [Mon, 31 Aug 2015 20:50:50 +0000 (16:50 -0400)] 
baddr statedump: remove dependency on file streams

None of the rest of UST used by applications use file streams (only the
sessiond uses a file streams for metadata). Therefore, use file
descriptors directly for baddr statedump.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agobaddr statedump: hold ust lock around allocations
Mathieu Desnoyers [Mon, 31 Aug 2015 20:50:03 +0000 (16:50 -0400)] 
baddr statedump: hold ust lock around allocations

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd unit tests for lttng_ust_elf
Antoine Busque [Thu, 30 Jul 2015 20:37:04 +0000 (16:37 -0400)] 
Add unit tests for lttng_ust_elf

This adds unit tests for UST's ELF parser. Also included are test ELF
files for multiple architectures (x86, x86_64, armeb, aarch64_be). The
procedure to generate these test files is described in
`tests/ust-elf/README.md`.

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd memory size, build id, and debug link info to statedump and dl
Antoine Busque [Thu, 2 Jul 2015 15:55:53 +0000 (11:55 -0400)] 
Add memory size, build id, and debug link info to statedump and dl

Implement a minimal ELF parser allowing to compute an executable's
in-memory size and to read its build id and debug link info, if any,
at runtime. This is performed during base address statedump, and on
dlopen when using the `liblttng-ust-dl.so` helper.

This adds a `memsz` field to `lttng_ust_statedump:soinfo` and
`lttng_ust_dl:dlopen`. Also adds two events to both providers,
`build_id` and `debug_link`, which are only traced when the
corresponding information is found in the executable file. They can be
matched with the corresponding `soinfo` or `dlopen` via the `baddr`
field shared amongst all the events. Build ID and debug link are
standard methods of identifying and retrieving debug information
corresponding to a specific version of an executable.

The fields `size` and `mtime` from the existing `soinfo` and `dlopen`
events have been removed as they provided no valuable information for
analysis, whereas build ID or debug link allow unambiguous retrieval
of the debug information, and the on-disk `size` is superseded by the
in-memory `memsz`.

Signed-off-by: Antoine Busque <abusque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: close socket on protocol error, sendmsg MSG_NOSIGNAL
Mathieu Desnoyers [Wed, 26 Aug 2015 22:24:11 +0000 (18:24 -0400)] 
Fix: close socket on protocol error, sendmsg MSG_NOSIGNAL

Don't try to keep interacting with sessiond when a protocol error is
detected at the UST application side: this means we cannot trust the
protocol anymore, so there is no reason for keeping the socket open.
For instance, if the application is exiting and we receive a new stream,
we're effectively not reading the stream data, and we return an error.
Unfortunately, the session daemon may try to send us another command,
but we will try interpreting the stream data as a command, which is
invalid.

Also, use MSG_NOSIGNAL flag in the fds recvmsg, so the session daemon
don't get killed with SIGPIPE when it cannot send to the socket due to
connection closed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: more descriptive error message
Mathieu Desnoyers [Tue, 25 Aug 2015 11:12:51 +0000 (07:12 -0400)] 
Cleanup: more descriptive error message

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add missing ust lock around objd_table_destroy()
Mathieu Desnoyers [Fri, 21 Aug 2015 23:11:56 +0000 (16:11 -0700)] 
Fix: add missing ust lock around objd_table_destroy()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: application exit race with pthread cancel
Mathieu Desnoyers [Mon, 17 Aug 2015 16:50:34 +0000 (09:50 -0700)] 
Fix: application exit race with pthread cancel

Listener threads can be cancelled with ust lock held, which can hang the
following ust cleanup routine, because tracepoint probe unregister needs
to take the ust lock.

Fix this by disabling pthread cancellation for the entire duration of
the ust lock.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: configure layout for python agent detection
Mathieu Desnoyers [Tue, 11 Aug 2015 16:11:57 +0000 (12:11 -0400)] 
Cleanup: configure layout for python agent detection

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoBuild: python agent: use setup.py over autoconf
Jonathan Rajotte [Mon, 10 Aug 2015 18:45:34 +0000 (14:45 -0400)] 
Build: python agent: use setup.py over autoconf

This change provides a valid way of installing the agent. The autoconf
python macro provides the wrong installation path for
python 3 under Debian and Ubuntu due to distro-specific packaging for
python 2.7 and 3.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoBuild: add python interpreter used by python agent if built
Jonathan Rajotte [Mon, 10 Aug 2015 18:45:33 +0000 (14:45 -0400)] 
Build: add python interpreter used by python agent if built

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoDoc: basic lttng ust python agent documentation
Jonathan Rajotte [Mon, 10 Aug 2015 18:45:32 +0000 (14:45 -0400)] 
Doc: basic lttng ust python agent documentation

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoBuild: use AM_PATH_PYTHON to resolve python when building agent
Jonathan Rajotte [Mon, 10 Aug 2015 18:45:31 +0000 (14:45 -0400)] 
Build: use AM_PATH_PYTHON to resolve python when building agent

The agent can be built against a forced python version by exporting
PYTHON environment variable at configure time.

ex:
$ export PYTHON=python3
$ ./configure --enable-python-agent

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoBuild: only check if python exists in path
Jonathan Rajotte [Mon, 10 Aug 2015 18:45:30 +0000 (14:45 -0400)] 
Build: only check if python exists in path

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.041547 seconds and 4 git commands to generate.