babeltrace.git
4 years agoctf: make src.ctf.fs append error causes
Simon Marchi [Tue, 13 Aug 2019 15:56:18 +0000 (11:56 -0400)] 
ctf: make src.ctf.fs append error causes

This patch makes the src.ctf.fs plugin code append error causes whenever
an error status is returned.

A few new macros are added to comp-logging.h to support that.

Some functions are called both in component context and component class
context.  When appending error causes, we need to call the
function/macro for the right context.  My solution to this is to pass
both bt_self_component and bt_self_component_class pointers, but expect
only one of them to be set.  The new macro
BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE takes care of calling the right
function for whichever is set.

Change-Id: I8d54f463d9a13066abdc140ef41f374e4daed303
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1966
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoFix: cli: check return value of bt_value_array_append_string_element
Simon Marchi [Sat, 17 Aug 2019 23:29:42 +0000 (19:29 -0400)] 
Fix: cli: check return value of bt_value_array_append_string_element

Found by coverity.

Change-Id: I7830920e70457d8281f57f4447d81fe194399821
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1963
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoFix: ctf: fix possible use-after-free in ctf_fs_component_create
Simon Marchi [Wed, 21 Aug 2019 23:47:32 +0000 (19:47 -0400)] 
Fix: ctf: fix possible use-after-free in ctf_fs_component_create

The error path destroys the ctf_fs_component, but doesn't reset the
variable, so we return a pointer to free'd memory.  We should be
returning NULL in the error case.  Fix it by assigning to NULL after
destroying the ctf_fs_component.

Change-Id: Ib7afd03009dc646460f77fae331920307229220a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1973
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoFix: cli: replace remaining log level `V` (verbose) -> `T` (trace)
Philippe Proulx [Sat, 17 Aug 2019 04:45:52 +0000 (00:45 -0400)] 
Fix: cli: replace remaining log level `V` (verbose) -> `T` (trace)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I0649be8f1121ee145163c026847f1117d965b728
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1958
Tested-by: jenkins <jenkins@lttng.org>
4 years agoFix: sink.ctf.fs: dereference before NULL check
Francis Deslauriers [Fri, 23 Aug 2019 18:38:03 +0000 (11:38 -0700)] 
Fix: sink.ctf.fs: dereference before NULL check

  CID 1404550 (#1 of 1): Dereference before null check (REVERSE_INULL)
  check_after_deref: Null-checking tsdl suggests that it may be null,
  but it has already been dereferenced on all paths leading to the
  check.

Reported-by: Coverity - Dereference before null check (REVERSE_INULL)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I7566cbd74529e93587079d163bb1691e420f723f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1974
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoFix: autodisc: possible use-after-free
Francis Deslauriers [Wed, 21 Aug 2019 17:09:32 +0000 (10:09 -0700)] 
Fix: autodisc: possible use-after-free

Reported-by: scan-build: Memory error Use-after-free
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Icfb8a6640a096369d51ba1c04ce43d043af7af59
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1971
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoFix: sink.utils.counter: possible NULL pointer dereference
Francis Deslauriers [Tue, 20 Aug 2019 03:33:12 +0000 (23:33 -0400)] 
Fix: sink.utils.counter: possible NULL pointer dereference

If the null check at line 148 is true, the `counter` pointer might be
used will be used while being NULL by the
`destroy_private_counter_data()` function.

scan-build report:
  Access to field 'msg_iter' results in a dereference of a null pointer
  (loaded from variable 'counter')

Reported-by: scan-build - Logic error Dereference of null pointer
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I50bb981433ef3f5083613b36bbef54743cddb4c2
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1970
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agosink.ctf.fs: cleanup: duplicated `:` in log statements
Francis Deslauriers [Tue, 20 Aug 2019 03:28:33 +0000 (23:28 -0400)] 
sink.ctf.fs: cleanup: duplicated `:` in log statements

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Id0cc8d4ee400e3615e4a3e231c56c5d7315f7605
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1969
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agoFix: sink.ctf.fs: possible use-after-free
Francis Deslauriers [Tue, 20 Aug 2019 03:21:57 +0000 (23:21 -0400)] 
Fix: sink.ctf.fs: possible use-after-free

Issue
=====
We might use of `trace` pointer after freeing it in the error path.

Solution
========
Move the `fclose()` call (and surroundings) before the `end` label as
the `fh` pointer is only initialized after the only possible `goto end`.

Reported-by: scan-build - Use of memory after it is freed
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8f346b45a76ce976019931f9c63c20dd18a88d86
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1968
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agolib: make g++ happy with plugin-dev.h macros
Simon Marchi [Sun, 18 Aug 2019 16:42:35 +0000 (12:42 -0400)] 
lib: make g++ happy with plugin-dev.h macros

g++ doesn't like the syntax used for assigning structures in the plugin
macros:

  /tmp/babeltrace/include/babeltrace2/plugin/plugin-dev.h:599:3: error: expected primary-expression before ‘.’ token
     .value._attr_name = _x,     \
     ^
  /tmp/babeltrace/include/babeltrace2/plugin/plugin-dev.h:871:2: note: in expansion of macro ‘__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE’
    __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(source_msg_iter_init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_MSG_ITER_INIT_METHOD, _id, _comp_class_id, source, _x)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /tmp/babeltrace/include/babeltrace2/plugin/plugin-dev.h:1356:2: note: in expansion of macro ‘BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_WITH_ID’
    BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  can.cpp:829:1: note: in expansion of macro ‘BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD’
   BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD(CANSource, can_iter_init);
   ^

Changing

    .value._attr_name = _x

to

    .value = { ._attr_name = _x }

makes it work. There are a few instances of this, I changed all I found.

Built-tested with gcc 7.4.0 and clang-9, and verified that a plugin compiled
with g++ 7.4.0 works.

Change-Id: I17cb4edf1082003dc0bb9d0fae906c391daf3da4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1964
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
4 years agobt2: don't show warning when query method raises a non-error exception
Simon Marchi [Fri, 16 Aug 2019 03:05:13 +0000 (23:05 -0400)] 
bt2: don't show warning when query method raises a non-error exception

I noticed that when a Python query raised bt2.UnknownObject, we show
this warning:

W BT2-PY component_class_query@native_bt_component_class.i.h:802 Failed to call Python class's _bt_query_from_native() method: py-cls-addr=0x6190001090a0

In my opinion, a query returning "unknown object" is part of the normal
course of operation, and we should not show a warning.  So, only show it
when the exception gets translated to a status < 0.  Also, append an
error cause while at it in case of error.

Change-Id: I079f67b74df881ab000c6e223667ca72dcd52713
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1952
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agobt_common_parse_lttng_live_url(): don't accept `net://RDHOST/host/TGTHOST`
Philippe Proulx [Sat, 17 Aug 2019 00:02:33 +0000 (20:02 -0400)] 
bt_common_parse_lttng_live_url(): don't accept `net://RDHOST/host/TGTHOST`

This patch makes the bt_common_parse_lttng_live_url() function not
accept LTTng live URLs with the form:

    net[4]://RDHOST[:RDPORT]/host/TGTHOST

This was previously accepted for the session listing feature, but in
fact the `babeltrace` program (Babeltrace 1) only accepts this form:

    net[4]://RDHOST[:RDPORT]

and the list of URLs that the `babeltrace2` program prints with the
first form is invalid.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I68a804c69ec557ed9cc77c9020afbbe2f79a7c43
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1961
Tested-by: jenkins <jenkins@lttng.org>
4 years agosrc.ctf.lttng-live: return unsigned integers in `sessions` query object
Philippe Proulx [Fri, 16 Aug 2019 23:41:46 +0000 (19:41 -0400)] 
src.ctf.lttng-live: return unsigned integers in `sessions` query object

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I1a0f505ee17f5657395d358dfcaa09fdc8e2afa1
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1960
Tested-by: jenkins <jenkins@lttng.org>
4 years agoFix: pass `inputs` parameter to implicit `src.ctf.lttng-live`, not `url`
Philippe Proulx [Fri, 16 Aug 2019 22:06:41 +0000 (18:06 -0400)] 
Fix: pass `inputs` parameter to implicit `src.ctf.lttng-live`, not `url`

Since the `src.ctf.lttng-live` component class started to handle the
`babeltrace.support-info` query object, its component accepts the
`inputs` array parameter, not the `url` string parameter.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I5d74a16c50ba16518a12be9064afd604c456e3fb
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1959
Tested-by: jenkins <jenkins@lttng.org>
4 years agocli: allow map values in --params arguments
Simon Marchi [Thu, 15 Aug 2019 04:00:15 +0000 (00:00 -0400)] 
cli: allow map values in --params arguments

This patch makes it possible to use map values in --params arguments.
For example:

    --params 'a={hi="mlady",mapping={tete="epaule",genou="orteil"}}'

The chosen syntax uses curly braces to delimit the map.  It uses an
equal sign between the key an value, to be consistent with the syntax of
the implicit map at the top-level of `--params` values.

Speaking of which: it's not done in this patch, but it should be
possible to make the new function a bit more generic and re-use it for
parsing the top-level dict of `--params` values.

Change-Id: I1400ff6a2cf6c9132a9c5dd731a462f43225146b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1936
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agotests: add tests for CLI params parsing
Simon Marchi [Thu, 15 Aug 2019 15:17:11 +0000 (11:17 -0400)] 
tests: add tests for CLI params parsing

Add tests that checks various forms of valid parameters passed to the
CLI.

Change-Id: I81eb0ceefb6e4326fa001febbecfee5c66ad18c1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1943
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agocli: exit with error if a plugin fails to load
Simon Marchi [Thu, 15 Aug 2019 00:06:21 +0000 (20:06 -0400)] 
cli: exit with error if a plugin fails to load

The CLI is currently permissive when plugins fails to load, it will
display an error but carry on.  To make it easier for users to catch
configuration and programming problems, this patch changes that be
strict.  If a plugin fails to load (for example, Python syntax error),
the CLI stops and the error is reported to the user.

If this ever becomes a problem (a user would like to carry on even
though some plugin fails to load), we can add a switch like
`--ignore-plugin-loading-error` to have a permissive mode.

Change-Id: Ic89d4e044ecdc34a6e169309479e17bb947ae637
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1937
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agocli: set log levels earlier
Simon Marchi [Wed, 14 Aug 2019 20:47:26 +0000 (16:47 -0400)] 
cli: set log levels earlier

The problem this patch is aiming to solve is that the effective log
level is not set when executing bt_config_convert_from_args.  For
example, bt_python_bindings_bt2_log_level is still NONE, only to be set
later.  So if Python plugin fails to be imported during the auto source
discovery phase, nothing will be logged, making debugging quite
difficult.  Any argument passed (top level --log-level, --debug or
--verbose) won't help because they will take effect later, when we call
set_auto_log_levels.

This patch moves the call to set_auto_log_levels earlier, as soon as we
know what the default log level will be.  For all commands but
`convert`, it is after we are done parsing the top-level arguments.  The
default log level will be the most verbose any --debug, --verbose or
--log-level argument passed.

With the `convert` command, it is possible to pass --debug and
--verbose, with the same effect as the top-level equivalents.  So for
this command, we call set_auto_log_levels just after parsing its
arguments.

The --debug argument sets the log level to TRACE and the --verbose
argument sets it to INFO.  If more than one of --debug, --verbose and
--log-level are specified, the most verbose level of all specified
arguments is chosen.

Note that the --log-level argument of the convert command is not the
same as the top-level's --log-level argument.  The argument of the
convert command sets the --log-level of a specific component or
auto-source-discovery input.

The behavior of the environment variables LIBBABELTRACE2_INIT_LOG_LEVEL,
BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL and
BABELTRACE_PYTHON_BT2_LOG_LEVEL is kept.  If they are specified, they
force the log level of the corresponding subsystem, overriding the
log level specified on the command line.

Change-Id: I9ac558737df4789fc8f5bd8d0240887b3b11b295
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1935
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agocli: return if bt_plugin_find_all_from_dir fails in load_dynamic_plugins
Simon Marchi [Wed, 14 Aug 2019 17:49:51 +0000 (13:49 -0400)] 
cli: return if bt_plugin_find_all_from_dir fails in load_dynamic_plugins

If the call to bt_plugin_find_all_from_dir in load_dynamic_plugins
returns an error (a negative status code), we currently continue
execution as if nothing happened.

This patch makes it so that we exit the loop and report the error to the
caller.

Change-Id: Ib22813b92fe06156cde1681c55651a294cd67909
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1934
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoFix: lib: increment refcount of bt_value_null when copying it
Simon Marchi [Thu, 15 Aug 2019 15:56:14 +0000 (11:56 -0400)] 
Fix: lib: increment refcount of bt_value_null when copying it

Value copy functions must return a new reference.  This is not done for
bt_value_null_copy, which causes refcount imbalance when a null value
gets copied.  A bug caused by this can be triggered with:

    $ git:(3e3535450850) ✗ LIBBABELTRACE2_INIT_LOG_LEVEL=W ~/build/babeltrace/src/cli/babeltrace2 -c src.ctf.fs --params='yo=null,madame=null,la=null'
    ...
    08-15 11:58:25.070  2757  2757 W LIB/VALUE bt_value_null_instance_release_func@value.c:72 Releasing the null value singleton: addr=0x7f070e1fc8e0
    08-15 11:58:25.070  2757  2757 F LIB/VALUE bt_object_put_ref@object.h:367 Babeltrace 2 library precondition not satisfied; error is:
    08-15 11:58:25.070  2757  2757 F LIB/VALUE bt_object_put_ref@object.h:367 Decrementing a reference count set to 0: addr=0x7f070e1fc8e0, ref-count=0
    08-15 11:58:25.070  2757  2757 F LIB/VALUE bt_object_put_ref@object.h:367 Aborting...

Change-Id: I338e6700201892cbe582719bf349041f316d78d8
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1942
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoFix: cli: increment bt_value_null ref count when returning null value
Simon Marchi [Thu, 15 Aug 2019 15:24:24 +0000 (11:24 -0400)] 
Fix: cli: increment bt_value_null ref count when returning null value

The ini_parse_value function returns a new reference to a value.
When return a null value, it needs to acquire a new reference to
bt_value_null to account for that.

A crash can be triggered because of this bug with:

    $ LIBBABELTRACE2_INIT_LOG_LEVEL=W ~/build/babeltrace/src/cli/babeltrace2 -c src.ctf.fs --params='yo=null,madame=null,la=null'
    08-15 11:27:23.947  8793  8793 W LIB/VALUE bt_value_null_instance_release_func@value.c:72 Releasing the null value singleton: addr=0x7fb46d3038e0
    08-15 11:27:23.947  8793  8793 F LIB/VALUE bt_object_put_ref@object.h:367 Babeltrace 2 library precondition not satisfied; error is:
    08-15 11:27:23.947  8793  8793 F LIB/VALUE bt_object_put_ref@object.h:367 Decrementing a reference count set to 0: addr=0x7fb46d3038e0, ref-count=0
    08-15 11:27:23.947  8793  8793 F LIB/VALUE bt_object_put_ref@object.h:367 Aborting...

Change-Id: I6748fd9d8a7ba89728f0e4ddb9ea62bf423fdc91
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1941
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoFix: field-class.c: dereference before `NULL` check
Philippe Proulx [Fri, 16 Aug 2019 18:24:27 +0000 (14:24 -0400)] 
Fix: field-class.c: dereference before `NULL` check

Found by Coverity Scan.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iaf80ac22f38e3a9dc5d09a69ac5729ece7cdd2f3
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1957
Tested-by: jenkins <jenkins@lttng.org>
4 years agoTests: ctf: add basic `metadata-info` query test
Francis Deslauriers [Fri, 16 Aug 2019 15:43:58 +0000 (11:43 -0400)] 
Tests: ctf: add basic `metadata-info` query test

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I1dcd08a024581a078c163cb09a3372bf2a7ce35f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1955
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agobt2: add `StringValue.__contains__()` method
Francis Deslauriers [Fri, 16 Aug 2019 15:43:00 +0000 (11:43 -0400)] 
bt2: add `StringValue.__contains__()` method

This is useful to use the `in` Python operator like we do with regular
Python `str` objects:

  if 'my_env_var' in env_string_value:
    ...

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8f7f5c02d71bc089e14c3b8f2ffa81045a9e8f15
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1954
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 years agocli: "Babeltrace configuration" -> "Babeltrace CLI configuration"
Philippe Proulx [Fri, 16 Aug 2019 16:30:01 +0000 (12:30 -0400)] 
cli: "Babeltrace configuration" -> "Babeltrace CLI configuration"

Make it clear that it's the configuration of the CLI program.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I972a8555f3f0bd8e7f97191a241df50d75349251
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1956
Tested-by: jenkins <jenkins@lttng.org>
4 years agocli: `convert` command: do not allow more than one sink component
Philippe Proulx [Fri, 16 Aug 2019 03:24:12 +0000 (23:24 -0400)] 
cli: `convert` command: do not allow more than one sink component

It's a nonsense to allow more than one component sink because, starting
from the muxer's single output port, there's a chain of components until
it reaches a sink. We don't have any tee filter, so we can't have more
than one sink: the second one won't get connected.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ibec54ae29b64bb0fb8637f1b37131f05abc53b77
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1953
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agocli: make --plugin-path and --omit-{system,home}-plugin-path global opts
Philippe Proulx [Fri, 16 Aug 2019 03:04:06 +0000 (23:04 -0400)] 
cli: make --plugin-path and --omit-{system,home}-plugin-path global opts

This patch makes the `--plugin-path`, `--omit-system-plugin-path`, and
`--omit-home-plugin-path` options global options, in that you must
specify them before the command's name.

For example, this used to work:

    $ babeltrace2 list-plugins --plugin-path=mein-plugins

With this patch it doesn't, as `--plugin-path` must come before the
command name:

    $ babeltrace2 --plugin-path=mein-plugins list-plugins

This change exists because those three options were handled by all five
commands anyway, so there was a lot of code redundancy.

Tests are adapted accordingly. Everything about those three options in
`test_convert_args` is removed as they will never be part of the
`--run-args` output now.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I6169b01c2c3943bc5ba13ff0be68f8f8a1853da2
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1951
Tested-by: jenkins <jenkins@lttng.org>
4 years agoAdd all CLI `convert` command's tests to project's test suite
Philippe Proulx [Fri, 16 Aug 2019 03:03:25 +0000 (23:03 -0400)] 
Add all CLI `convert` command's tests to project's test suite

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ie9b49855198bf37e10257203d6d62919fe68ca39
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1950
Tested-by: jenkins <jenkins@lttng.org>
4 years agoFix: test_convert_args: use correct path to `utils.sh`
Philippe Proulx [Fri, 16 Aug 2019 02:48:38 +0000 (22:48 -0400)] 
Fix: test_convert_args: use correct path to `utils.sh`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iec66644f14468a5cbc931e71fc1ae2f21ddc6497
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1949
Tested-by: jenkins <jenkins@lttng.org>
4 years agolive_viewer_connection_create(): fix leak on connection error
Philippe Proulx [Fri, 16 Aug 2019 00:21:33 +0000 (20:21 -0400)] 
live_viewer_connection_create(): fix leak on connection error

g_free() is not enough here: the `url` member is not freed on error.
Just destroy the whole connection object cleanly.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I98184be066a9155e08d792d55fc4b8489a15bb30
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1946
Tested-by: jenkins <jenkins@lttng.org>
4 years agoFix: bt_common_string_until(): reset returned variable on error
Philippe Proulx [Fri, 16 Aug 2019 00:21:01 +0000 (20:21 -0400)] 
Fix: bt_common_string_until(): reset returned variable on error

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I5675899ea57e52eff8492b7444e2216c97f38ad7
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1945
Tested-by: jenkins <jenkins@lttng.org>
4 years agosrc.ctf.lttng-live: handle `babeltrace.support-info` query object
Philippe Proulx [Fri, 16 Aug 2019 00:05:29 +0000 (20:05 -0400)] 
src.ctf.lttng-live: handle `babeltrace.support-info` query object

This patch makes a `src.ctf.lttng-live` component class handle the
`babeltrace.support-info` query object. The query method replies a
weight of 0.75 (arbitrary, but it leaves some room for other component
classes to recognize this very specific URL format) when the input
string matches

    net://HOST[:PORT]/host/TGTHOST/SESSION

This makes it possible to create a conversion graph with a
`src.ctf.lttng-live` source like this:

    babeltrace2 net://localhost/host/qualinet/pour-un-travail-sans-retouche

Note that this will use the component's default "session not found"
action which is to continue, so the `src.ctf.lttng-live` message
iterator will never end. The legacy mode still works, however; when you
do:

    babeltrace2 -i lttng-live net://localhost/host/tgthost/session

the `convert` command adds the `session-not-found-action=end` parameter.

As such, when you do:

    babeltrace2 -i lttng-live net://localhost/host/tgthost

the `convert` command queries the `sessions` object to list the
available remote tracing sessions.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I73e38df1dfe9bed6d8e31015197a34945af026e5
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1944
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agolib: make empty array/map appending/inserting functions return new object
Philippe Proulx [Fri, 16 Aug 2019 01:01:49 +0000 (21:01 -0400)] 
lib: make empty array/map appending/inserting functions return new object

This makes the bt_value_array_append_empty_array_element(),
bt_value_array_append_empty_map_element(),
bt_value_map_insert_empty_array_entry(), and
bt_value_map_insert_empty_map_entry() accept a new optional output
parameter to return the created empty value object.

The goal of appending/inserting an empty array/map value object is
typically to fill it afterwards, so it makes this less painful, for
example:

    bt_value *inner_arr_obj;

    status = bt_value_array_append_empty_array_element(outer_array_obj,
        &inner_arr_obj);
    assert(status == 0);

    status = bt_value_array_append_bool_element(inner_arr_obj, true);
    assert(status == 0);

    status = bt_value_array_append_string_element(inner_arr_obj, "id");
    assert(status == 0);

You can pass `NULL` as this new parameter.

The returned reference is borrowed.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I2cd3359f357a3eb1da52c0e1426ef7804a4b13aa
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1948
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agolib: rename `BABELTRACE_DISABLE_PYTHON_PLUGINS` -> `LIBBABELTRACE2_...`
Philippe Proulx [Fri, 16 Aug 2019 00:38:15 +0000 (20:38 -0400)] 
lib: rename `BABELTRACE_DISABLE_PYTHON_PLUGINS` -> `LIBBABELTRACE2_...`

This is typically only used for debugging, so change the name to
`LIBBABELTRACE2_DISABLE_PYTHON_PLUGINS`.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I00f54f2a5c1d9abf9f0487ea6d8cd927037f0c0c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1947

4 years agoTests: ctf: add tracers timestamp quirks workaround test cases
Francis Deslauriers [Fri, 21 Jun 2019 20:46:37 +0000 (16:46 -0400)] 
Tests: ctf: add tracers timestamp quirks workaround test cases

This commit adds test traces and test cases to cover the `src.ctf.fs`
workarounds used to support timestamp corner cases or bugs in the
tracers.

Note: I manually modified the test traces to contain problematic
timestamp values using an hex editor as if there would be created by an
affected tracer.

Test traces
===========
* `event-after-packet` lttng test trace
  This trace `event-after-packet` was modified manually to simulate the
  hard to reproduce `event-after-packet` LTTng tracers bug.

  When the bug occurs, the timestamp of the last event of a packet is larger than
  the `timestamp_end` of it's own packet. It makes it look like the event
  happened after the packet was closed which is non compliant with the CTF
  specification.

  To create a trace exhibiting this bug, the `timestamp_end` field of
  the last 2 packets was made one clock cycle smaller than the timestamp
  of the last event of the said packet.

  This bug was fixed in the follow versions of the LTTng tracers:
  - lttng-ust 2.11.0
  - lttng-module 2.11.0
  - lttng-module 2.10.10
  - lttng-module 2.9.13

* `lttng-crash` test trace
  This trace was modified manually to simulate a trace resulting from the
  lttng-crash utility.

  When extracting a trace using the lttng-crash utility the `timestamp_end` of
  some packets may be left uninitialized with the default value of 0.

  To create a trace exhibiting this behavior, the `timestamp_end` of the last
  three packets were set to 0.

  This is _not_ a bug and all LTTng tracers can produce such trace.

* `event-before-packet` barectf test trace
  This trace `event-before-packet` exhibits a barectf bug where the first
  event of the second packet has a timestamp smaller than the
  `timestamp_begin` field of its own packet.

  This bug was fixed in barectf tracer version 2.3.1.

Test cases
==========

* `trace-info` query
  - Add test case for `event-after-packet` LTTng quirk,
  - Add test case for `lttng-crash` workaround.

  Both of this test traces used in these test cases are based on the same
  trace and the end result on the `trace-info` query is the same. We use
  the same code for both test cases.

* Trace decoding
  -Add `test_succeed` cases for all three of the above test traces.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Icfdb8052aa2a88038e22ad6a58f391b6d8dbd3df
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1542
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: decoding: accommodate barectf `event-before-packet` timestamp quirk
Francis Deslauriers [Wed, 26 Jun 2019 22:17:18 +0000 (18:17 -0400)] 
ctf: decoding: accommodate barectf `event-before-packet` timestamp quirk

See prior commit titled:
      src.ctf.fs: index: accommodate bug in barectf tracer
for an explanation of the non-compliance of some barectf traces.

How this commit fixes the decoding for the affected traces
==========================================================
When about to emit a packet beginning message, check if the said packet
might be affected by barectf's `event-before-packet` bug by looking at
the version. If it's the case, delay the emission of the packet
beginning message until we decoded the first event of the packet. We
then check if the event is indeed before the packet.
For affected packets, we create packet beginning message using the
timestamp of the first event.

If there is event in the packet, there is nothing to fix so we emit the
packet beginning message when we are about to emit the packet end
message.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia94e94edef27971c4acf7ab62463c80411ff1978
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1552
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: decoding: accommodate LTTng `event-after-packet` timestamp quirk
Francis Deslauriers [Wed, 26 Jun 2019 22:06:23 +0000 (18:06 -0400)] 
ctf: decoding: accommodate LTTng `event-after-packet` timestamp quirk

See prior commit titled:
  src.ctf.fs: index: accommodate bug in LTTng tracers
for an explanation of the non-compliance of some LTTng traces.

How this commit fixes the decoding for the affected traces
==========================================================
When about to emit a packet end message, check if the said packet is
affect by LTTng's `event-after-packet` bug. If it's the case, omit to
update the default_clock_snapshot to the `timestamp_end` of the packet.
This will expand the packet time span to the contain all its events.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I205caf0243c1d6f270bdb1b6508bb55a0806ba19
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1550
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: decoding: accommodate lttng-crash timestamp quirk
Francis Deslauriers [Wed, 26 Jun 2019 20:04:01 +0000 (16:04 -0400)] 
ctf: decoding: accommodate lttng-crash timestamp quirk

See previous commit titled:
  src.ctf.fs: index: accommodate lttng-crash timestamp quirk
for an explanation of the non-compliance of lttng-crash traces.

How this commit fixes the decoding for the affected traces
==========================================================
When about to emit a packet end message, check if the said packet is
affected by the trace-crash non-compliance. If it's the case, omit to
update the default_clock_snapshot to the `timestamp_end` of the packet.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: If965a424afa160692c2ec148fc8f60d3d9ac1273
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1548
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: index: accommodate lttng-crash timestamp quirk
Francis Deslauriers [Fri, 14 Jun 2019 19:56:50 +0000 (15:56 -0400)] 
ctf: index: accommodate lttng-crash timestamp quirk

This commit is to accommodate the indexing of non-compliant CTF traces
produced by LTTng tracers and extracted by the lttng-crash utility.

What makes those traces non-compliant ?
=======================================
The lttng-crash is used to extract a trace from the tracing buffers from
non-volatile memory following a system crash. Because a system crash can
happen at any time, it's possible that some tracing packets might not
have been closed properly. It's possible to observe this by looking at
the `timestamp_end` field of the packets. They might be left to their
initial value of 0 when their `timestamp_begin` are often larger than 0.

This has the higher level effect that affected packets have a
`timestamp_end` smaller than their `timestamp_begin`, as if their end
time was before the beginning time.

How this commit fixes the index for the affected traces
=====================================================
For each index entry, if the entry's `timestamp_end` is 0 and the
`timestamp_begin` is not 0:
 - If it's the stream file's last packet: set the packet index entry's end
   time to the packet's last event's time, if any, or to the packet's
   beginning time otherwise.
 - If it's not the stream file's last packet: set the packet index
   entry's end time to the next packet's beginning time.

Affected versions
=================
All current and future lttng-ust and lttng-modules versions are affect
because this really cannot be fixed by the tracers because lttng-crash
only tries to make the most of a critical situation (i.e. a system
crash).

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ib6ff9683b676983d8691f514f4d6c3e5c8c7e071
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1436
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: index: set `beginning` and `end` clock snapshot
Francis Deslauriers [Fri, 14 Jun 2019 21:14:41 +0000 (17:14 -0400)] 
ctf: index: set `beginning` and `end` clock snapshot

Currently only the timestamps since origin are set when creating the
index from the stream files.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I3a0cf2c0004deb4a2663cff91932fa33aea9cbb9
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1438
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: index: accommodate bug in barectf tracer
Francis Deslauriers [Fri, 14 Jun 2019 16:46:32 +0000 (12:46 -0400)] 
ctf: index: accommodate bug in barectf tracer

This commit is to accommodate the indexing of non-compliant CTF traces
produced by the barectf tracer.

What makes those traces non-compliant ?
=======================================
A bug in barectf leads to events being emitted with timestamp less than
their packet's `timestamp_begin` field.

At a higher level, such event would appear as before the beginning of
its own containing packet and not within the range of any packet of the
trace.

How this commit fixes the index for the affected traces
=====================================================
For each index entry excluding the first:
  - Decode the packet until the first event and use the timestamp of
    this event as the `timestamp_begin` of this index entry.
  - Set the previous index entry's `timestamp_end` to the
    `timestamp_end` of the current index entry.

Affected versions
=================
  - before barectf 2.3.1

Tracer commit fixing the issue
===============================
barectf master branch: 27bc6f1e6265a0da01d8f1cf2d669f1a1537c47e

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I1e683467bda15d586a063ca9231cc536e143b346
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1435
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: index: accommodate bug in LTTng tracers
Francis Deslauriers [Fri, 14 Jun 2019 13:58:14 +0000 (09:58 -0400)] 
ctf: index: accommodate bug in LTTng tracers

This commit is to accommodate the indexing of non-compliant CTF traces
produced by LTTng tracers.

What makes those traces non-compliant ?
=======================================
A bug in lttng tracers may lead them to emit events with timestamps that
are greater than the timestamp_end of the their packets.

At a higher level, such event would appear as not within the range of a
packet in the trace.

How this commit fixes the index for the affected traces
=======================================================
For each index entry:
 - If it's the stream file's last packet: set the packet index entry's end
   time to the packet's last event's time by decoding the packet, if
   any, or to the packet's beginning time otherwise.
 - If it's not the stream file's last packet: set the packet index
   entry's end time to the next packet's beginning time.

Affected versions
=================
  - before lttng-ust 2.11.0
  - before lttng-module 2.11.0
  - before lttng-module 2.10.10
  - before lttng-module 2.9.13

Tracer commits fixing the issue
===============================
LTTng-UST master branch: 6c737d0594cac0d969e1948ea1ed55c15be9cec8
LTTng-Modules master branch: 2485a4307679e11711443483a5eb307639f955ed
LTTng-Modules stable-2.10 branch: a1817dcb28265d0f8db10c6bbe98fe8db2c53a8a
LTTng-Modules stable-2.9 branch: 266cef247ceb5d1b4d266a987b8bfcc53d8965ca

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I4c93d05a4e3f85b70657561e9a89cfa2542d49b8
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1420
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: add weak ref to stream file in index entry
Francis Deslauriers [Fri, 14 Jun 2019 16:23:36 +0000 (12:23 -0400)] 
ctf: add weak ref to stream file in index entry

This will be useful to create `bt_msg_iter` without having access to the
`ctf_fs_ds_file_info` struct owning the path to the stream file.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ie7173af60330b601bd755822198ed650e3b9b9b4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1434
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: add tracer version extraction function
Francis Deslauriers [Wed, 12 Jun 2019 19:58:20 +0000 (15:58 -0400)] 
ctf: add tracer version extraction function

This commit adds a utility function to extract tracer version of a given
trace.

Because, it was discovered that some tracers may produce non-compliant
CTF traces more-or-less frequently. To accommodate those external tools,
we will add ad-hoc fixes for the affected version. We thus need a way to
check the tracer versions of the traces.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I67e73a5928dfac0cebc1135552f5525af930ebfc
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1418
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: msg-iter: add event timestamp accessors
Francis Deslauriers [Fri, 14 Jun 2019 13:44:41 +0000 (09:44 -0400)] 
ctf: msg-iter: add event timestamp accessors

Adds functions to extract the timestamp of the first and last event of
the current packet.
  BT_HIDDEN
  enum bt_msg_iter_status bt_msg_iter_first_event_clock_snapshot(
         struct bt_msg_iter *notit, uint64_t *first_event_cs);

  BT_HIDDEN
  enum bt_msg_iter_status bt_msg_iter_last_event_clock_snapshot(
         struct bt_msg_iter *notit, uint64_t *last_event_cs);

Those functions use the `decode_until_state()` function to decode the
current packet until one of two specific states and then used the clock
value of the default clock class.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I18736151fd8367fb33c6b46d81a860f54432ad55
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1432
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: msg-iter: extract func to decode packet until specific states
Francis Deslauriers [Fri, 14 Jun 2019 13:34:28 +0000 (09:34 -0400)] 
ctf: msg-iter: extract func to decode packet until specific states

This now generic function will be used by future commits needing to
decode packet until after the first or last event of a packet.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I34d86c078e2e512c5491eed978ecc4cc8adcb3a8
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1431
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: introduce dry-run mode for `bt_msg_iter`
Francis Deslauriers [Wed, 12 Jun 2019 18:15:42 +0000 (14:15 -0400)] 
ctf: introduce dry-run mode for `bt_msg_iter`

Dry-run mode can be used when component classes need to decode CTF
packets but do not want the `bt_msg_iter` to create and use the
Babeltrace library objects (bt_field, bt_message_*, etc.).

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I336ec4c893835e7b1d6f32262841793f7543aa06
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1417
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoctf: only reset state of `bt_msg_iter` on _reset()
Francis Deslauriers [Wed, 12 Jun 2019 17:28:32 +0000 (13:28 -0400)] 
ctf: only reset state of `bt_msg_iter` on _reset()

The `bt_msg_iter` configuration should be left untouched by the reset.

The `bt_msg_iter_reset()` is used at the creation of the `bt_msg_iter`
(`bt_msg_iter_create()`) and when seeking with it
(`bt_msg_iter_seek()`). It's also used by `src.ctf.fs` message iterators
when seeking is done.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I2ab948858aa5b955a3063174c9887c54d98bad5d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1416
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agolib: remove unneeded `enum` tags in public headers
Philippe Proulx [Thu, 15 Aug 2019 02:27:14 +0000 (22:27 -0400)] 
lib: remove unneeded `enum` tags in public headers

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If63cd9599deeee84e599ba055db477c4011e1db1
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1933
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agolib: assign values to all public enumerators
Philippe Proulx [Wed, 14 Aug 2019 19:03:17 +0000 (15:03 -0400)] 
lib: assign values to all public enumerators

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I18db5294b67335504d303ea57e1214d8dc5f76ee
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1932
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agolib: standardize status of bt_util_clock_cycles_to_ns_from_origin()
Philippe Proulx [Wed, 14 Aug 2019 19:02:50 +0000 (15:02 -0400)] 
lib: standardize status of bt_util_clock_cycles_to_ns_from_origin()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ibfe6f7e345f838503b94140e30ec7a7b35866595
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1931
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agolib: graph.h: fix formatting
Philippe Proulx [Wed, 14 Aug 2019 18:50:11 +0000 (14:50 -0400)] 
lib: graph.h: fix formatting

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Idef225fc3c580bf9f90bd77b3e0a88c7a76267df
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1930
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agolib: remove unused `enum bt_self_component_port_status`
Philippe Proulx [Wed, 14 Aug 2019 18:49:00 +0000 (14:49 -0400)] 
lib: remove unused `enum bt_self_component_port_status`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I8c1554a4408d63e6501fa6d0c2dd5caaf4c0799d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1929
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agolib: rename bt_value_array_get_size() -> bt_value_array_get_length()
Philippe Proulx [Wed, 14 Aug 2019 18:46:36 +0000 (14:46 -0400)] 
lib: rename bt_value_array_get_size() -> bt_value_array_get_length()

"Length" is in line with the field terminology
(bt_field_array_get_length()).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Icbb468c0f6d74cba2c5f2f25559981eedec33c5d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1928
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agobt2: rename `_Trace.env` -> `_Trace.environment`
Philippe Proulx [Wed, 14 Aug 2019 15:07:34 +0000 (11:07 -0400)] 
bt2: rename `_Trace.env` -> `_Trace.environment`

This matches the library functions.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I20c8ff4f69ad1a6fcce19203374c0ffc7d413009
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1927
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agobt2: add user attributes property support
Philippe Proulx [Wed, 14 Aug 2019 07:18:56 +0000 (03:18 -0400)] 
bt2: add user attributes property support

This patch adds user attributes property support to the appropriate
`bt2` objects to wrap the equivalent library functions.

The following objects now have a read-only `user_attributes` property
which returns a map value object:

* `_ClockClass`
* `_EventClass`
* `_FieldClass`
* `_Stream`
* `_StreamClass`
* `_StructureFieldClassMember`
* `_Trace`
* `_TraceClass`
* `_VariantFieldClassOption`

You can set the user attributes of those objects at creation time, when
calling the creation method, or when appending a structure field class
member or a variant field class option for `_StructureFieldClassMember`
and `_VariantFieldClassOption`.

To make the `_user_attributes` property of `_StructureFieldClassMember`
and `_VariantFieldClassOption` above possible, I made them wrap a real
BT pointer and keep a reference on the owning field class, making all
the properties make a call to the library instead of the object just
containing them.

In `test_field_class.py`, because there's now a common property to test
for each field class, the new `_TestFieldClass` mixin does that,
requiring a _create_default_field_class() method which accepts custom
positional and keyword arguments to create a specific default field
class to test.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I1d58f1b386e4a367f038f1dda9c2e58738794a66
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1923
Tested-by: jenkins <jenkins@lttng.org>
4 years agosink.text.details: print user attributes
Philippe Proulx [Wed, 14 Aug 2019 17:34:10 +0000 (13:34 -0400)] 
sink.text.details: print user attributes

This patch makes a `sink.text.details` component print user attributes.

The component only prints user attributes when the map value is not
empty.

The output looks like this:

    Event class (ID 0):
      User attributes:
        domain: Python
        ip: Length 4:
          [0]: 192
          [1]: 168
          [2]: 0
          [3]: 100
        weight: 17.231600
        with-net: Yes
      ...

The new write_value() function textually and recursively serializes a
value object. When writing a map value object, the keys are sorted
first.

The change brought by this patch is not invasive in that all the current
test expectation files do not need any change because the sources never
set any user attribute. The goal of this patch is not to add any textual
noise.

When an enumeration, a structure, or a variant field class has user
attributes, the component prints the mappings, members, and options
indented within a dedicated section, for example:

    Payload field class: Structure (3 members):
      User attributes:
        a: 23
        b: 'log'
      Members:
        hello: String
        bbb: Boolean
        opt: Option:
          Content: Unsigned integer (64-bit, Base 10)

The same strategy applies to structure field class members and variant
field class options:

    Payload field class: Structure (3 members):
      hello:
        Field class: String
        User attributes:
          factor: 17.150000
      bbb: Boolean
      opt: Option:
        Content: Unsigned integer (64-bit, Base 10)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Icf3060dbf23bab607ebb7af6e839aa5b28bd2658
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1926
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agoflt.lttng-utils.debug-info: copy user attributes
Philippe Proulx [Wed, 14 Aug 2019 15:31:56 +0000 (11:31 -0400)] 
flt.lttng-utils.debug-info: copy user attributes

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I757acc00be498e1ba82e6255f1d2b85ef9a2059c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1925
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agolib: add user attributes property to metadata, stream, and trace objects
Philippe Proulx [Wed, 14 Aug 2019 03:21:46 +0000 (23:21 -0400)] 
lib: add user attributes property to metadata, stream, and trace objects

This patch adds an optional user attributes property to the following
trace IR objects:

* Clock class
* Event class
* Field class
* Structure field class member
* Variant field class option
* Stream class
* Stream
* Trace class
* Trace

A user attributes object is a map value object which adds custom
information to any of the objects above. It is entirely up to the user
to set user attributes. At creation time, all the objects above contain
an initial, empty map value.

CTF 2 will very likely have such user attributes for metadata objects,
so Babeltrace 2.0 will be ready.

For CTF 2, it is intended that user attributes will be namespaced to
reduce or eliminate clashes, for example using URLs or domain names,
which are also typically used for Java packages and XML namespaces:

    {
        "https://lttng.org": {
            "some-attribute": true
        }
    }

CTF 2 will only have user attributes for metadata objects, but I decided
to also have user attributes for long-lived data objects: streams and
traces.

This is not enforced in Babeltrace however: the user is free to put
whatever she needs into this map value.

There's a bt_*_set_user_attributes() function to set the user attributes
of an object and
bt_*_borrow_user_attributes()/bt_*_borrow_user_attributes_const()
functions to borrow them from the object.

This patch changes when structure field class members and variant field
class options are frozen:

Before this patch:
    When you append to a structure/variant field class, the
    member/option is frozen, including its field class.

With this patch:
    When you append to a structure/variant field class, the
    member/option itself is not frozen, but its field class is.

    The member/option is frozen when its containing structure/variant
    field class is frozen.

This makes it possible to append a member/option to a structure/variant
field class, borrow that member/option, and then set its user attributes
before the whole structure/variant field class is frozen.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ibb12de23fb2c4d752b13381769d2ac1841eb5dc9
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1922
Tested-by: jenkins <jenkins@lttng.org>
4 years agolib: trace-class.c: use `LIB/TRACE-CLASS` logging tag
Philippe Proulx [Wed, 14 Aug 2019 03:09:01 +0000 (23:09 -0400)] 
lib: trace-class.c: use `LIB/TRACE-CLASS` logging tag

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ic453ab3887cc750495367537f2957ef87015ea70
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1921
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agolib: add bt_field_class_variant_borrow_option_by_{index,name}()
Philippe Proulx [Wed, 14 Aug 2019 02:01:03 +0000 (22:01 -0400)] 
lib: add bt_field_class_variant_borrow_option_by_{index,name}()

Those are non-const versions of the existing
bt_field_class_variant_borrow_option_by_index_const() and
bt_field_class_variant_borrow_option_by_name_const().

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I322c202c35d815012d2f6de494dce76a161692e4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1920
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agobt2: rename `_Field.field_class` -> `_Field.cls`
Philippe Proulx [Wed, 14 Aug 2019 00:08:57 +0000 (20:08 -0400)] 
bt2: rename `_Field.field_class` -> `_Field.cls`

This makes it match what we have for the class of an event object, the
class of a stream object, and the class of a trace object (`cls`
properties).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I5dd6f837a7f79b05ca933cd30bd281da2fbe5728
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1919
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agobt2: add bit array field class and field support
Philippe Proulx [Tue, 13 Aug 2019 23:35:12 +0000 (19:35 -0400)] 
bt2: add bit array field class and field support

This patch adds bit array field class and field support to the Python
bindings.

A bit array field class has a `length` property (number of bits in the
array).

As of this patch, a bit array field is not a Python sequence. It could
become in the future however. The way to access a bit array field's
value is the `value_as_integer` property which simply wraps the
corresponding library functions.

A bit array field is not considered a numeric field. Its _spec_eq()
method only compares if the other object is also a bit array fields.

I did not implement the __bool__() operator because it will need to
satisfy the Python sequence protocol (length is not 0, which in fact is
always the case with a bit array field), should we decide as such in the
future. I implemented the __len__() operator however which is
straightforward.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I2e90e1444151bf5169a8df70c53664096cceb6c4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1918
Tested-by: jenkins <jenkins@lttng.org>
4 years agosink.ctf.fs: write bit array field classes and fields
Philippe Proulx [Tue, 13 Aug 2019 23:09:25 +0000 (19:09 -0400)] 
sink.ctf.fs: write bit array field classes and fields

This patch makes a `sink.ctf.fs` component handle bit array field classes
and fields. Because CTF 1.8 has no bit array field class type, it makes a
best effort and translates it to an unsigned integer field class with
a hexadecimal base.

When a `src.ctf.fs` component reads a trace generated by `sink.ctf.fs`
where the input trace IR contained bit array field classes, the
corresponding unsigned integer field classes will stay unsigned integer
field classes; the source component has no way to determine if the
metadata describes a bit array field class or a genuine unsigned integer
field class. However, the CTF 1.8 to CTF 1.8 scenario will always be
unambiguous because a `src.ctf.fs` component never creates bit array
field classes.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I6375723d8513b06f984dc27f88d3d9b668191d21
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1911
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agosink.text.details: print bit array field classes and fields
Philippe Proulx [Tue, 13 Aug 2019 22:57:41 +0000 (18:57 -0400)] 
sink.text.details: print bit array field classes and fields

The component prints bit array fields as unsigned integer fields with a
forced hexadecimal base.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If97e1f05161377c6f8fa3d56e87ad2cc10cb32e2
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1910
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agosink.text.pretty: print bit array fields
Philippe Proulx [Tue, 13 Aug 2019 22:49:14 +0000 (18:49 -0400)] 
sink.text.pretty: print bit array fields

The compoent prints bit array fields as an unsigned integer (hexadecimal
base).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I89b9cadb4b8f0d87d3d547450232321010852e98
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1909
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agoflt.lttng-utils.debug-info: copy bit array field class and field objects
Philippe Proulx [Tue, 13 Aug 2019 22:43:18 +0000 (18:43 -0400)] 
flt.lttng-utils.debug-info: copy bit array field class and field objects

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iffb2083c21e57229e506577ab214cf6d8fc2da46
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1908
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agolib: add bit array field class and field types
Philippe Proulx [Tue, 13 Aug 2019 21:34:02 +0000 (17:34 -0400)] 
lib: add bit array field class and field types

This patch adds the bit array field class (FC) and field to the
available library types.

A bit array field is a simple array of bits. As opposed to integer
fields, a bit array field has no sign: it does not contain a quantity.
Such a field can be used to hold CPU register values, for example, or an
array of flags which is typically read and written as a (small) unsigned
integer.

CTF 2 will very likely have such a type, so Babeltrace 2.0 will be
ready.

You create a bit array FC with bt_field_class_bit_array_create(). This
function expects a length parameter which must be in the [1, 64] range
as of this version. The length is the number of bits in the array. You
can get the length of a bit array with
bt_field_class_bit_array_get_length().

You can set the value of a bit array field with
bt_field_bit_array_set_value_as_integer(). This function accepts an
unsigned integer and conceptually sets all the bits of the array
accordingly, where the _first_ bit of the array is the LSB of the value.
In other words, should there be a bit accessor (by index), getting the
value of bit 0 would return the LSB of that unsigned integer:

    0  1  1  0  1  1  0  1
    ^ MSB: bit 7         ^ LSB: bit 0

    Unsigned integer value: 0x6d

As such, you can get the value of the bit array with
bt_field_bit_array_get_value_as_integer(). Again, the value of bit 0 is
the LSB of the returned unsigned integer.

I chose to apply a mask to the received value in
bt_field_bit_array_set_value_as_integer() to ensure that there's no set
bit outside the bit array's range. This is to lessen the user's burden
instead of a having a precondition assertion. This in turns guarantees
that bt_field_bit_array_get_value_as_integer() always returns a value
without superfluous set bit. If this automatic masking becomes a
performance issue in the future, then we can add another function which
expects the user to do it (with a precondition assertion).

This patch does not adapt existing plugins and the Python bindings to
use and wrap the new bit array FC and field; this work is reserved for
subsequent patches.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I8ba4d111df275962cfa9f2c4f754f83a1de40e29
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1907
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agobt2: add option field class and field support
Philippe Proulx [Tue, 13 Aug 2019 15:58:10 +0000 (11:58 -0400)] 
bt2: add option field class and field support

This patch adds option field class and field support to the Python
bindings.

You can create an option field class with
_TraceClass.create_option_field_class(). This method requires the
optional field class and also accepts an optional selector field class
(just like the library's equivalent bt_field_class_option_create()
function).

An option field class only has the `field_class` (the optional field
class) and `selector_field_path` (can be `None`) properties.

An option field is similar to a variant field:

* You can use the `has_field` property to set whether or not the option
  field has an optional field.

* You can access the optional field with the `field` property, which
  returns `None` when the option field has no field.

* The __bool__() operator of an option field is the equivalent of the
  `has_field` property.

* You can use the `value` property (write only, like
  `_VariantField.value`) to assign a value to the optional field. This
  property also sets `has_field` to `True` so it's always safe to use.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I90aa9ef2dbcb7422ee25aaeb191a18fd9fa4998b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1902
Tested-by: jenkins <jenkins@lttng.org>
4 years agosink.ctf.fs: write option field classes and fields
Philippe Proulx [Tue, 13 Aug 2019 00:16:09 +0000 (20:16 -0400)] 
sink.ctf.fs: write option field classes and fields

This patch makes a `sink.ctf.fs` component handle option field classes
and fields. Because CTF 1.8 has no option field class type, it makes a
best effort and translates it to a variant field class with two
options:

* An empty structure field class (option field contains nothing).
* The optional field class itself.

The tag field class is always generated before the variant field class
and is an 8-bit unsigned enumeration field class.

For example, a `sink.ctf.fs` component would translate an optional
string field class to:

    /*
     * This enumeration field class and the following variant field
     * class were a trace IR option field class.
     */
    enum : integer { size = 8; align = 8; } {
        none = 0,
        content = 1,
    } __module_name_tag;
    variant <__module_name_tag> {
        struct { } none;
        string { encoding = UTF8; } content;
    } module_name;

When a `src.ctf.fs` component reads a trace generated by `sink.ctf.fs`
where the input trace IR contained option field classes, the
corresponding variant field classes will stay variant field classes; the
source component has no way to determine if the metadata describes an
option field class or a genuine variant field class. However, the CTF
1.8 to CTF 1.8 scenario will always be unambiguous because a
`src.ctf.fs` component never creates option field classes.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ib83e011f73795d70cd8545f55ea87e0bf10b68bc
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1901
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agosink.text.details: use write_none_prop_value() for empty array fields
Philippe Proulx [Wed, 14 Aug 2019 00:15:01 +0000 (20:15 -0400)] 
sink.text.details: use write_none_prop_value() for empty array fields

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I6d6eb3575f0fa4f77096d1def57d46b5e5c40b48
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1917
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agosink.text.details: print option field classes and fields
Philippe Proulx [Mon, 12 Aug 2019 22:25:17 +0000 (18:25 -0400)] 
sink.text.details: print option field classes and fields

The component prints `None` when there's no current optional field.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iaa0634ce6806508fa8b07fc70e0e021af9363b8d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1900
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agosink.text.pretty: print option fields
Philippe Proulx [Mon, 12 Aug 2019 22:15:04 +0000 (18:15 -0400)] 
sink.text.pretty: print option fields

The component prints `<none>` when there's no current optional field,
and does the same as a variant field otherwise (printing the optional
field's value between `{` and `}`).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I7a42ca31d68562fa0994945b32dbb2935aa92ee4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1899
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agoflt.lttng-utils.debug-info: copy option field class and field objects
Philippe Proulx [Mon, 12 Aug 2019 22:11:31 +0000 (18:11 -0400)] 
flt.lttng-utils.debug-info: copy option field class and field objects

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I3451d3071655b4759c365adf9ff9c0ddd53425ba
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1898
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agolib: add option field class and field types
Philippe Proulx [Mon, 12 Aug 2019 21:09:38 +0000 (17:09 -0400)] 
lib: add option field class and field types

This patch adds the option field class (FC) and field to the available
library types.

An option field can contain or not another field. It is very similar to
a variant field in that it's a choice between two things.

CTF 2 will very likely have such a type, so Babeltrace 2.0 will be
ready.

Like a variant FC, an option FC can have a selector which must be a
reachable boolean FC.

When you create an option with bt_field_class_option_create(), you pass
the optional FC, which becomes frozen on success.

You can borrow the optional FC of an option FC with
bt_field_class_option_borrow_field_class_const(). If the option FC has a
selector FC, you can borrow the computed selector field path with
bt_field_class_option_borrow_selector_field_path_const().

To set whether or not an option field contains a field, call
bt_field_option_set_has_field(). You must call this function even if the
option field contains no field (with `BT_FALSE`) because field objects
are pooled and not reset for each message in production mode (similar to
how you must initially call bt_field_string_clear() before you call
bt_field_string_append()). Once you have called
bt_field_option_set_has_field() with `BT_TRUE`, you can borrow the
optional field with bt_field_option_borrow_field() to fill it.

On the const side, you can borrow an option field's optional field with
bt_field_option_borrow_field_const(). This function returns `NULL` if
the option field does not contain a field.

This patch also adds the
`BT_FIELD_PATH_ITEM_TYPE_CURRENT_OPTION_CONTENT` field path item type.
Such a field path item means the current field of an option field.

This patch does not adapt existing plugins and the Python bindings to
use and wrap the new option FC and field; this work is reserved
for subsequent patches.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ie76312a53affe8343dd058bd4c38cd9a6074c4d7
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1897
Tested-by: jenkins <jenkins@lttng.org>
4 years agobt2: add boolean field class and field support
Philippe Proulx [Mon, 12 Aug 2019 02:04:08 +0000 (22:04 -0400)] 
bt2: add boolean field class and field support

This patch adds boolean field class and field support to the Python
bindings.

A boolean field class has no properties.

A boolean field is a numeric field (like Python's `bool` is a numeric
type). The `BoolFieldTestCase` test case inherits `_TestNumericField`,
making sure the field behaves more or less like the Python `bool` type.
`BoolFieldTestCase` is very similar to `BoolValueTestCase`.

Just like `BoolValue` objects, you can set the value of a `BoolField`
object from a `bool` or `BoolField` object.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ib6d0723d69709b7f3b459ba173eb7cbea5d8c435
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1896
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agosink.ctf.fs: write boolean field classes and fields
Philippe Proulx [Sun, 11 Aug 2019 16:03:55 +0000 (12:03 -0400)] 
sink.ctf.fs: write boolean field classes and fields

This patch makes a `sink.ctf.fs` component handle boolean field classes
and fields. Because CTF 1.8 has no boolean field class type, it makes a
best effort and translates it to an 8-bit unsigned integer field class.
A boolean field is written as an 8-bit unsigned integer field having the
value 0 (false) or 1 (true).

When a `src.ctf.fs` component reads a trace generated by `sink.ctf.fs`
where the input trace IR contained boolean field classes, the 8-bit
unsigned integer field classes will stay integer field classes; the
source component has no way to determine if the metadata describes a
boolean field class or a genuine integer field class. However, the CTF
1.8 to CTF 1.8 scenario will always be unambiguous because a
`src.ctf.fs` component never creates boolean field classes.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I6be5967c2312bdb0e67be7db14ab663912872403
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1895
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agosink.text.details: print boolean field classes and fields
Philippe Proulx [Sun, 11 Aug 2019 15:50:05 +0000 (11:50 -0400)] 
sink.text.details: print boolean field classes and fields

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I4f533f5682928d667fb26553bf9ca659135df0d3
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1894
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agosink.text.pretty: print boolean fields
Philippe Proulx [Sun, 11 Aug 2019 15:42:52 +0000 (11:42 -0400)] 
sink.text.pretty: print boolean fields

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I7fe169bbd23d87af117acff5f1697a7a326b7e2c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1893
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agoflt.lttng-utils.debug-info: copy boolean field class and field objects
Philippe Proulx [Sun, 11 Aug 2019 15:31:38 +0000 (11:31 -0400)] 
flt.lttng-utils.debug-info: copy boolean field class and field objects

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iaa66e2fc34740d249f014a3a7ec18006e74a2472
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1892
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agolib: add boolean field class and field types
Philippe Proulx [Sun, 11 Aug 2019 15:20:14 +0000 (11:20 -0400)] 
lib: add boolean field class and field types

This patch adds the boolean field class and field to the available
library types. They are analogous to the boolean value object which
already exists.

CTF 2 will very likely have such a type, so Babeltrace 2.0 will be
ready.

This patch does not adapt existing plugins and the Python bindings to
use and wrap the new boolean field class and field; this work is
reserved for subsequent patches.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I90874f214757ad67d5eecaad5bd8297b8610c001
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1891
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
4 years agobt2: cleanup: Remove unused `_StreamClass` id setter
Francis Deslauriers [Tue, 13 Aug 2019 16:47:10 +0000 (12:47 -0400)] 
bt2: cleanup: Remove unused `_StreamClass` id setter

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Iabd929f239e54e81e8424d366e7bc7689b342c2a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1904
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 years agobt2: cleanup: Remove unused `_StreamClassIterator` class
Francis Deslauriers [Tue, 13 Aug 2019 16:23:59 +0000 (12:23 -0400)] 
bt2: cleanup: Remove unused `_StreamClassIterator` class

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I527c35015f5fb75dbcb55850932e0e0950d3b0ea
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1903
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 years agotests: return 0 instead of None for unknown file in test component class support...
Simon Marchi [Tue, 13 Aug 2019 19:30:15 +0000 (15:30 -0400)] 
tests: return 0 instead of None for unknown file in test component class support-info query

I noticed some spurious warnings while running
TestAutoDiscoverSourceComponentSpecsGrouping.test_grouping (shortened
for brevity):

    unexpected result type: component-class-name=source.test.TestSourceExt, input=/home/smarchi/src/babeltrace/tests/data/auto-source-discovery/grouping/bt_plugin_test.py, input-type=file, expected-types=REAL,MAP,SIGNED_INTEGER, actual-type=NULL

Indeed, the _query method of TestSourceExt fails to return a value (so
it returns None) if it doesn't know the file.  This is not on purpose in
this test, so fix it.

Change-Id: I303c78dae4a518c62573263aa7a3afafd0c61ed7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1906
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 years agobt_uuid_compare: return actual comparison
Jonathan Rajotte [Tue, 13 Aug 2019 22:34:20 +0000 (18:34 -0400)] 
bt_uuid_compare: return actual comparison

Previous implementation resulted in non-equal uuid_a being flagged as
smaller than uuid_b even when it was actually bigger.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I00dfe935f21514d78bd586bb52729c5e147c8a36
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1912
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agosink.ctf.fs: isa_length is now architecture_bit_width
Jonathan Rajotte [Tue, 13 Aug 2019 18:20:34 +0000 (14:20 -0400)] 
sink.ctf.fs: isa_length is now architecture_bit_width

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I30cac20017f7508ed170b936a7b90ebc2916b913
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1905
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 years agosrc.ctf.lttng-live: consider youngest only when timestamp is smaller
Jonathan Rajotte [Tue, 13 Aug 2019 22:50:09 +0000 (18:50 -0400)] 
src.ctf.lttng-live: consider youngest only when timestamp is smaller

When the timestamps are equals perform further comparison.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Id7567019177ab2e2d4ad1ab1e8840aa07f9ba471
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1913
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agoUse uuid as first comparison criteria
Jonathan Rajotte [Tue, 13 Aug 2019 22:51:32 +0000 (18:51 -0400)] 
Use uuid as first comparison criteria

This is most important in the message ordering reproducibility against
multiple sources where some might populate the trace name and some don't.

A good example of a source not populating the trace name is lttng-live.

It facilitates the testing of lttng-live source plugin since it is
possible to compare it to the src.ctf.fs plugin directly.

Philippe adds: there's a trace UUID property in a CTF metadata stream,
but no trace name property. The trace name is entirely up to the
specific CTF source component class. Therefore it's safer to use the
UUID to distinguish unique traces.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I39f3c513e27bffd51ca02b089c097ac406e3316e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1914
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 years agosrc.ctf.lttng-live: cleanup: rename functions and variables
Francis Deslauriers [Mon, 12 Aug 2019 22:07:09 +0000 (18:07 -0400)] 
src.ctf.lttng-live: cleanup: rename functions and variables

Use term "youngest" whenever possible to signify our current best
candidate.

Rename `lttng_live_iterator_next_on_stream()` ->
`lttng_live_iterator_next_msg_on_stream()` to signify that it's
returning a message.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I7dcfccda30c87662209ac87e3bcda31699d3ea44
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1889
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 years agoFix: src.ctf.lttng-live: missing ordering within traces and streams
Francis Deslauriers [Mon, 12 Aug 2019 21:35:01 +0000 (17:35 -0400)] 
Fix: src.ctf.lttng-live: missing ordering within traces and streams

Issue
=====
Sorting of messages with the same timestamps are different from the
messages sorted by the a `flt.utils.muxer` component. This is caused by
the fact that we are not sorting messages within sessions and traces
but only across the different session currently handled by the
component.

Indeed, we need to sort messages at across three locations in the code
to ensure proper ordering: sessions, traces, and streams.

Solution
========
Handle messages with the same timestamps at each of these three
locations using the `common_muxing_compare_messages()` function.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Iadc66f3b6a12f34522f6364b3f47f15eefa87930
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1888
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 years agobt2: `TraceCollectionMessageIterator`: find greatest MIP version
Philippe Proulx [Mon, 12 Aug 2019 03:01:00 +0000 (23:01 -0400)] 
bt2: `TraceCollectionMessageIterator`: find greatest MIP version

This patch makes the `TraceCollectionMessageIterator` object use
bt2.get_greatest_operative_mip_version() to find the greatest operative
MIP version of all the components to create, including the stream
intersection `flt.utils.trimmer` components, and then use the result to
create the graph with bt2.Graph().

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Id9024a2343d0e99384ae62bd77754912a4267dac
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1881
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agocli: find greatest operative MIP version to create `run` command's graph
Philippe Proulx [Sun, 11 Aug 2019 06:36:41 +0000 (02:36 -0400)] 
cli: find greatest operative MIP version to create `run` command's graph

This patch makes the CLI's `run` command use
bt_get_greatest_operative_mip_version() to find the greatest operative
MIP version of all the components to create, including the stream
intersection `flt.utils.trimmer` components, and then use the result to
create the graph with bt_graph_create().

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I2e791ac9c8806457fa850d0dad72ea3ab6912f08
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1879
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agolib: bt_graph_create(): accept MIP version
Philippe Proulx [Sun, 11 Aug 2019 03:24:13 +0000 (23:24 -0400)] 
lib: bt_graph_create(): accept MIP version

This patch makes bt_graph_create() accept the message interchange
protocol (MIP) version with which to configure the graph.

This MIP version will usually come from
bt_get_greatest_operative_mip_version() or bt_get_maximal_mip_version().

The components can access the configured MIP version with
bt_self_component_get_graph_mip_version().

As of this patch the only possible MIP version is 0. bt_graph_create()
does not accept a MIP version that is greater than
bt_get_maximal_mip_version() because almost all the library functions
need to know the configured MIP version to behave accordingly, should
the semantics change in the future.

In Python, Graph.__init__() accepts a `mip_version` parameter which
defaults to 0. A Python component can get the configured MIP version of
its operating graph with the `_UserComponent._graph_mip_version`
property.

All the sites where bt_graph_create() is called pass 0 to it. This is
correct for tests as we always control the component classes and
initialization parameters, so we know that 0 is always supported by
them. The locations where bt_get_greatest_operative_mip_version() must
be used are the CLI and `bt2.TraceCollectionMessageIterator`. Those
sites will be addressed by subsequent patches.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I324a317922a8caa5557043ae02b97e58fc91d92d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1878
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agobt2: add bt2.get_{greatest_operative,maximal}_mip_version()
Philippe Proulx [Sun, 11 Aug 2019 02:38:39 +0000 (22:38 -0400)] 
bt2: add bt2.get_{greatest_operative,maximal}_mip_version()

Those new functions wrap bt_get_greatest_operative_mip_version() and
bt_get_maximal_mip_version().

bt2.get_greatest_operative_mip_version() excepts a list of
`bt2.ComponentDescriptor` objects. The function builds a component
descriptor set (bt_component_descriptor_set_create()) and adds the
corresponding component descriptors to it and then calls
bt_get_greatest_operative_mip_version().

bt_get_greatest_operative_mip_version() translates
`BT_GET_OPERATIVE_MIP_VERSION_STATUS_NO_MATCH` into `None`.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iaeb36b976f3c651fa82a86de2e835f782d682299
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1877
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agobt2: add "get supported MIP versions" method support
Philippe Proulx [Mon, 12 Aug 2019 21:19:46 +0000 (17:19 -0400)] 
bt2: add "get supported MIP versions" method support

This patch makes the `bt2` package wrap the library's "get supported MIP
versions" component class method.

In a Python component class, it is expected that the optional
_user_get_supported_mip_versions() method returns either a
`bt2.UnsignedIntegerRangeSet` object or what such an object needs to be
constructed. In other words, the method can return, for example:

    return [0, 1, (3, 5)]

Like in the library, the default _user_get_supported_mip_versions()
returns 0 (only protocol 0 supported):

    def _user_get_supported_mip_versions(cls, params, obj, log_level):
        return [0]

_bt_get_supported_mip_versions_from_native() returns a new reference on
this unsigned integer range set. Then, the native
component_class_get_supported_mip_versions() copies the ranges from the
returned range set to the range set to fill. I believe this makes
_user_get_supported_mip_versions() easier to use than receiving a range
set object and filling it like it's done in C.

The feature is not tested in this patch because the "get supported MIP
versions" method is not used within the library.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I9e0c6f0fcac23d2224401c1fb1c258f061642767
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1875
Tested-by: jenkins <jenkins@lttng.org>
4 years agobt2: _IntegerRangeSet.add(): make it possible to add a single value
Philippe Proulx [Sat, 10 Aug 2019 19:46:37 +0000 (15:46 -0400)] 
bt2: _IntegerRangeSet.add(): make it possible to add a single value

This patch makes it possible to do:

    my_range_set.add(23)

which is the equivalent of:

    my_range_set.add((23, 23))

It also makes it possible to do:

    bt2.SignedIntegerRangeSet(-17)
    bt2.UnsignedIntegerRangeSet(17)

which is the equivalent of:

    bt2.SignedIntegerRangeSet(-17, -17)
    bt2.UnsignedIntegerRangeSet(17, 17)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I44bf1a257422fb9e74835a300eeda948a8e5d067
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1874
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agobt2: add `ComponentDescriptor` class and test
Philippe Proulx [Sat, 10 Aug 2019 18:53:32 +0000 (14:53 -0400)] 
bt2: add `ComponentDescriptor` class and test

The goal of a `ComponentDescriptor` object is to eventually be used
within an array of descriptors passed to a function which computes an
effective message interchange protocol version with the help of version
support component class methods.

I choose not to wrap the `bt_component_descriptor_set` API as this is
so simple and will be used at a single location.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ifef9b4fb0a7cf0278dbf8bed2d18d0b47934a272
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1873
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agolib: add bt_get_{greatest_operative,maximal}_mip_version() functions
Philippe Proulx [Sat, 10 Aug 2019 22:40:50 +0000 (18:40 -0400)] 
lib: add bt_get_{greatest_operative,maximal}_mip_version() functions

This patch adds the bt_get_greatest_operative_mip_version() and
bt_get_maximal_mip_version() functions.

The bt_get_greatest_operative_mip_version() accepts a set of component
descriptors and returns, on success, the (greatest) operative message
interchange protocol (MIP) version for all those descriptors.

bt_get_greatest_operative_mip_version() can fail if any component class's "get
supported MIP versions" fails. It can also return
`BT_GET_OPERATIVE_MIP_VERSION_STATUS_NO_MATCH` if any component
descriptor does not support MIP version 0, the only MIP version
currently supported by the the library.

bt_get_maximal_mip_version() returns the maximal MIP version supported
by the library (currently 0).

The purpose of both functions is to be used eventually to create a graph
of which all the components and the library itself operate using a
specific MIP. You can use bt_get_greatest_operative_mip_version() to find the
greatest compatible MIP version to be used by that set of component
descriptors, or you can use bt_get_maximal_mip_version() to get the
greatest MIP version possible for that library.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If3875b3d76ddca2b4d58a18a829394eadb3bcd39
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1872
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agoFix: {graph,query-executor}.h: missing `STATUS_` before `MEMORY_ERROR`
Philippe Proulx [Sat, 10 Aug 2019 22:27:55 +0000 (18:27 -0400)] 
Fix: {graph,query-executor}.h: missing `STATUS_` before `MEMORY_ERROR`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I24307beb9896b754f13c0d887ef3ed03ee6596b2
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1871
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
4 years agolib: add "get supported MIP versions" method support
Philippe Proulx [Sat, 10 Aug 2019 19:18:17 +0000 (15:18 -0400)] 
lib: add "get supported MIP versions" method support

This patch adds a new optional method to component classes: get
supported message interchange protocol (MIP) versions.

As of this patch, you can set the "get supported MIP versions" method of
a component class, but it's not used.

The "message interchange protocol" term is very long so I chose to use
the acronym "mip" in the API. The API documentation will make this more
clear.

The method is considered a "class method"; no component exists yet when
calling it (like the query method). The method receives the component
class, the initialization parameters, the initalization method custom
data, and an existing, empty unsigned integer range set. The method's
purpose is to fill this integer range set with all the MIP versions it
supports depending on the initialization configuration. This makes it
possible to support specific MIP versions based on an input path or URI,
for example.

It is a postcondition that the method adds at least one MIP version to
the unsigned integer range set.

The "get supported MIP versions" method is optional: not implementing it
corresponds to adding [0, 0] to the unsigned integer range set. This
makes it possible to implement a component class of which the instance
operates according to the MIP protocol of Babeltrace 2.0.

The "get supported MIP versions" method can fail, but it cannot return
a "try again" status.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ib26ec9e90b47a3d3e51cc56465a264de9d02b97c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1870
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
This page took 0.052171 seconds and 4 git commands to generate.