lttng-tools.git
3 years agoTests: remove leftover temporary files
Francis Deslauriers [Wed, 2 Jun 2021 19:28:24 +0000 (15:28 -0400)] 
Tests: remove leftover temporary files

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie9249820643158c1572c9ce45507d1cba36bf6f7

3 years agolttng-disable-channel(1): fix typo
Philippe Proulx [Thu, 10 Jun 2021 21:45:29 +0000 (17:45 -0400)] 
lttng-disable-channel(1): fix typo

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I37f733bd48d17f2e6de75038918cabd95375e4e2

3 years agolttng-concepts(7): remove reference to the section it's in
Philippe Proulx [Thu, 10 Jun 2021 14:24:08 +0000 (10:24 -0400)] 
lttng-concepts(7): remove reference to the section it's in

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I09319ec4849e854d6a4881ab7895cffc551be58a

3 years agolttng-concepts(7): fix typo
Philippe Proulx [Thu, 10 Jun 2021 14:23:48 +0000 (10:23 -0400)] 
lttng-concepts(7): fix typo

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ief92d1f4a56f5263a2fed5c70e2b26d660d6d81d

3 years agoBuild fix: build without lttng-ust
Michael Jeanson [Tue, 8 Jun 2021 14:55:19 +0000 (10:55 -0400)] 
Build fix: build without lttng-ust

Add conditionnal inclusion of ust-sigbus to the tests modified by:

  commit e207fe73b58787c6077ec5d49254e12ff1a82b51
  Author: orbea <orbea@riseup.net>
  Date:   Sat May 29 11:07:41 2021 -0700

    build: Add missing DEFINE_LTTNG_UST_SIGBUS_STATE();

    Fixes:

      liblttng-ust-ctl.so: undefined reference to `lttng_ust_sigbus_state'

Change-Id: If4af7ada6d94ee67603156d151575dcc57baad05
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agobuild: Add missing DEFINE_LTTNG_UST_SIGBUS_STATE();
orbea [Sat, 29 May 2021 18:07:41 +0000 (11:07 -0700)] 
build: Add missing DEFINE_LTTNG_UST_SIGBUS_STATE();

Fixes:

  liblttng-ust-ctl.so: undefined reference to `lttng_ust_sigbus_state'

Signed-off-by: orbea <orbea@riseup.net>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I428bdc262168d1701525e024e7580861d2498e2b

3 years agobuild: Pass --no-as-needed directly to the linker
orbea [Thu, 13 May 2021 18:10:56 +0000 (11:10 -0700)] 
build: Pass --no-as-needed directly to the linker

This is not a libtool argument, but rather a linker argument.
GNU libtool will silently ignore arguments it doesn't understand
in many cases while slibtool does not.

Signed-off-by: orbea <orbea@riseup.net>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I55e55f1bb6a5d14d1c81505ceb39beaef84af9e9

3 years agobuild: Use liblttng-sessiond-common.la instead of LIVE
orbea [Thu, 13 May 2021 18:07:58 +0000 (11:07 -0700)] 
build: Use liblttng-sessiond-common.la instead of LIVE

This allow correctly linking live_test with slibtool.

Signed-off-by: orbea <orbea@riseup.net>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie429aa36b817a3d5b22bb4bbe3d21a82c65ffdaa

3 years agobuild: Use liblttng-sessiond-common.la instead of SESSIOND_OBJS
orbea [Thu, 13 May 2021 17:47:06 +0000 (10:47 -0700)] 
build: Use liblttng-sessiond-common.la instead of SESSIOND_OBJS

This allows correctly linking test_session and test_ust_data
with slibtool.

Signed-off-by: orbea <orbea@riseup.net>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5c18187e4185218db337ac3548f0d44fb60501f3

3 years agobuild: Add the liblttng-sessiond-comm.la convenience library
orbea [Thu, 13 May 2021 17:16:58 +0000 (10:16 -0700)] 
build: Add the liblttng-sessiond-comm.la convenience library

This allows correctly linking test_kernel_data with slibtool.

Signed-off-by: orbea <orbea@riseup.net>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib076854dc2a4f0234ad3fb04ea1c3c7c4d4a2b7e

3 years agolttng-concepts(7): add missing "commands" word
Philippe Proulx [Tue, 18 May 2021 14:18:41 +0000 (10:18 -0400)] 
lttng-concepts(7): add missing "commands" word

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib555c944c37b983a40f963ea3597bafeba6c4da2

3 years agoTests: crash: remove redundant directory test
Francis Deslauriers [Thu, 27 May 2021 16:53:12 +0000 (12:53 -0400)] 
Tests: crash: remove redundant directory test

The presence of the `$shm_session_path/ust/pid` path is already tested
a few line above. No need to test it again.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If7da3974a6e03817533f650790e0431346401db5

3 years agoFix: bump minimal urcu dependency to 0.11
Jérémie Galarneau [Wed, 2 Jun 2021 15:52:59 +0000 (11:52 -0400)] 
Fix: bump minimal urcu dependency to 0.11

cds_lfht_destroy is used from within RCU read-side critical sections
which is only allowed for urcu >= 0.10 (see userspace-rcu commit
d0ec0ed2f).

Such uses were introduced as part of the 2.11 release (contemporary to
urcu 0.10).

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I0b513f58eacd9fc345eacfddcc2662ffa367695a

3 years agocondition: buffer usage: validation does not check for ratio and bytes threshold
Jonathan Rajotte [Thu, 4 Feb 2021 20:46:27 +0000 (15:46 -0500)] 
condition: buffer usage: validation does not check for ratio and bytes threshold

Buffer usage condition do not support having both ratio and bytes
threshold set.

Using `!usage->threshold_ratio.set && !usage->threshold_bytes.set` does
not error out for `threshold_ratio.set == 1` and
`usage->threshold_bytes.set == 1`

0 0 : 1
0 1 : 0
1 0 : 0
1 1 : 0

We want to check for a xnor (`usage->threshold_ratio.set == usage->threshold_bytes.set`)

0 0 : 1
0 1 : 0
1 0 : 0
1 1 : 1

We could also do 2 error check one for not set and one validating that
both are not set.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5bfcf43bcaf9687ddf9fdebe5ace4f15bda28261

3 years agoRemove LTTNG_EVENT_RULE_TYPE_KERNEL_FUNCTION
Jonathan Rajotte [Tue, 18 May 2021 18:57:05 +0000 (14:57 -0400)] 
Remove LTTNG_EVENT_RULE_TYPE_KERNEL_FUNCTION

It is not supported for 2.13.

Change-Id: If42b18115cc61da9ee17f281390280b21fdc35a6
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoRemove lttng_event_rule_tracepoint
Jonathan Rajotte [Wed, 12 May 2021 07:20:51 +0000 (03:20 -0400)] 
Remove lttng_event_rule_tracepoint

lttng_event_rule_tracepoint is "exploded" in:
   lttng_event_rule_user_tracepoint
   lttng_event_rule_kernel_tracepoint
   lttng_event_rule_jul_logging
   lttng_event_rule_python_logging
   lttng_event_rule_log4j_logging

On the CLI front, the `--domain` option for the add-trigger is removed
since for each event rule type the domain is implicit based on the type.

`--type` accepts the following:
   kernel
   kernel:tracepoint
   kernel:kprobe
   kernel:uprobe
   syscall
     syscall:entry
     syscall:exit
     syscall:entry+exit
     syscall:*
   kernel:syscall
     kernel:syscall:entry
     kernel:syscall:exit
     kernel:syscall:entry+exit
     kernel:syscall:*
   user
   user:tracepoint
   python
   python:logging
   jul
   jul:logging
   log4j
   log4j:logging
   kprobe
   function

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4a0489f8f2a79a2c967f5d69461bed10f40b8278

3 years agoTest log level for newly introduced event rule type (*_logging, user_tracepoint)
Jonathan Rajotte [Wed, 12 May 2021 05:35:53 +0000 (01:35 -0400)] 
Test log level for newly introduced event rule type (*_logging, user_tracepoint)

This is in prevision to lttng_event_rule_tracepoint removal.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iff251d7540a16a2a9561d834fc464ac1a6be4f84

3 years agoIntroduce lttng_event_rule_python_logging
Jonathan Rajotte [Wed, 12 May 2021 05:10:41 +0000 (01:10 -0400)] 
Introduce lttng_event_rule_python_logging

A following patch will remove lttng_event_rule_tracepoint.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I222bd4f2616efd1b0c0e36cfe5a89cf5416b6a88

3 years agoIntroduce lttng_event_rule_log4j_logging
Jonathan Rajotte [Wed, 12 May 2021 05:01:19 +0000 (01:01 -0400)] 
Introduce lttng_event_rule_log4j_logging

A following patch will remove lttng_event_rule_tracepoint.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie94c172ed9550dd7c3ae9967e353a3d6ac5b5907

3 years agoIntroduce lttng_event_rule_jul_logging
Jonathan Rajotte [Wed, 12 May 2021 03:38:17 +0000 (23:38 -0400)] 
Introduce lttng_event_rule_jul_logging

A following patch will remove lttng_event_rule_tracepoint.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I95f40920b73b5deb42c2e92ad50c43dba0b0e436

3 years agoIntroduce lttng_event_rule_user_tracepoint
Jonathan Rajotte [Wed, 12 May 2021 00:16:51 +0000 (20:16 -0400)] 
Introduce lttng_event_rule_user_tracepoint

A following patch will remove lttng_event_rule_tracepoint.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If814c3ba828e4869cde9af4b9d76c8b830f30654

3 years agoIntroduce lttng_event_rule_kernel_tracepoint
Jonathan Rajotte [Tue, 11 May 2021 23:52:37 +0000 (19:52 -0400)] 
Introduce lttng_event_rule_kernel_tracepoint

A following patch will remove lttng_event_rule_tracepoint.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I614e45be3ef5e41fa081ad24dc1a9dcddb7eb2af

3 years agoRename lttng_event_rule_kernel_probe to lttng_event_rule_kernel_kprobe
Jonathan Rajotte [Tue, 18 May 2021 18:48:37 +0000 (14:48 -0400)] 
Rename lttng_event_rule_kernel_probe to lttng_event_rule_kernel_kprobe

The add trigger command now accepts `kernel:kprobe` instead of `kernel-
probe`. `kprobe` is still accepted.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ifd6753f337e93ea8eb393b8d686596112292c5bb

3 years agoRename lttng_event_rule_userspace_probe to lttng_event_rule_kernel_uprobe
Jonathan Rajotte [Tue, 18 May 2021 17:44:38 +0000 (13:44 -0400)] 
Rename lttng_event_rule_userspace_probe to lttng_event_rule_kernel_uprobe

The `--type` option for add trigger now only support `kernel:uprobe`.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2c4de8e314d6fba735343d21c04fff366b92cca9

3 years agoRename lttng_event_rule_syscall to lttng_event_rule_kernel_syscall
Jonathan Rajotte [Tue, 18 May 2021 16:08:15 +0000 (12:08 -0400)] 
Rename lttng_event_rule_syscall to lttng_event_rule_kernel_syscall

Allow the usage of "kernel:syscall*" as the `--type` argument for add
trigger. A later patch remove the notion of domain.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib5c87ec937bb0acf9c5133532961dcc31e533884

3 years agoRename *emission_site_type to *emission_site
Jonathan Rajotte [Tue, 11 May 2021 23:19:03 +0000 (19:19 -0400)] 
Rename *emission_site_type to *emission_site

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3027affe23de8674a5a813d18643396e3a1474f1

3 years agoRename lttng_event_rule_syscall_(set, get)_pattern to lttng_event_rule_syscall_(set...
Jonathan Rajotte [Tue, 11 May 2021 23:02:45 +0000 (19:02 -0400)] 
Rename lttng_event_rule_syscall_(set, get)_pattern to lttng_event_rule_syscall_(set, get)_name_pattern

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia6d8c55f607cd5af4201a61abaab277994618bb6

3 years agoRename *exclusion* to *name_pattern_exclusion*
Jonathan Rajotte [Tue, 11 May 2021 22:58:05 +0000 (18:58 -0400)] 
Rename *exclusion* to *name_pattern_exclusion*

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic72582dccdc2810dfc07fc66abf776c853d217b6

3 years agoRename lttng_event_rule_tracepoint_(set,get)_pattern to lttng_event_rule_tracepoint_...
Jonathan Rajotte [Tue, 11 May 2021 22:47:31 +0000 (18:47 -0400)] 
Rename lttng_event_rule_tracepoint_(set,get)_pattern to lttng_event_rule_tracepoint_(set, get)_name_pattern

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib018d7ab4fab66842302beef19c0971d704d2d02

3 years agoBuild fix: cygwin: unknown type ssize_t
Jérémie Galarneau [Fri, 28 May 2021 15:36:34 +0000 (11:36 -0400)] 
Build fix: cygwin: unknown type ssize_t

The build fails on cygwin with the following error:

  In file included from actions/path.c:8:
  ../../include/lttng/action/path-internal.h:31:1: error: unknown type name "ssize_t"; did you mean "_ssize_t"?

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I93aac8ef33cfe19b655d80709c9b95a503815bda

3 years agoFix: consumer: unbalanced RCU read-side lock on error
Mathieu Desnoyers [Thu, 27 May 2021 20:45:55 +0000 (16:45 -0400)] 
Fix: consumer: unbalanced RCU read-side lock on error

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I22ddc8585af84d07e8f3d19e9df582599352a1b8

3 years agolttng-enable-event(1): add usage examples
Philippe Proulx [Tue, 25 May 2021 18:56:54 +0000 (14:56 -0400)] 
lttng-enable-event(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6310d753a2fd6db74f4a854a87cda690d3479593

3 years agolttng-{enable,disable}-event(1): document default channel limitation
Philippe Proulx [Tue, 25 May 2021 18:56:15 +0000 (14:56 -0400)] 
lttng-{enable,disable}-event(1): document default channel limitation

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I0b531be8bde9dfd74bb4a28fe70eeef5eeee7f72

3 years agodoc/man: log level prefixes are not required
Philippe Proulx [Tue, 18 May 2021 16:36:29 +0000 (12:36 -0400)] 
doc/man: log level prefixes are not required

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iddd9eaff96ca857b1249421c31b64bec859429c6

3 years agoFix: sessiond: use of uninitialized memory in buffer-usage condition
Francis Deslauriers [Tue, 25 May 2021 21:45:57 +0000 (17:45 -0400)] 
Fix: sessiond: use of uninitialized memory in buffer-usage condition

Issue
=====

valgrind reports the following:
  ==436327== Thread 9 Client manageme:
  ==436327== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s)
  ==436327==    at 0x51E418D: __libc_sendmsg (sendmsg.c:28)
  ==436327==    by 0x51E418D: sendmsg (sendmsg.c:25)
  ==436327==    by 0x20D436: lttcomm_send_unix_sock (unix.c:294)
  ==436327==    by 0x186F08: send_unix_sock (client.c:895)
  ==436327==    by 0x18BAFA: thread_manage_clients (client.c:2800)
  ==436327==    by 0x18147D: launch_thread (thread.c:66)
  ==436327==    by 0x51D8608: start_thread (pthread_create.c:477)
  ==436327==    by 0x5314292: clone (clone.S:95)
  ==436327==  Address 0x7540ec1 is 97 bytes inside a block of size 256 alloc'd
  ==436327==    at 0x483DFAF: realloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==436327==    by 0x1E7556: lttng_dynamic_buffer_set_capacity (dynamic-buffer.c:166)
  ==436327==    by 0x1E72FC: lttng_dynamic_buffer_append (dynamic-buffer.c:55)
  ==436327==    by 0x1DE604: lttng_condition_buffer_usage_serialize (buffer-usage.c:123)
  ==436327==    by 0x1DFF47: lttng_condition_serialize (condition.c:98)
  ==436327==    by 0x20ACD0: lttng_trigger_serialize (trigger.c:328)
  ==436327==    by 0x189EBE: process_client_msg (client.c:2258)
  ==436327==    by 0x18B761: thread_manage_clients (client.c:2742)
  ==436327==    by 0x18147D: launch_thread (thread.c:66)
  ==436327==    by 0x51D8608: start_thread (pthread_create.c:477)
  ==436327==    by 0x5314292: clone (clone.S:95)

This can be reproduce by running the sessiond under valgrind and
launching the following binary to register buffer-usage conditions:
  ./tests/regression/tools/trigger/utils/register-some-triggers test_buffer_usage_conditions

The valgrind report is pointing us toward the `struct
lttng_condition_buffer_usage_comm` stack allocation in the
`lttng_condition_buffer_usage_serialize()` function.

The actual issue is that the threshold_bytes/threshold_ratio will not be
initialized in that structure depending on the way the threshold is
expressed.

Fix
===

Make sure the struct is zeroed at the declaration site.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2046f4e0e1d857cfd1a53e0c13aea55f17adada3

3 years agolttng-ctl: use lttng_action_path to specify error query actions
Jérémie Galarneau [Tue, 25 May 2021 23:17:07 +0000 (19:17 -0400)] 
lttng-ctl: use lttng_action_path to specify error query actions

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I30a93465231ec963d087b25678b6703a0425ceef

3 years agoerror-query: add lttng_action_path to express the location of an action
Jérémie Galarneau [Thu, 20 May 2021 22:50:06 +0000 (18:50 -0400)] 
error-query: add lttng_action_path to express the location of an action

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Icc3056029219cc8f0794b06e7021885e193724be

3 years agotests: Move tap-driver.sh out of the autotools aux directory
Michael Jeanson [Tue, 11 May 2021 14:29:50 +0000 (10:29 -0400)] 
tests: Move tap-driver.sh out of the autotools aux directory

We have made local modifications to this script, move it to the test
suite directory so it doesn't get overwritten by an updated version from
autotools.

Running 'make check' on current RHEL or Fedora without this patch
results in the following error:

  make[5]: Entering directory '/builddir/build/BUILD/lttng-tools-2.12.4/tests/regression'
  tap-driver.sh: invalid option: '--post-script'

Change-Id: I22823176cc5b98901865c9415250ce8e49384cbd
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agolttng-enable-channel(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 21:39:12 +0000 (17:39 -0400)] 
lttng-enable-channel(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I26bcfed2b6d71b0bbc2fa89d33f37925c303c91c

3 years agolttng-view(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:23:59 +0000 (16:23 -0400)] 
lttng-view(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9324b0733ebbaabb824efca4a11330fe3a5c1d0f

3 years agolttng-untrack(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:20:08 +0000 (16:20 -0400)] 
lttng-untrack(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ibafe1662e37110962ae3c7fdef9d450b75f2c0a5

3 years agolttng-untrack(1): follow the style of lttng-track(1) for the example
Philippe Proulx [Mon, 17 May 2021 20:19:49 +0000 (16:19 -0400)] 
lttng-untrack(1): follow the style of lttng-track(1) for the example

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I0c714eb2e504d118cfb3b48bf8e70f33d36d2352

3 years agolttng-track(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:19:09 +0000 (16:19 -0400)] 
lttng-track(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I21a7906626a09b9964fc51dd083f1c2ea5b855c3

3 years agolttng-stop(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:05:40 +0000 (16:05 -0400)] 
lttng-stop(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I6794937457d4f34d649b9edb6a755e091a6af67e

3 years agolttng-start(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:05:30 +0000 (16:05 -0400)] 
lttng-start(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I893a9e26ac69269150cf0a68ec6968cb5fa9bdbf

3 years agolttng-snapshot(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 20:01:05 +0000 (16:01 -0400)] 
lttng-snapshot(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I686f3c8a0e82952a5b673780eef830dea888044d

3 years agolttng-save(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 19:49:59 +0000 (15:49 -0400)] 
lttng-save(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I73d4cd169c37d0dbb99ad965d04acc9eaf8a1856

3 years agolttng-rotate(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 19:46:22 +0000 (15:46 -0400)] 
lttng-rotate(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2ee1a32fd44b6abf6a8d58749f1a42731b30ba56

3 years agolttng-remove-trigger(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 19:44:06 +0000 (15:44 -0400)] 
lttng-remove-trigger(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic34f148f061999b90ad47df8efc5c1db2d07f762

3 years agolttng-regenerate(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 19:35:42 +0000 (15:35 -0400)] 
lttng-regenerate(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I91074dfc717d481fe16ec4f40533757a0b3f3da4

3 years agolttng-load(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:29:07 +0000 (14:29 -0400)] 
lttng-load(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1a4902b1325630c79b8ec121e95874bca1ca8bd6

3 years agolttng-list(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:21:06 +0000 (14:21 -0400)] 
lttng-list(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id52a51f4daeef2266885d25240699ee921bb041b

3 years agolttng-enable-rotation(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:12:16 +0000 (14:12 -0400)] 
lttng-enable-rotation(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I56eafd9e52cd37f48849ddfb82d007c9fb3f3767

3 years agolttng-disable-rotation(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:09:54 +0000 (14:09 -0400)] 
lttng-disable-rotation(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I24f132858c12fa4e99b8a24baee9e8becf0d73f8

3 years agolttng-disable-event(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:05:02 +0000 (14:05 -0400)] 
lttng-disable-event(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I111fbfca2a12517ea6b2f315f4adf0c1b60c37de

3 years agolttng-disable-channel(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:04:53 +0000 (14:04 -0400)] 
lttng-disable-channel(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ia524f1e3f032633670312000f4fc5674c09da498

3 years agolttng-destroy(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:04:43 +0000 (14:04 -0400)] 
lttng-destroy(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If16dcd4197c6af734b1147c9463ae2255b0a1c1f

3 years agolttng-create(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:04:31 +0000 (14:04 -0400)] 
lttng-create(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2371a84eac9310b6725462ea4278d01497c3e7f4

3 years agolttng-clear(1): add usage examples
Philippe Proulx [Mon, 17 May 2021 18:04:21 +0000 (14:04 -0400)] 
lttng-clear(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id410c79fddb88de87edda333bec9ef59b6f5afc9

3 years agolttng-add-trigger(1): DESCRIPTION: move up the link to "EXAMPLES"
Philippe Proulx [Mon, 17 May 2021 18:02:45 +0000 (14:02 -0400)] 
lttng-add-trigger(1): DESCRIPTION: move up the link to "EXAMPLES"

In lttng(1) manual pages, put

    See the <<examples,EXAMPLES>> section below for usage examples.

above references to other manual pages at the bottom of the
"DESCRIPTION" section.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I498a49536d6a876af9a0ed009378d257e483c975

3 years agolttng-add-context(1): EXAMPLES: add internal links to relevant options
Philippe Proulx [Mon, 17 May 2021 18:02:15 +0000 (14:02 -0400)] 
lttng-add-context(1): EXAMPLES: add internal links to relevant options

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I242445993ae85c66074b90078dcd1f8e18cb86db

3 years agolttng-disable-event(1): `--tracepoint` option is not the default
Philippe Proulx [Mon, 17 May 2021 17:57:48 +0000 (13:57 -0400)] 
lttng-disable-event(1): `--tracepoint` option is not the default

I previously thought that not specifying any instrumentation point type
option was equivalent to specifying `--tracepoint`, like with the
`enable-event` command.

It's not the case: `--tracepoint` is just a filter, like `--syscall` and
the others. With `--kernel`, if you don't specify any instrumentation
point type condition option, the `disable-event` command disables
recording event rules regardless of their instrumentation point type.

This patch updates lttng-disable-event(1) to explain this.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I489c5d16dae954f4b5116edce556fdd942c98c4d

3 years agoCleanup: tests: name all temporary files to better identify leakage
Francis Deslauriers [Fri, 14 May 2021 20:04:28 +0000 (16:04 -0400)] 
Cleanup: tests: name all temporary files to better identify leakage

When using a template, we need to add `--tmpdir` to the `mktemp`
arguments to place the tmp files in `/tmp` or `$TMPDIR`.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Id107530578d91700b726ceec016a8cef772e94b0

3 years agoCleanup: tests: use find's `-name` option instead of grep
Francis Deslauriers [Mon, 17 May 2021 19:01:33 +0000 (15:01 -0400)] 
Cleanup: tests: use find's `-name` option instead of grep

This prevents grep of finding matches in the leading directories listed
by find.

It caused problem when I used the "metadata" string in one of the
directory names:
  /tmp/tmp.test_regen_metadata_ust_trace_path.6FbwPF/

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I7165a3b4e4a16c793fe51c40484978be3a99dbfc

3 years agoUpdate version to v2.13.0-rc2 v2.13.0-rc2
Jérémie Galarneau [Sat, 15 May 2021 03:32:57 +0000 (23:32 -0400)] 
Update version to v2.13.0-rc2

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: expected procname should not have -ust suffix
Mathieu Desnoyers [Sat, 15 May 2021 00:57:33 +0000 (20:57 -0400)] 
Fix: expected procname should not have -ust suffix

commit ("Fix: ustcomm: application name uses the '-ust'-suffixed thread
name") in LTTng-UST removes "-ust" suffix from procname, which appears
in the output trace directory hierarchy.

Adapt tests to not expect this quirk.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I96c3944124bbe154875085a37a51ba2bd458f83b

3 years agoFix: Tests: leftover temporary files after tests
Francis Deslauriers [Fri, 14 May 2021 19:45:15 +0000 (15:45 -0400)] 
Fix: Tests: leftover temporary files after tests

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie0c66d45a00e890c1f1e8dc8db7b1baa2cca50f1

3 years agoFix: trigger: abort() when adding `--notify` action with python event rule matches
Francis Deslauriers [Wed, 12 May 2021 15:28:26 +0000 (11:28 -0400)] 
Fix: trigger: abort() when adding `--notify` action with python event rule matches

Issue
=====
Adding the following trigger makes the sessiond abort:
  lttng add-trigger --condition=event-rule-matches --domain=python --action=notify

With the following stacktrace:
  (gdb) bt
  #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  #1  0x00007ffff7a71859 in __GI_abort () at abort.c:79
  #2  0x00000000004a1eeb in event_notifier_error_accounting_register_event_notifier (trigger=0x7fffe0000f50, error_counter_index=0x7fffefffde38) at event-notifier-error-accounting.c:1075
  #3  0x00000000004743e6 in setup_tracer_notifier (state=0x7fffefffe3e8, trigger=0x7fffe0000f50) at notification-thread-events.c:2606
  #4  0x000000000046dacb in handle_notification_thread_command_register_trigger (state=0x7fffefffe3e8, trigger=0x7fffe0000f50, is_trigger_anonymous=false, cmd_result=0x7fffedfdd6e8) at notification-thread-events.c:2751
  #5  0x000000000046d083 in handle_notification_thread_command (handle=0x601460, state=0x7fffefffe3e8) at notification-thread-events.c:3112
  #6  0x00000000004687bd in thread_notification (data=0x601460) at notification-thread.c:710
  #7  0x0000000000486703 in launch_thread (data=0x601550) at thread.c:66
  #8  0x00007ffff7c47609 in start_thread (arg=<optimized out>) at pthread_create.c:477
  #9  0x00007ffff7b6e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

This happens because the LTTNG_DOMAIN_PYTHON domain is not handled by
the switch-case.

Fix
===
Add LTTNG_DOMAIN_PYTHON (all other agent domains) as a fallthrough
LTTNG_DOMAIN_UST.

Note
====
Add a basic test case for python agent.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9971cdad8bbc6adca8f6ba49964483c42a25be7d

3 years agoTests: move `list_triggers_matches_ok` to utils.sh
Francis Deslauriers [Wed, 12 May 2021 15:09:37 +0000 (11:09 -0400)] 
Tests: move `list_triggers_matches_ok` to utils.sh

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4cd3816fa7cbc1032582b2a99f67a3b14222f972

3 years agoTests: Move python test app to `tests/utils/testapp` directory
Francis Deslauriers [Thu, 13 May 2021 01:21:28 +0000 (21:21 -0400)] 
Tests: Move python test app to `tests/utils/testapp` directory

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9bc55c0fc0b8de42157d64884c7e1ee08b800525

3 years agoFix: validate whether event notifiers are supported by UST application
Mathieu Desnoyers [Wed, 12 May 2021 20:05:29 +0000 (16:05 -0400)] 
Fix: validate whether event notifiers are supported by UST application

Considering that lttng-sessiond interacts with older (2.12) applications
as well as 2.13+, it needs not to send event notifiers related commands
to an older UST, because the unknown command will cause the protocol to
become out of sync on the communication socket, because the older
lttng-ust does not know how many bytes must be read when receiving the
unknown command. So even though it can return that the command is
unknown, the communication socket becomes out of sync.

Depends-on: lttng-ust: If048c739dd37147ffb2a54715c2101177d2df4f7
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If9cbc7a7cd6cb957134bf3a2e284ab99ef20e93b

3 years agoFix: ust: keep using lttng-ust-sock-8 and lttng-ust-wait-8 filenames
Mathieu Desnoyers [Wed, 12 May 2021 18:09:00 +0000 (14:09 -0400)] 
Fix: ust: keep using lttng-ust-sock-8 and lttng-ust-wait-8 filenames

Replicate a change from a lttng-ust header for which there is an
internal copy within lttng-tools for building without lttng-ust.

lttng-ust commit 6a359b8a4006 ("Bump LTTNG_UST_ABI version from 8.1 to
9.0") attempted to ensure that a session daemon linked against an old
lttng-ust-ctl (2.12) would not attempt to interact with newer
applications.

This was done by increasing the major ABI version number, but
introducing LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE (set to 8) as
a mean to allow session daemon to accept both major versions 8 and 9.

Unfortunately, changing LTTNG_UST_ABI_MAJOR_VERSION means the filenames
used for communication changed as well, meaning that applications linked
against older lttng-ust 2.12 cannot interact with lttng sessiond linked
against lttng-ust-ctl 2.13, which is unintended.

Therefore, go back to using the previous filenames: lttng-ust-sock-8,
and lttng-ust-wait-8 for communication.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I121c6e5aa13637f13b996dd9e31e06d060b52ca6

3 years agoFix: Handle SIGBUS in sessiond and consumerd
Mathieu Desnoyers [Wed, 7 Oct 2020 20:42:05 +0000 (16:42 -0400)] 
Fix: Handle SIGBUS in sessiond and consumerd

There is an issue with the security model of lib ring buffer (lttng-ust)
vs SIGBUS handling by consumer daemon. We do not handle SIGBUS in the
consumer daemon. An application using ftruncate on a ring buffer shm
could cause the consumer to be killed with SIGBUS.

Wire up SIGBUS handling in the session daemon as well given that it also
uses liblttng-ust-ctl.

This depends on "liblttng-ust-ctl: Implement SIGBUS handling" in
lttng-ust, which extends the API of liblttng-ust-ctl, which requires
the user application to define the TLS sigbus state with
DEFINE_LTTNG_UST_SIGBUS_STATE(). It therefore needs to be introduced in
locked-step between lttng-ust and lttng-tools.

Considering that this change in liblttng-ust-ctl modifies the ABI, it is
done with a major soname version bump of the library, so it is allowed
to break the API.

Depends-on: lttng-ust: I7ade988e3e68a87930fbcee3e14e59c3fb66e755

Fixes: #1284
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I76a91616bd35b21c5e891c8306c73ed5e8725ebb

3 years agoClean-up: rename double 'lttng' prefixed functions
Jérémie Galarneau [Thu, 13 May 2021 19:45:43 +0000 (15:45 -0400)] 
Clean-up: rename double 'lttng' prefixed functions

Rename `lttng_lttng_ust_ctl_flush_buffer` to `lttng_ust_flush_buffer`
since the double prefix is odd, but needed to work-around a clash
with symbols introduced in liblttng-ust-ctl as part of 2.13.

Two functions stubs are not used are removed:
  - lttng_lttng_ust_ctl_get_mmap_read_offset,
  - lttng_lttng_ust_ctl_get_mmap_base.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I9a924f503c7d409ed1a28768d07cbbad9d23f503

3 years agolttng-{enable-event(1),event-rule(7)}: `--filter` is not always avail.
Philippe Proulx [Thu, 13 May 2021 02:59:59 +0000 (22:59 -0400)] 
lttng-{enable-event(1),event-rule(7)}: `--filter` is not always avail.

The `--filter` option of both lttng-enable-event(1) and a common event
rule specification is not available with the Linux kprobe, kretprobe,
and user space probe instrumentation point types.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2cea488359bbe8ac8494d785fe3282419ee66d46

3 years agolttng(1)/lttng-create(1): document `--relayd-path`
Philippe Proulx [Thu, 13 May 2021 02:52:25 +0000 (22:52 -0400)] 
lttng(1)/lttng-create(1): document `--relayd-path`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I83d65e13834593c97e296db2505dc97f6a8e4568

3 years agodoc/man: document `LTTNG_SESSIOND_PATH` env. var. like `--sessiond-path`
Philippe Proulx [Thu, 13 May 2021 02:51:41 +0000 (22:51 -0400)] 
doc/man: document `LTTNG_SESSIOND_PATH` env. var. like `--sessiond-path`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie6ff3f2f1003d506e5d4a351af0f811b4ca8b556

3 years agolttng-save(1): document `--all` option in "SYNOPSIS" and "DESCRIPTION"
Philippe Proulx [Thu, 13 May 2021 02:24:09 +0000 (22:24 -0400)] 
lttng-save(1): document `--all` option in "SYNOPSIS" and "DESCRIPTION"

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I895e2c8277cb8c1b7644f6d8607cd77230706515

3 years agoFix: snapshot path have domain subdir duplicate "ust/ust" or "kernel/kernel"
Jonathan Rajotte [Tue, 1 Dec 2020 17:19:53 +0000 (12:19 -0500)] 
Fix: snapshot path have domain subdir duplicate "ust/ust" or "kernel/kernel"

Observed issue
==============

lttng-ivc observed unexpected path generated for streamed snapshot:

  joraj-alpa/
   test-20190319-120000-20210113-110101/
    snapshot-1-20210113-110102-0/
*     ust/
*      ust/
        pid/
         app-ust-2362198-20210113-110101/
           channel_0
           channel_1
           metadata
           channel_2
           channel_3

"ust" the domain subdir is present two-time instead off only one time.

The same problem is seen for kernel snapshots.

Cause
=====

Based on dissection the problem was introduced by commit
5da88b0f58d7f838068037ea449ddfb25d3e85ad [1]

For snapshots, the consumer output object of the snapshot output and
information is fetched from the *original* consumer output.
(code block around src/bin/lttng-sessiond/cmd.c:4748)

The snapshot consumer output does not contains the necessary information
to populate domain_subdir on copy (domain_subdir is '\0').

This would lead to a len evaluation of 1 for the consumer_path_offset in
setup_channel_trace_path:70. This would end up not "skipping" the "ust"
and "kernel" part of the path.

Solution
========

Part of the solution is to copy the domain_subdir from the original
session consumer output to the snapshot output.

Still, the problem was still present since that now that the
domain_subdir was not "\0", the value was suffixed to the passed
session_path. In the snapshot code path, "ust/" and "kernel/" were
already present in the session_path passed to setup_channel_trace_path.

A quick modification at the caller level in the snapshot code path fixes
the issues once and for all.

Tests
=======

The test suit is augmented for certain key tests to validate the
complete path of a trace.

Path validation is based on crude bash pattern matching.

Known drawbacks
=========
None

References
==========
[1] https://github.com/lttng/lttng-tools/commit/5da88b0f58d7f838068037ea449ddfb25d3e85ad

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie7cd2d5471ee3a942fa511e2f4cab09e3aa499e4

3 years agoFix: error: remove trailing period from error descriptions
Jérémie Galarneau [Tue, 11 May 2021 18:37:02 +0000 (14:37 -0400)] 
Fix: error: remove trailing period from error descriptions

Trailing periods in some error descriptions cause the client to print
two dots at the end of some error messages:

Error: Failed to register trigger: Tracing the kernel requires a root
lttng-sessiond daemon, as well as "tracing" group membership or root
user ID for the lttng client..

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib6522252fb716b1baad3c7416e2db150c614702c

3 years agoMake the subitems array a part of action_work_item
Jérémie Galarneau [Mon, 10 May 2021 19:02:51 +0000 (15:02 -0400)] 
Make the subitems array a part of action_work_item

Make the subitems array a part of action_work_item instead of allocating
it dynamically when a trigger is enqueued for a given action executor.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I474e43ba3ba9267d629d3ce561c8677c90bddf27

3 years agoTest: fix: firing policy name has changed
Jérémie Galarneau [Tue, 11 May 2021 19:52:50 +0000 (15:52 -0400)] 
Test: fix: firing policy name has changed

The firing policy name from "after every" to "every" in 4edabba83. The
tests are adapted to reflect this change.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic563c8ce959a6876e1300079ed236c83072efc58

3 years agolttng-add-trigger(1): add usage examples
Philippe Proulx [Thu, 6 May 2021 20:50:28 +0000 (16:50 -0400)] 
lttng-add-trigger(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iac386141968106e648da67498696ecba9524491e

3 years agolttng-add-context(1): add usage examples
Philippe Proulx [Thu, 6 May 2021 20:50:17 +0000 (16:50 -0400)] 
lttng-add-context(1): add usage examples

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8ce928325a659676210ea9d2647ce7223f9527aa

3 years agolist_triggers.c: replace "after every" -> "every"
Philippe Proulx [Thu, 6 May 2021 20:19:39 +0000 (16:19 -0400)] 
list_triggers.c: replace "after every" -> "every"

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If6121fda5bb6d7cf5c941c1ca134191c72518422

3 years agoFix: add_trigger.c: `goto error` with a wrong UID for `--owner-uid`
Philippe Proulx [Thu, 6 May 2021 20:10:01 +0000 (16:10 -0400)] 
Fix: add_trigger.c: `goto error` with a wrong UID for `--owner-uid`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8650af1f43e8ed8bad58a928cfcdf78d382212f1

3 years agolttng-add-context(1): use a description list to explain `--channel`
Philippe Proulx [Thu, 6 May 2021 19:15:29 +0000 (15:15 -0400)] 
lttng-add-context(1): use a description list to explain `--channel`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie2d701820bf1e086205254c0712fe088c3295b2d

3 years agodoc/man/manpage.xsl: indent the body of formal (example) blocks
Philippe Proulx [Thu, 6 May 2021 19:09:58 +0000 (15:09 -0400)] 
doc/man/manpage.xsl: indent the body of formal (example) blocks

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I184b1bc54728cf0d770bc44f9f0923b9f8724396

3 years agodoc/man: lttng(1) command pages: always include `common-footer.txt`
Philippe Proulx [Thu, 6 May 2021 18:45:26 +0000 (14:45 -0400)] 
doc/man: lttng(1) command pages: always include `common-footer.txt`

The end of an lttng(1) command manual page source now looks like this:

    include::common-lttng-cmd-help-options.txt[]

    include::common-lttng-cmd-after-options.txt[]

    include::common-footer.txt[]

`common-lttng-cmd-after-options.txt` contains the "EXIT STATUS",
"ENVIRONMENT", and "FILES" sections.

`common-footer.txt` begins with the "RESOURCES" section.

This will make it possible to insert an "EXAMPLES" section between
`common-lttng-cmd-after-options.txt` and `common-footer.txt`.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1eee42d7386f4671d9825e9d3e131e54f868ee39

3 years agodoc/man: follow man-pages(7) for section names/order and for "SEE ALSO"
Philippe Proulx [Thu, 6 May 2021 18:14:08 +0000 (14:14 -0400)] 
doc/man: follow man-pages(7) for section names/order and for "SEE ALSO"

Changes, following the "Sections within a manual page" section of
man-pages(7):

* Rename the "ENVIRONMENT VARIABLES" section to "ENVIRONMENT".

* Rename the "COPYRIGHTS" section to "COPYRIGHT".

* Move the "EXIT STATUS" section immediately after the "OPTIONS"
  section.

* Remove the "BUGS" section.

  Such a section indicates known bugs (why would you ever have such
  a section anyway?).

  The "RESOURCES" section now contains the URL of our bug tracker.

* Sort the manual pages by section, and then by name in the "SEE ALSO"
  section.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3d91073ec876efd98dcc723ddf40272c814663dd

3 years agoFix: action-executor: leak of `work_item::subitems` field
Francis Deslauriers [Fri, 7 May 2021 21:44:52 +0000 (17:44 -0400)] 
Fix: action-executor: leak of `work_item::subitems` field

This leak can be reproduced by adding a trigger and looking at the used
memory of the lttng-sessiond process.

Valgrind reports the following leak:
  ==2472== 7,087,968 bytes in 147,666 blocks are definitely lost in loss record 24 of 24
  ==2472==    at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==2472==    by 0x191C37: zmalloc (macros.h:45)
  ==2472==    by 0x195234: action_executor_enqueue_trigger (action-executor.c:913)
  ==2472==    by 0x171AD7: dispatch_one_event_notifier_notification (notification-thread-events.c:4626)
  ==2472==    by 0x171D1E: handle_one_event_notifier_notification (notification-thread-events.c:4715)
  ==2472==    by 0x171DA4: handle_notification_thread_event_notification (notification-thread-events.c:4730)
  ==2472==    by 0x164EA6: handle_event_notification_pipe (notification-thread.c:591)
  ==2472==    by 0x1656C3: thread_notification (notification-thread.c:727)
  ==2472==    by 0x17BD16: launch_thread (thread.c:66)
  ==2472==    by 0x5F086DA: start_thread (pthread_create.c:463)
  ==2472==    by 0x624188E: clone (clone.S:95)

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3d98e3ae18c5b2d7f400407842a7de17716f680c

3 years agolttng: change a few instances of trigger "id" to "name"
Simon Marchi [Tue, 27 Apr 2021 22:00:28 +0000 (18:00 -0400)] 
lttng: change a few instances of trigger "id" to "name"

The term trigger "id" has been changed to trigger "name", these are
leftovers. Fix them.

Change-Id: Ic05925af1cd25917de75a0a4d061324604e5a599
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoChange "event rule hit" to "event-rule matches" in user interface strings
Simon Marchi [Tue, 27 Apr 2021 18:51:08 +0000 (14:51 -0400)] 
Change "event rule hit" to "event-rule matches" in user interface strings

The condition name was changed from "event rule hit" to "event rule
matches", but there are some leftover user-visible strings with the old
name. Fix them.

Change-Id: I619c9265d68ca6bf4a3ac11ef38cabc715b01110
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: relayd: live: data is missing between viewer attach and retry
Jonathan Rajotte [Thu, 6 May 2021 15:14:52 +0000 (11:14 -0400)] 
Fix: relayd: live: data is missing between viewer attach and retry

Observed issue
==============

Data produced between the time a live viewer attach and a viewer
subsequent "polling" is missing from the point of view of the viewer.

Using the following reproducer:

  # A lttng-sessiond is already running
  lttng-relayd -b -vvv > relayd.log 2>&1
  lttng create live --live
  lttng enable-event -u "hello_world:*"
  lttng start

  date
  # Set the "polling" interval at ~30 seconds
  babeltrace2 --retry-duration=30000000 -i lttng-live net://localhost/host/$HOSTNAME/live &
  pid=$!

  # Make sure we are in the retry phase of bt2
  date
  sleep 2

  # Produce events
  # Note here that hello perform a sleep of 1 seconds before generating
  # 10 events to make sure lttng-ust had time to register. A total of
  # 100 events is generated.
  date
  for i in `seq 1 10`; do
   ./hello
  done

  # Here we expect to see 100 events outputted at some point (~18
  # seconds (30 - 2 - 10) from that time).
  # No events are received by babeltrace2.
  date
  sleep 40
  date

  # We retry the same exercise a second time.
  echo "Moving to phase 2"
  date
  for i in `seq 1 10`; do
   ./hello
  done

  # Here data is received correctly.
  date
  sleep 40
  date

  kill $pid
  wait

  lttng destroy live
  pkill lttng-relayd

Cause
=====

At the moment the viewer attach is done, no streams exist. On the
following viewer_get_new_streams (~30 seconds later), streams now exist
since they were allocated lazily following the first application
registration, but LTTNG_VIEWER_SEEK_LAST is used. This essentially
"discards" any events in the stream that happened between the attach
time and the viewer_get_new_stream execution.

Note that the same problem would happen if a new UID (in per-uid mode)
would happen to begin tracing in between viewer retry.

Solution
========

Always use `LTTNG_VIEWER_SEEK_BEGINNING` during
`viewer_get_new_streams`.

Known drawbacks
=========

This does not fix the per-pid problem where an app run and die in between
the viewer retries.

References
==========

https://lists.lttng.org/pipermail/lttng-dev/2021-May/029953.html

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I92fbe6511fb93e31d20922b4eef5c9a221e07716

3 years agoBuild fix: filter-grammar-test: incorrect inclusion flag
Jérémie Galarneau [Thu, 6 May 2021 22:43:44 +0000 (18:43 -0400)] 
Build fix: filter-grammar-test: incorrect inclusion flag

Including src/common causes LTTng files that clash with system headers
to be included before the system headers and breaks the build on
multiple platforms and architectures.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iff7b6e7000d907dc076a467d223c91569b783861

3 years agoTests: fix: test_tp_fail: bail out on non-existing relay daemon
Jérémie Galarneau [Thu, 6 May 2021 19:48:02 +0000 (15:48 -0400)] 
Tests: fix: test_tp_fail: bail out on non-existing relay daemon

Fatal thread errors simulated by the tp_fail test cause the relay
daemon to shutdown. This is unexepected by stop_lttng_relayd_notap
which bails out, causing the test to fail.

We bail-out when the daemon is already dead to catch crashes
during the test suite since a0f8e310.

Use the clean-up variant so that we don't fail the tests for this
expected outcome.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I02e7f35451b3c81e7e808e9ff96b6c824fa8f904

3 years agobuild system: support rotation example
Jonathan Rajotte [Wed, 28 Apr 2021 00:13:13 +0000 (20:13 -0400)] 
build system: support rotation example

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Icf5f88dcc725967b7fda66db6e047cdf18a89f01

3 years agoAdd trigger on event rule matches application example
Jonathan Rajotte [Fri, 14 Feb 2020 23:26:39 +0000 (18:26 -0500)] 
Add trigger on event rule matches application example

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ice78e15aa1f4380925a272def8bcc7ca331c0aa0

3 years agoUpdate the remaining manual pages for LTTng-tools 2.13
Philippe Proulx [Thu, 29 Apr 2021 21:00:07 +0000 (17:00 -0400)] 
Update the remaining manual pages for LTTng-tools 2.13

This patch updates the remaining manual pages for LTTng-tools 2.13.

This patch:

* Improves the consistency of some command descriptions in
  `configure.ac`.

* Adds `common-daemon-cfg.txt` which is a section explaining how to
  configure a daemon (session or relay).

  lttng-sessiond(8) and lttng-relayd(8) include this file.

* Adds `lttng-concepts.7.txt` which is an adapted copy of the
  "Core concepts" section of the online LTTng Documentation.

  This centralizes all the LTTng theory into a single manual page
  instead of having this information split into multiple lttng(1)
  command manual pages.

  Many manual pages now refer to lttng-concepts(7), making it possible
  to cut a lot of text in those.

* Updates existing manual pages to:

  * Have a style and voice which is more consistent with the LTTng
    Documentation (website) for 2.13.

  * Fix various terminology ambiguities.

  * Use more textual variables and lists to explain more complex logic
    and processes.

  * Always use the same pattern to specify the behaviour of an lttng(1)
    command depending on the `SESSION` argument or the `--session`
    option.

  * For the commands which can perform more than one task, list their
    available tasks at the beginning of the "DESCRIPTION" section.

  * For some lttng(1) commands which can operate on all tracing sessions
    (for example, lttng-clear(1) and lttng-destroy(1)), always indicate
    that they target all your Unix user's tracing sessions or, if your
    Unix user is `root`, the tracing sessions of all the Unix users
    within the root session daemon.

  * Clean the "SEE ALSO" sections.

  * Always have "LTTng" in the "NAME" section of a manual page.

  More specifically:

  lttng-create(1):
      * Clarify the tracing session modes.

      * Clarify how the command adds (or not) a snapshot output for a
        snapshot mode tracing session.

      * Specify that `--output=DIR` is equivalent to
        `--set-url=file://DIR`.

  lttng-enable-channel(1):
      Include the `--discard`, `--buffers-uid`, and `--buffers-global`
      options in the "SYNOPSIS" section even if they are the current
      defaults.

  lttng-list(1):
      Explain what this command does exactly using a tree of options
      and arguments.

  lttng-load(1):
      Clarify how LTTng finds tracing session configurations.

  lttng-relayd(8):
      * Document the missing `--group` option.

      * Rework the text in general.

      * Add a daemon configuration section with an INI file example.

      * Add more cross-references between options and equivalent
        environment variables.

  lttng-rotate(1):
      Specify that the `rotate-session` trigger action can also rotate
      a tracing session.

  lttng-save(1):
      Clarify the output path.

  lttng-sessiond(8):
      Add more cross-references between options and equivalent
      environment variables.

  lttng-shapshot(1):
      * Clarify everything related to the snapshot output of a tracing
        session, including when and how the lttng-create(1) command adds
        an initial snapshot output.

      * Specify that the `snapshot-session` trigger action can also take
        a snapshot of a tracing session.

  lttng-track(1):
  lttng-untrack(1):
      * Simply refer to allowing processes to record events and to
        process attribute inclusion sets instead of using the vague
        "tracker" terminology.

      * Restate that those commands control an implicit condition of
        a recording event rule, as per lttng-concepts(7).

      * Improve the documentation of each inclusion set selection
        option.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iac7498ee979fe077f0927a9b8335f6c07f203989

3 years agodoc/man/manpage.xsl: do not indent the title of an admonition block
Philippe Proulx [Mon, 3 May 2021 19:46:51 +0000 (15:46 -0400)] 
doc/man/manpage.xsl: do not indent the title of an admonition block

See the new comment in `manpage.xsl` for more details.

I copied and modified some upstream DocBook XSL (as found in
`xsl/manpages/block.xsl`).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I765ce37957907edb4088a4212c1b12af8b485e60

This page took 0.046743 seconds and 4 git commands to generate.