Francis Deslauriers [Mon, 6 May 2019 18:21:55 +0000 (14:21 -0400)]
Fix: src.ctf.fs: Using uninitialized value
`iter_status` may be used uninitialized if the break statement in the
do-while is reached.
Fixes Coverity #
1401236:
CID
1401236 (#1 of 1): Uninitialized scalar variable (UNINIT)
9. uninit_use: Using uninitialized value iter_status.
Reported-by: Coverity (1401236) Uninitialized scalar variable
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I96e4608011144cb3c1ae26018d57e98f0358a779
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1261
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Tue, 7 May 2019 19:39:41 +0000 (15:39 -0400)]
Fix: sink.ctf.fs: writing 64bit real number as 32bit
Both 32bit and 64bit Trace IR real numbers are written as 32bit CTF
floats with the `bt_ctfser_write_float32()`. This is most probably a
copy-paste error.
To fix this, use the `bt_ctfser_write_float64()` in the else branch instead.
Coverity report:
CID
1401207 (#1 of 1): Identical code for different branches (IDENTICAL_BRANCHES)
identical_branches: The same code is executed regardless of whether
fc->base.size == 32U is true, because the 'then' and 'else' branches
are identical. Should one of the branches be modified, or the entire
'if' statement replaced?
Reported-by: Coverity (1401207) Identical code for different branches
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I462fd47e968e39f5878431d5ac6cbcbbf1d2ffcf
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1268
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Tue, 7 May 2019 21:32:29 +0000 (17:32 -0400)]
Fix: flt.lttng-utils.debug-info: `ip` field is 32bit on 32bit cpus
Issue
=====
The debug-info component enforces that the `ip` field used to resolve
addresses is a 64bit integer, but the LTTng UST `ip` context field is
32bit on a 32bit cpu. A debug-info component thus fail to recognize that
the trace has all the necessary information to resolve the addresses.
Here is the metadata representing the context on a 32bit system:
event.context := struct {
integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _vpid;
integer { size = 32; align = 8; signed = 0; encoding = none; base = 16; } _ip;
};
Here is the metadata representing the context on a 64bit system:
event.context := struct {
integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _vpid;
integer { size = 64; align = 8; signed = 0; encoding = none; base = 16; } _ip;
};
Solution
========
Remove the integer size check in the
`is_event_common_ctx_dbg_info_compatible()` function.
Drawback
========
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I3938a5f71a2406876573a5aa381f7d3dd4d632d6
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1270
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Wed, 8 May 2019 17:12:22 +0000 (13:12 -0400)]
tests: Run test_bitfield
I noticed that the test_bitfield executable was not run as part of make
check. Add it to TESTS_LIB.
Change-Id: Id1c40a7916b6326f7655a49e033d5570e40b42e6
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1277
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 7 May 2019 16:25:05 +0000 (12:25 -0400)]
Fix: duplicate symbol with clang linker
On MacOs with the clang linker, the build fails with:
duplicate symbol _bt_ctf_value_null in:
trace-ir/.libs/libtrace-ir.a(trace.o)
trace-ir/.libs/libtrace-ir.a(trace-class.o)
Make the pointers extern.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I679dc5b647de235a19a958331f7f975c0cb0a08f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1267
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 18:14:39 +0000 (14:14 -0400)]
Fix: fd-cache: fd leak on error path
Fixes coverity #
1401248
CID
1401248 (#1 of 1): Resource leak (RESOURCE_LEAK)
10. leaked_handle: Handle variable fd going out of scope leaks the handle.
Reported-by: Coverity (1401248) Resource leak
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I41662edaa4ff13046e003aec20ac27ff242e338f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1260
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 18:50:50 +0000 (14:50 -0400)]
Fix: lib/graph: Dereference before null checks
CID
1401244 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.source_output_port_added suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.
CID
1401260 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.filter_output_port_added suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.k
CID
1401243 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.filter_input_port_added suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.
CID
1401185 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking graph->listeners.sink_input_port_added
suggests that it may be null, but it has already been dereferenced on
all paths leading to the check.
CID
1401262 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.source_filter_ports_connected suggests that it may be
null, but it has already been dereferenced on all paths leading to the
check.
CID
1401200 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.filter_filter_ports_connected suggests that it may be
null, but it has already been dereferenced on all paths leading to the
check.
CID
1401252 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.source_sink_ports_connected suggests that it may be
null, but it has already been dereferenced on all paths leading to the
check.
CID
1401264 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.filter_sink_ports_connected suggests that it may be
null, but it has already been dereferenced on all paths leading to the
check.
Reported-by: Coverity (various ids) Dereference before null check
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I88c8172e006e4bae2c7b5e29b501e1a36f19ae5c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1262
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 20:45:32 +0000 (16:45 -0400)]
Fix: cli: value stored is never read
Found with scan-build:
line 1434, column 4
Value stored to 'ret' is never read
line 1281, column 4
Value stored to 'ret' is never read
line 1345, column 2
Value stored to 'ret' is never read
line 1423, column 3
Value stored to 'ret' is never read
line 1396, column 3
Value stored to 'ret' is never read
Reported-by: scan-build
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I95f06132c34bbf9c4ffbb81423e42cf1834880bd
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1266
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 19:39:05 +0000 (15:39 -0400)]
Fix: flt.lttng-utils.debug-info: omitting copy_field_class_content() return value
ID
1401259 (#1 of 2): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement: goto error;.
CID
1401259 (#2 of 2): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement: goto error;.
Reported-by: Coverity (various ids) Logically dead code
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I1b3bb7cba9aec34e6a90386178f99cc505d4da66
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1264
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 20:22:03 +0000 (16:22 -0400)]
Fix: flt.lttng-utils.debug-info: memory leak
The gelf_getshdr() function return a pointer to the second parameter on
success and NULL on error. This means that on we overwrite the
`curr_section_hdr` variable and leak memory.
To fix it, we simply change the variable from a heap allocated variable
to a stack allocated variable this has the effect of making code simpler.
Found using scan-build:
line 334, column 7
Potential leak of memory pointed to by 'curr_section_hdr'
Report-by: scan-build (ad8e62)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I5cc4049075e4ca1d64d98e17662f935e6562bb6e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1265
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 19:04:05 +0000 (15:04 -0400)]
Fix: sink.text.pretty: Unsigned compared against 0
CID
1401251 (#1 of 1): Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This less-than-zero comparison of an unsigned value is
never true. nr_fields < 0UL.
Reported-by: Coverity (1401251) Unsigned compared against 0
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8aa8a03a6b03ca1640570d70a51729d001af3b66
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1263
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 16:20:09 +0000 (12:20 -0400)]
Fix: src.ctf.fs: init_index_entry() may return uninitialized value
Found with scan-build.
Warning reported: Undefined or garbage value returned to caller
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ifaccdd9f7c8a762fd4eb9f26a5fce4cd092c44df
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1259
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins
Jérémie Galarneau [Mon, 6 May 2019 14:33:48 +0000 (10:33 -0400)]
Update version to v2.0.0-pre6
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I640770f6def57a88e12beb05a9724c4e3f31cd54
Philippe Proulx [Sun, 5 May 2019 11:53:50 +0000 (07:53 -0400)]
cli/babeltrace.c: update known log level environment variable names
Eventually we could find another way to synchronize the environment
variable names we use throughout the project with the CLI. We want to
decouple the plugins from the CLI (plugins do not know CLI, but CLI
knows plugins) so I don't want the plugins to support an environment
variable defined by the CLI for example.
For the moment, I'm using this:
rg --pcre2 -N --iglob='*.c' --iglob='*.h' --no-filename -o \
'BABELTRACE_\w+(?<!CLI)_LOG_LEVEL\b' --color=never | sort | uniq
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I148c5c859570d0b1a654c829b31066155e8ecf5e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1258
Tested-by: jenkins
Philippe Proulx [Fri, 3 May 2019 19:14:18 +0000 (15:14 -0400)]
lib: add unsigned and signed integer value API
This patch replaces the integer value API with the more specific
unsigned and signed integer value API. This opens the whole unsigned
64-bit set for component initialization parameters, query parameters,
queyr results, and, eventually, custom metadata attributes. This is also
more in line with the field API, which has both the unsigned and signed
versions.
Library
=======
The API is simply split in two, where an unsigned integer value contains
a `uint64_t` raw value and a signed integer value is the equivalent of
the previous integer value (`int64_t` raw value).
The types are `BT_VALUE_TYPE_UNSIGNED_INTEGER` and
`BT_VALUE_TYPE_SIGNED_INTEGER`.
There's no interaction between unsigned and signed integer values, in
that, for example, you cannot compare an unsigned integer value with a
signed integer value with bt_value_compare().
Behind the scenes, I kept a single `struct bt_value_integer` for
simplicity. It contains a union of `uint64_t` and `int64_t`. Most
functions call a generic unsigned version, casting to `uint64_t` when
necessary. For example, there's a common bt_value_integer_compare()
which compares the `uint64_t` values.
CLI
===
Before this patch, the `--params` option's format makes any integer
constant a signed integer value object. With this patch, you can create
an unsigned integer value by prepending the constant with `+`. For
example:
hello=+293, meow=+0x388ab88fd, uint-zero=+0
I wanted to use the `U` suffix, like in C/C++, but the GLib lexical
scanner won't allow a constant to be followed by an identifier without a
whitespace.
The documentation about the format of `--params` is updated for the
CLI's `--help` option and in the man pages.
Plugins
=======
It's up to each plugin to accept, for a given parameter, an unsigned
integer value, a signed integer value, or both. A plugin can be very
strict and it's not a bad thing: there are situations where an unsigned
integer is conceptually required.
The individual changes are:
`src.ctf.fs`:
In the `trace-info` query result, create unsigned integer values for
the `id` (stream ID) and `class-id` (stream class ID) entries. A CTF
metadata ID is never negative.
`src.ctf.lttng-live`:
In the `sessions` query result, the `timer-us`, `stream-count`, and
`client-count` entries are still signed integer values. They could
probably be unsigned, but I want to confirm this with developers
more involved with this component class before doing the change. For
the moment, the query operation is unchanged.
`sink.utils.counter`:
The `step` initialization parameter is now expected to be an
unsigned integer value. This is never negative.
I also made the initialization refuse parameters when they don't
have the expected type. There are new `logging.c` and `logging.h`
files for this component class because I used logging to communicate
said errors.
Library tests
=============
The integer value tests now test the signed value API.
I added equivalent unsigned value object tests.
Python bindings
===============
`_IntegerValue` is now the base class of `UnsignedIntegerValue` and
`SignedIntegerValue`. `_IntegerValue` contains the whole public
interface, using template methods with specialized parts defined in
subclasses.
`_IntegerValue` is imported in the `bt2` package for this use case:
if isinstance(val, bt2._IntegerValue):
do_something_with(val)
because `int(val)` is always valid.
The bt2.create_value() function still creates a `SignedIntegerValue`
object with an `int` value. This is the safest, as there's no way to
know that this value will be changed to a negative value in the future,
before the value object is frozen. For example, this would not be
possible with a conversion to an `UnsignedIntegerValue`:
val = bt2.create_value(47)
val.value = -23
whereas it is possible with a `SignedIntegerValue`. You can still
explicitly create an unsigned integer value:
counter_comp = my_graph.add_component(counter_cls, 'counter', {
'step': bt2.UnsignedIntegerValue(29)
});
Python bindings tests
=====================
`test_value.py` is updated to also test the `UnsignedIntegerValue`
class. _inject_numeric_testing_methods() now accepts an optional
`has_neg` parameter which, if false, does not inject tests which involve
negative integer values.
There is a common `_TestIntegerValue` class which
`SignedIntegerValueTestCase` and `UnsignedIntegerValueTestCase` inherit.
The tests are almost the same, but `SignedIntegerValueTestCase` adds a
few tests related to negative values. Both specific test cases set the
`_CLS` class attribute to the value object class to test, either
`UnsignedIntegerValue` or `SignedIntegerValue`.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ic96ef9e1e16883cb5c59844c6ba5a060936efdb0
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1257
Tested-by: jenkins
Philippe Proulx [Fri, 3 May 2019 15:37:37 +0000 (11:37 -0400)]
lib: value.c: remove BT_VALUE_FROM_CONCRETE() macro
We can just cast to `void *` directly like we do everywhere else in the
library.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If09f1be2e7f8f9cf3bf964a7d4ada5b3307ef7f4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1256
CI-Build: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins
Philippe Proulx [Fri, 3 May 2019 15:24:23 +0000 (11:24 -0400)]
lib: move `bt_value` structures to `value-internal.h`
It's unusual to have internal structures in the C file. To remain
consistent with the rest of the library, put them in the internal
header.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I5a946004a172560acecab1b182214293f61f02fd
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1255
CI-Build: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins
Simon Marchi [Fri, 3 May 2019 21:25:14 +0000 (17:25 -0400)]
bt2: Make test_query_executor pass
This patch fixes and enables test_query_executor.py.
The only important change is in the query method: it is necessary to
check for `is_canceled` prior to calling the API function, since it
asserts that the executor is not cancelled.
I have removed the __eq__ method and tests, since it's quite unlikely to
be useful for the QueryExecutor class.
Change-Id: If88c2552627358b06f7d6068126034a20ebf88e8
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1252
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 3 May 2019 19:58:04 +0000 (15:58 -0400)]
bt2: Fix Makefile dependency tracking when building out of tree
The problem, from the point of view of the developer:
1. Build out of tree, python bindings enabled.
2. Modify a bindings source file (e.g. trace_class.py,
native_bt_trace.i).
3. Type "make" in the builddir.
4. The bindings are not rebuilt from the new source files.
5. Sad.
When we build out of tree, it's done in two steps (assume $builddir is
$top_builddir/bindings/python):
1. Copy all the static files (those checked in the repo, not generated
at runtime) from $srcdir/bt2 to $builddir/bt2. Those files are placed
next to other files that are generated (__init__.py, setup.py).
Together, they form the complete source of the bt2 package.
2. Run setup.py, which runs SWIG and outputs the built package in
$builddir/build_lib.
The problem described above happens because of how the dependencies are
stated for step #1:
STATIC_BINDINGS_DEPS = ... bt2/native_bt_trace.i ...
copy-static-deps.stamp: $(STATIC_BINDINGS_DEPS)
When nothing exists yet in the build directory, bt2/native_bt_trace.i is
resolved to the version in the srcdir (because of make's VPATH, I
believe), so it works fine. But once the copied files exist, and you
try to change the source files and "make" again, the dependency
bt2/native_bt_trace.i will be resolved to the version in the build dir.
Since that version is not newer than copy-static-deps.stamp, nothing is
done.
The fix it, we can force the dependency to be the one in the source
directory, by prepending $(srcdir) to each file.
Change-Id: Ic09d430e53b59e5afa9ebb19d98ba219dff16537
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1250
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Fri, 3 May 2019 19:06:45 +0000 (15:06 -0400)]
fix: g_hash_table_insert prior to glib 2.40 returns void
Even the post glib 2.40 version will only return false if the value is
already present in the hashtable but will not fail to add it. The old
value will be handled according to the configuration of the hashtable
which should not be an error.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I5512c921ce220bf8a956c61f594d6a27e6ceb41e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1247
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 3 May 2019 23:51:11 +0000 (19:51 -0400)]
tests/plugins/ctf/Makefile.am: do not set `TESTS` in this file
We want the project's `make check` to continue even if specific tests
fail, so we can't define `TESTS` in a subdirectory's `Makefile.am`,
because if the test fails, `make` fails, and subsequent tests are not
executed.
There are ways to circumvent this, for example using `make`'s
`--always-make` option, but it was decided previously that we want
`make check` to run all tests as is, without any option.
Therefore we set `TESTS` to all tests in `tests/Makefile.am`.
To execute tests specific to a subdirectory, we have the following
targets:
* `check-bindings`
* `check-cli`
* `check-lib`
* `check-plugins`
* `check-python-plugin-provider`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I1f198ff3ff2b44947042aee7fa5f01759874941f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1254
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Francis Deslauriers [Fri, 3 May 2019 16:39:59 +0000 (12:39 -0400)]
Fix: flt.lttng-utils.debug-info: build id note section non-native byte order
Issue
=====
The build id comparison code does not take into account that the target
binary file could be compiled for another architecture and thus could be
of a different byte order. This makes the build_id testcase fail on
PowerPC. The artefacts used for this testcase are compiled on x86 and
are thus in little endian as opposed to PowerPC's big endianness.
Solution
========
Parse the Elf file to extract the endianness of the binary and use that
information to change the byte order of the note section if necessary.
Drawbacks
=========
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Id5d761832f9463b38ea0452da36053e885929aa9
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1246
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Francis Deslauriers [Fri, 3 May 2019 19:11:00 +0000 (15:11 -0400)]
common: add bt_common_read() function
This function wraps the `read()` function to handle EINTR and partial
reads.
It returns the `count` value on success, or a smaller value than `count`
on error.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ib0385855447200d97a58da704dcf68423e857033
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1248
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Fri, 3 May 2019 22:26:57 +0000 (18:26 -0400)]
Fix: common: va_list type is implementation dependant
Issue
=====
BT_ASSERT(*args) happens to work on some library implementations because
the va_list type happens to be a pointer but this is not true with all
libraries. For example, compiling on arm64 results in the following
error:
In file included from common.c:34:0:
common.c: In function ‘bt_common_custom_vsnprintf’:
../include/babeltrace/assert-internal.h:42:7: error: wrong type
argument to unary exclamation mark
if (!(_cond)) { \
^
common.c:1524:2: note: in expansion of macro ‘BT_ASSERT’
BT_ASSERT(*args);
^~~~~~~~~
Solution
========
Remove that BT_ASSERT() call as its intent is unclear anyway.
Drawback
========
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Iada5189ef4580e48caefed12835bfab7c23eaf73
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1253
CI-Build: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 3 May 2019 20:23:16 +0000 (16:23 -0400)]
Fix: uninitialized variant fc in set_field_refs()
GCC 8.3.0 emits the following warning:
translate-trace-ir-to-ctf-ir.c:935:16: warning: ‘var_fc’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
named_fc =
fs_sink_ctf_field_class_variant_borrow_option_by_index(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var_fc, i);
I don't think this "condition" is reachable, but it is, in principle
possible. Initializing var_fc to NULL silences this warning.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1fd8951778e8b3705974324e1cd5d87892c2e418
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1251
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Simon Marchi [Thu, 2 May 2019 16:21:20 +0000 (12:21 -0400)]
src.ctf.fs: make trace-info query accept clock-class-offset-{s,ns} parameters
The src.ctf.fs components accept clock-class-offset-s and
clock-class-offset-ns parameters, allowing to add an offset to the
clock.
The trace-info query currently doesn't accept the same parameters. In
general, I think we'll want the components and trace-info to accept
pretty much the same set of parameters, so that the information reported
by trace-info accurately represents how an eventual component reading
the same traces will work.
This patch splits the parameter handling of the component in a
standalone function re-used by the query. The advantage of sharing a
function like this is that if we add a parameter to the component, we'll
be forced to think about what happens to the trace-info query.
One behavior change is that trace_info_query now returns
BT_QUERY_STATUS_INVALID_PARAMS if the passed parameters are invalid.
A test is added to test the new functionality.
Change-Id: I3d917b8713fce4ce56a79a6e7c7bdc3e32d9ec0c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1244
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 2 May 2019 20:53:30 +0000 (16:53 -0400)]
ctf: Use g_time_val_from_iso8601 instead of g_date_time_new_from_iso8601
g_date_time_new_from_iso8601 was introduced in glib 2.56, which is quite
recent. To support build with older glibs, change the code to use
g_time_val_from_iso8601 instead, introduced in glib 2.12.
The code in question only uses this function to validate that the passed
string is ISO8601-compliant, it doesn't use the resulting time value.
The problem of g_time_val_from_iso8601 is that its result is not year
2038-safe on 32-bit systems. We can expect that by then, that function
will have been removed from glib, forcing us to update our code.
Change-Id: I2f4fdfce9020ecefcfb5d653a3885d343e49bd76
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1245
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 2 May 2019 18:18:07 +0000 (14:18 -0400)]
tests: update EXTRA_DIST of Python bindings
This list is out of date, causing "make dist" to fail.
Sync the list of distributed files with the actual files.
Change-Id: Iedef7411c691689eb6a0505b4ea29d0f319f6860
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1242
Tested-by: jenkins
Reviewed-by: Jonathan Rajotte Julien <jonathan.rajotte-julien@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 2 May 2019 18:29:10 +0000 (14:29 -0400)]
tests: remove non-existent files from EXTRA_DIST
These files were removed in commit
e8bacbe2bd42 ("Remove stale trace-ir test files")
... so they should be removed from EXTRA_DIST as well. Currently, it
causes a "make dist" failure:
make[4]: *** No rule to make target 'test_trace.py', needed by 'distdir'. Stop.
The tests/lib/trace-ir directory is currently not very useful, as it
contains no tests at all, so we could remove it in theory. But I
presume we'll add something in there in not too long, so I think we can
leave it there.
Change-Id: Iec44efd7c52e84b35a5a55206055b5d63635fbe1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1241
Tested-by: jenkins
Reviewed-by: Jonathan Rajotte Julien <jonathan.rajotte-julien@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 2 May 2019 18:36:57 +0000 (14:36 -0400)]
include: add missing files to dist tarball
When making a tarball (make dist) and trying to build from it, it fails
because of missing header files. This patch adds all the necessary
headers to the dist tarball to make "./configure && make" from the
tarball succeed.
Change-Id: I89051cb060e911eac154ef1726034e905b49b085
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1243
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Jonathan Rajotte Julien <jonathan.rajotte-julien@efficios.com>
Simon Marchi [Wed, 1 May 2019 22:00:50 +0000 (18:00 -0400)]
bt2: Add wrapper for bt_plugin_get_version
There is a subtle bug with our use of the "char **OUT" typemap for the
bt_plugin_get_version function.
THe SWIG wrapper does this:
char *temp_value5;
arg5 = &temp_value5;
The initial content of temp_value5 is unknown, assume that it points to
unreadable memory. If the call to bt_plugin_get_version returns
PROPERTY_AVAILABILITY_NOT_AVAILABLE, the value of temp_value5 is
unchanged (but really, it could be anything, again we should assume it
points to unreadable memory). However, the epilogue of the typemap will
still try to transform the C string to a Python str object. Doing so
will cause a crash when trying to read the C string.
The fix is to make our own wrapper to bt_plugin_get_version, which
guarantees that if it returns PROPERTY_AVAILABILITY_NOT_AVAILABLE, it
will force the value of the output parameter to be NULL (which is
handled by the epilogue and transformed to None).
Setting the temporary variable to an invalid but non-zero pointer value
((void *) 1) makes this bug consistently reproducible and not rely on
random memory contents. I suggest we keep it there, in order to quickly
find other instances of this bug in the future.
Change-Id: Idd12ca4c4d4d732b841c1e12420e46e6a5a25874
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1221
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Tue, 30 Apr 2019 15:10:10 +0000 (11:10 -0400)]
Add git-review config
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Iece6807efd73611d1a2767c3284fbe6f9f72256c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1023
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Wed, 1 May 2019 22:44:44 +0000 (18:44 -0400)]
Fix: bt2: enum-conversion warning in native_bt_component_class.i
clang warns about the following enumeration conversion.
bt2/native_bt_wrap.c:3896:12: warning: implicit conversion from
enumeration type 'enum bt_message_iterator_status' to different
enumeration type 'enum bt_self_message_iterator_status'
[-Wenum-conversion]
status = BT_MESSAGE_ITERATOR_STATUS_END;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bt2/native_bt_wrap.c:3898:12: warning: implicit conversion from
enumeration type 'enum bt_message_iterator_status' to different
enumeration type 'enum bt_self_message_iterator_status'
[-Wenum-conversion]
status = BT_MESSAGE_ITERATOR_STATUS_AGAIN;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bt2/native_bt_wrap.c:3901:12: warning: implicit conversion from
enumeration type 'enum bt_message_iterator_status' to different
enumeration type 'enum bt_self_message_iterator_status'
[-Wenum-conversion]
status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bt2/native_bt_wrap.c:4513:43: warning: implicit conversion from
enumeration type 'enum bt_message_iterator_status' to different
enumeration type 'bt_self_message_iterator_status' (aka 'enum
bt_self_message_iterator_status') [-Wenum-conversion]
bt_self_message_iterator_status status = BT_MESSAGE_ITERATOR_STATUS_OK;
~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bt2/native_bt_wrap.c:4678:43: warning: implicit conversion from
enumeration type 'enum bt_message_iterator_status' to different
enumeration type 'bt_self_message_iterator_status' (aka 'enum
bt_self_message_iterator_status') [-Wenum-conversion]
bt_self_message_iterator_status status = BT_MESSAGE_ITERATOR_STATUS_OK;
~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Icb3bc0141cdd9f35a5a42420bb48167c12e70df0
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1183
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Francis Deslauriers [Wed, 1 May 2019 18:19:05 +0000 (14:19 -0400)]
Fix: bt2: int-to-pointer-cast warnings in SWIG utils functions
bt2/native_bt_wrap.c: In function ‘bt_py3_component_class_query’:
bt2/native_bt_wrap.c:4453:12: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
*result = (void *) PyLong_AsUnsignedLongLong(py_results_addr);
^
bt2/native_bt_wrap.c: In function ‘bt_py3_component_class_message_iterator_next’:
bt2/native_bt_wrap.c:4697:3: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
(const bt_message *) PyLong_AsUnsignedLongLong(
^
python-plugin-provider.c: In function ‘bt_plugin_from_python_plugin_info’:
python-plugin-provider.c:341:18: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
comp_class = (bt_component_class *)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I44d15e5d072d993776539eddae5f3e37c6161cac
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1162
CI-Build: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 1 May 2019 20:58:09 +0000 (16:58 -0400)]
sink.ctf.fs: set_field_refs(): make `fc` `const` as `fc_type` depends on it
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I9b0a0eb3fc41d9181205cb4f3f33334b90a3b712
Philippe Proulx [Wed, 1 May 2019 20:56:03 +0000 (16:56 -0400)]
Fix: sink.ctf.fs: do not keep different `tgt_fc_type` as `tgt_fc` changes
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ie79306f50018d7f5ca0971e6c9a2410378a4ccc7
Philippe Proulx [Wed, 1 May 2019 20:40:05 +0000 (16:40 -0400)]
lib: bt_graph_{consume,run}(): add unlikely() to unlikely condition
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I37badc4c15fbde16940150854cae1e31305953f1
Francis Deslauriers [Tue, 30 Apr 2019 23:01:17 +0000 (19:01 -0400)]
src.ctf.fs: compute stream range using entire file info group
Given that index entries are sorted within their file info structure and
that file info structures are sorted by time within the file info group,
we can simply compute the range of the stream by using the absolute
first index entry and the absolute last index entry of the entire file
info group.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I5b13451d72a4b1aeb9f31140ebfb025e2d712d7e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1128
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 30 Apr 2019 20:30:32 +0000 (16:30 -0400)]
bt2: update bindings to make test_plugins pass
This patch updates the necessary stuff in the bindings to make
test_plugins pass.
One new test is added, test_find_file, which tests passing the path to a
plugin shared object to bt2.find_plugins.
Change-Id: Ie2ac6e830fb18d8839d2879567509cd2f6abbd81
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1087
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Simon Marchi [Wed, 1 May 2019 18:09:13 +0000 (14:09 -0400)]
bt2: update bindings to make test_component pass
This patch updates component.py such that the test_component test
passes.
With the API, it is no longer possible to obtain the graph from a
component, so things related to this are removed from both files.
Change-Id: I3ab0e6aaaa8ec1ad7378abb78072e6e130e1c2a4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1085
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 1 May 2019 15:30:28 +0000 (11:30 -0400)]
bt2: update bindings to make test_component_class pass
This patch updates the binding with the goal of making
test_component_class pass.
Besides the obviously needed changes to the component class code, there
are a bunch of changes to things around it (component, graph), just
enough to make the test run.
One notable change is the _SharedObject._release method, used to make the
Python object stop manage the reference it currently owns.
Another functional change is how the component classes _query method
reports that it's not implemented. Currently, it default to return the
NotImplemented object. Instead, I made it raise a NotImplementedError.
Returning NotImplemented is useful if the caller has an alternative to
try when the method is not implemented. In our case, there is nothing
to do if the specific class doesn't implement _query. The exception is
caught in bt_py3_component_class_query, where other types of exceptions
need to be handled anyway.
Some changes are required to the library, to be able to get a specific
component class type from a specific component (e.g. a
bt_component_class_source from a bt_component_source).
Change-Id: I895817bc996c21b6a9c6d57605cc64f9ff61dfcc
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1083
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 1 May 2019 14:17:33 +0000 (10:17 -0400)]
lib: Add functions to borrow specialized component classes from specialized components
The API currently contains a function to obtain a 'bt_component_class *'
from a 'bt_component *'. This patch adds functions to obtain a
specialized component class from a specialized component. For example,
a 'bt_component_class_source *' from a 'bt_component_source *'.
Change-Id: Ide192c7759f630adbc884def2e5c462ce2b8f973
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1161
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 26 Apr 2019 19:41:24 +0000 (15:41 -0400)]
bt2: update value.py, make test_value pass
This patch updates value.py to match the current API.
The only known thing missing (to be done later) is to split classes in
their const and non-const variants (e.g. BoolValue and BoolValueConst),
where the methods that can modify values are only present on the
non-const versions.
The test is largely unchanged, except for the removal of things related
to frozen values.
Change-Id: I6424b0e6208ffe2cbe5e60fdd08579326abff29a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1022
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 29 Apr 2019 16:12:36 +0000 (12:12 -0400)]
bt2: update object model
This patch updates the Babeltrace Python object model (what all
Babeltrace Python objects inherit from) to match the current status of
the API.
We have both Shared and Unique objects. Both types have a _ptr
member, a SWIG Python object wrapping a typed pointer (e.g. pointer to
struct bt_value).
A Shared object type is defined by inheriting from _SharedObject. It
wraps and owns a reference to a Babeltrace object that is reference
counted. The reference count is dropped when the Python object gets
deleted. The _SharedObject base class defines two class methods,
_get_ref and _put_ref, which must be implemented by subclasses. These
implementations must respectively get and put a reference of the
specialized pointer (_ptr) they wrap.
A Unique object type is defined by inheriting from _UniqueObject. It is
not refcounted. Rather, it is wholly owned by another object (the
owner) that is itself refcounted. A Unique object, in the Babeltrace
API, is destroyed when its parent is destroyed. There is therefore a
risk that someone would keep a (Python) reference to a unique object
that got destroyed, because its parent got destroyed, resulting in some
use-after-free bug. To avoid this, we make it so that when a Python
object representing a Babeltrace Unique object is created, that Python
object obtains a reference on the owner Shared object. When the Unique
Python object is destroyed, the reference on the Shared parent is
dropped.
The concepts of Freezable and Private objects don't exist anymore, so
they are removed. I have also removed the _PrivateConnection class,
since it won't be needed in the end and inherited from _PrivateObject.
For other classes representing Babeltrace concepts, I have made them
inherit the object type they'll need to inherit in the end (when all the
Python bindings will be fixed), even though none of these classes is
functional at the moment.
Change-Id: I9ab743dd7a28407913945648c1d74c467550df14
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1021
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Wed, 1 May 2019 15:40:16 +0000 (11:40 -0400)]
Fix: string format warnings on 32 bits
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I49fdb170642bfd0c7326719f42973863af41c8e7
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1141
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:36:43 +0000 (11:36 -0400)]
Fix: unused-function warnings in lib/graph/iterator.c
clang warnings:
iterator.c:87:6: error: unused function '_set_self_comp_port_input_msg_iterator_state' [-Werror,-Wunused-function]
void _set_self_comp_port_input_msg_iterator_state(
^
iterator.c:885:6: error: unused function '_set_iterator_state_after_seeking' [-Werror,-Wunused-function]
void _set_iterator_state_after_seeking(
^
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia409f1dd696cdfed58de23aad926c4effdc26307
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1034
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:30:44 +0000 (11:30 -0400)]
Fix: may-uninitialized warning in trace-ir-metadata-field-class-copy.c
GCC warning:
In file included from ../../../include/babeltrace/common-internal.h:30:0,
from trace-ir-metadata-field-class-copy.c:31:
trace-ir-metadata-field-class-copy.c: In function ‘copy_field_class_content_internal’:
../../../include/babeltrace/trace-ir/field-class-const.h:196:3: error:
‘out_tag_field_class’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
bt_field_class_put_ref(_var); \
^~~~~~~~~~~~~~~~~~~~~~
trace-ir-metadata-field-class-copy.c:421:18: note: ‘out_tag_field_class’ was declared here
bt_field_class *out_tag_field_class;
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I73c6057f9795b153f95c1287f3f3f8e529328fbf
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1033
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:28:48 +0000 (11:28 -0400)]
Fix: maybe-uninitialized warnings in translate-trace-ir-to-ctf-ir.c
GCC warning example:
translate-trace-ir-to-ctf-ir.c:929:14: error: ‘struct_fc’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
named_fc = fs_sink_ctf_field_class_struct_borrow_member_by_index(
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct_fc, i);
~~~~~~~~~~~~~
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I24ba8095f26cec640e0a24473b4fee05d1c404af
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1032
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:24:11 +0000 (11:24 -0400)]
Fix: maybe-uninitialized warning in create_relative_field_ref()
translate-trace-ir-to-ctf-ir.c: In function ‘resolve_field_class’:
translate-trace-ir-to-ctf-ir.c:302:6: error: ‘tgt_fc_name’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
g_string_assign(tgt_field_ref,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tgt_fc_name);
~~~~~~~~~~~~
translate-trace-ir-to-ctf-ir.c:177:14: note: ‘tgt_fc_name’ was declared here
const char *tgt_fc_name;
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8d3398a852bf3ca412bb479eae72a81a3959d220
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1031
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:21:06 +0000 (11:21 -0400)]
Fix: unused-variable warnings in lib/graph/iterator.c
GCC warnings:
make[3]: Entering directory '/home/frdeso/projets/babeltrace/optimalize/lib/graph'
CC iterator.lo
iterator.c: In function ‘_set_iterator_state_after_seeking’:
iterator.c:889:59: error: variable ‘new_state’ set but not used [-Werror=unused-but-set-variable]
enum bt_self_component_port_input_message_iterator_state new_state = 0;
^~~~~~~~~
iterator.c: In function ‘find_message_ge_ns_from_origin’:
iterator.c:1159:59: error: unused variable ‘init_state’ [-Werror=unused-variable]
enum bt_self_component_port_input_message_iterator_state init_state =
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia14a89f330198e4109af14f755aeed3378912256
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1030
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:15:27 +0000 (11:15 -0400)]
Fix: maybe-uninitialized warning in bt_ctf_stream_flush()
GCC warning:
In file included from ../../include/babeltrace/ctf-writer/fields-internal.h:41:0,
from ../../include/babeltrace/ctf-writer/field-wrapper-internal.h:26,
from ../../include/babeltrace/ctf-writer/event-internal.h:37,
from stream.c:32:
stream.c: In function ‘bt_ctf_stream_flush’:
../../include/babeltrace/ctfser-internal.h:568:36: error:
‘packet_context_offset_bits’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
ctfser->offset_in_cur_packet_bits = offset_bits;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
stream.c:1608:11: note: ‘packet_context_offset_bits’ was declared here
uint64_t packet_context_offset_bits;
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia7457b1a444290ba1a71459bfaf707812227899c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1029
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:13:35 +0000 (11:13 -0400)]
Fix: unused-variable warnings in bt_X_freeze() when not in DEV_MODE
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Idf9e91b2abd9b2720343917c2d3ffdf207f82735
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1028
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 17:51:03 +0000 (13:51 -0400)]
Fix: src.ctf.fs: metadata-info: sanitize `path` param
Issue
=====
Omitting to pass the mandatory `path` parameter to the `metadata-info`
query results in a BT_ASSERT() failure when calling
bt_value_get_string(), or a NULL pointer dereference in non-DEV_MODE.
Similarly, setting the `path` to a non-string value would also result in
a BT_ASSERT() failure, or a invalid memory access in non-DEV_MODE
Solution
========
Confirm that the `path` parameter is present and is of the string type and
print error messages accordingly it's not.
Known drawbacks
===============
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8182de2797c375262d77a4a8961bedb4c5ef9578
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1081
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Wed, 1 May 2019 02:07:38 +0000 (22:07 -0400)]
Fix: flt.lttng-utils.debug-info: extra colon in `bin` member
There is an extra ':' character in the `bin` member of the `debug-info`
field.
Example of the issue from the tests:
debug_info = { bin = "libhello_so:+0x15a6", func = "bar+0xa9", src =
"libhello.c:13" }
The "libhello_so:+0x15a6" will now be printed "libhello_so+0x15a6".
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ie7c4ea54e534eeb8a1bdd503760b791a01aa9594
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1129
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 30 Apr 2019 22:29:01 +0000 (18:29 -0400)]
debug info: Skip test that depends on Python bindings
This test depends on the Python bindings, which don't work right now.
Skip it, so that it doesn't cause a "make check" failure while we are
repairing the bindings.
Change-Id: I8e9b1092e2794875b249b060581f4305be640a88
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1126
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 30 Apr 2019 22:00:43 +0000 (18:00 -0400)]
babeltrace: Remove leftovers
It seems like these files should have been removed when removing the
babeltrace Python bindings in commit
1c81bd8895c0 ("Remove babeltrace 1 Python bindings and tests")
Right now, the test causes a "make check" failure, because it tries to
import the babeltrace Python package, which no longer exists.
Change-Id: Ied4871ec23444776fca601b6f78b583ef8137c81
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1125
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 30 Apr 2019 21:52:12 +0000 (17:52 -0400)]
doc: Make python bindings doc build
Babeltrace 1 Python bindings (the babeltrace package) were removed in
commit
1c81bd8895c0 ("Remove babeltrace 1 Python bindings and tests")
However, the Python doc still references it. It tries to import it to
get the version, and therefore fails to build. Update it to import the
bt2 package instead.
Change-Id: I656a89ad83069f6794abf4c775a14fb9be2ecba0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1124
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 8 Apr 2019 16:53:56 +0000 (12:53 -0400)]
python-plugin-provider: Make it build
This patch fixes building with --enable-python-plugins.
One problem is that the python plugin provider uses some
functions coming from the internal headers of the lib, which use some
logging functions that are internal to the lib, but not included by
those internal headers. Trying to add the relevant include file
(lib-logging-internal.h) conflicts with python-plugin-provider's own
logger.
python-plugin-provider doesn't really need to have its own logger. Even
though it is built as a separate shared object (so that we can package
it separately), it can be considered as internal to the library (and
that's why it includes some internal lib headers). Therefore, the
easiest way to fix this is to get rid of its logger and make the lib
header files that use lib logging include the required header file
(lib-logging-internal.h).
This requires the python-plugin-provider shared object to access a few
additional symbols not currently exposed by libbabeltrace, which
requires the removal of a few BT_HIDDEN.
I have also included fixes to the python-plugin-provider which I have
on hand. However, it won't work until the Python bindings are up and
running, so I have marked it as skipped.
Change-Id: I9b46d91fc635d670fef2e4d3c8b32203ec34443f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1101
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 29 Apr 2019 21:03:44 +0000 (17:03 -0400)]
Remove clock_class_priority_map.py
This concept no longer exists in the BT api, and therefore this file
won't be needed anymore.
Change-Id: Ib298f5463ee701be3a0a5b3d4b37b6e7ecf8d5b3
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452469
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Sat, 27 Apr 2019 21:04:45 +0000 (17:04 -0400)]
Fix: headers: make static inline upcasts compatible with C++
Issue
=====
There are many static inline functions which upcast a pointer from its
original type to another one known to be a parent. The functions upcast
with `(void *)` or `(const void *)`. While this works in C, it does not
in C++, which is more strict:
In file included from install/include/babeltrace/babeltrace.h:75,
from test.cpp:1:
install/include/babeltrace/trace-ir/field-class-const.h: In function
‘const bt_field_class_enumeration_mapping*
bt_field_class_unsigned_enumeration_mapping_as_mapping_const(const
bt_field_class_unsigned_enumeration_mapping*)’:
install/include/babeltrace/trace-ir/field-class-const.h:100:9:
error: invalid conversion from ‘const void*’ to ‘const
bt_field_class_enumeration_mapping*’ [-fpermissive]
return (const void *) mapping;
Solution
========
Use the new __BT_UPCAST() and __BT_UPCAST_CONST() macros to upcast
within headers. Those macros are defined in `babeltrace/types.h`. We use
static_cast<>() in C++ with the specific destination type, going through
`void *` or `const void *` to keep the same address.
Known drawbacks
===============
None.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iaac8e55635eb2f358a546c32bd886a484f5ebfeb
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452302
Reviewed-by: Simon Marchi <simon.marchi@polymtl.ca>
Philippe Proulx [Sat, 27 Apr 2019 21:03:50 +0000 (17:03 -0400)]
Fix: headers: add missing end of `extern "C"` curly brackets (for C++)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I5f6277ce3075f26bec6507b7b26977d33aea858f
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452301
Reviewed-by: Simon Marchi <simon.marchi@polymtl.ca>
Philippe Proulx [Sat, 27 Apr 2019 20:06:06 +0000 (16:06 -0400)]
Fix: include/Makefile.am: add missing `babeltrace/ctf-writer/object.h`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I29700d6c62b0ebd910b6a6715ab7edbc2126168f
Simon Marchi [Fri, 26 Apr 2019 19:26:51 +0000 (15:26 -0400)]
bt2: Rename files to use singular form
I am mildly annoyed that most Python files use the singular form of the
concept they are related too (component.py, event.py) but others use the
plural form (fields.py, values.py).
Change this to consistently use the singular.
Change-Id: I1a33c47ec45ef3359025e0a66f01eaefc09fecdf
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452257
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 26 Apr 2019 19:08:33 +0000 (15:08 -0400)]
bt2: Mass clock_value -> clock_snapshot rename
The clock_value concept has been renamed to clock_snapshot. Do a mass
rename in the bt2 Python bindings and the associated tests.
Change-Id: I2b275f554c20a12a0f1891c4deed0046e4d3e8e6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452254
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 3 Apr 2019 15:30:40 +0000 (11:30 -0400)]
bt2: Mass field_types -> field_class rename
The concept of field_type has been renamed to field_class. This patch
does a mostly mechanical rename across the Python bindings and their
tests.
Change-Id: I3c2a870262e3cfeddaec7d3565eb635a4c70d131
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452253
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 2 Apr 2019 18:03:30 +0000 (14:03 -0400)]
bt2: Mass notification -> message rename
As the "notification" concept has been renamed to "message", I decided
to do a mass rename (including renaming files). It's quite
straightforward and will reduce a little bit the noise in further
patches.
The changes were done mostly mechanically, but I verified them to make
sure it didn't go too wild (like changing "notifier" to "msgier", which
we wouldn't want).
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I6e6dec1234864400a2570a4726c32a1398cf42c0
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452232
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 26 Apr 2019 14:18:55 +0000 (10:18 -0400)]
bt2: Sync native_bt_field_class.i with field-class-const.h
Commit
2d97b62eea05 ("lib: have dedicated, unique unsigned and signed enum FC mapping objects")
Changed some declarations in field-class-const.h without doing the
corresponding changes in native_bt_field_class.i. I am now seeing this
build error:
bt2/native_bt_wrap.c: In function ‘_wrap_field_class_unsigned_enumeration_borrow_mapping_by_index_const’:
bt2/native_bt_wrap.c:11087:3: error: unknown type name ‘bt_field_class_unsigned_enumeration_mapping_ranges’; did you mean ‘bt_field_class_unsigned_enumeration_mapping’?
bt_field_class_unsigned_enumeration_mapping_ranges **arg4 = (bt_field_class_unsigned_enumeration_mapping_ranges **) 0 ;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bt_field_class_unsigned_enumeration_mapping
Change-Id: I897749a6a7fe5bd1c3c16b1ea9625820e77f112b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452225
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 24 Apr 2019 05:00:45 +0000 (01:00 -0400)]
lib: have dedicated, unique unsigned and signed enum FC mapping objects
This patch makes the enumeration field class mapping API aligned with
the structure field class member and variant field class option APIs. In
other words, a signed or an unsigned enumeration field class mapping is
now a dedicated type. An enumeration field class mapping object is
unique and always belongs to its parent field class.
bt_field_class_unsigned_enumeration_borrow_mapping_by_index_const() and
bt_field_class_signed_enumeration_borrow_mapping_by_index_const() now
return borrowed enumeration field class mapping objects.
You can use
bt_field_class_unsigned_enumeration_mapping_as_mapping_const() to change
a signed or unsigned enumeration field class mapping into a generic
enumeration field class mapping. The API for a generic enumeration field
class mapping is:
const char *bt_field_class_enumeration_mapping_get_label(
const bt_field_class_enumeration_mapping *mapping);
uint64_t bt_field_class_enumeration_mapping_get_range_count(
const bt_field_class_enumeration_mapping *mapping);
You cannot create an enumeration field class mapping object: you still
map a name to a specific range with
bt_field_class_unsigned_enumeration_map_range() and
bt_field_class_signed_enumeration_map_range().
This patch also makes the `flt.lttng-utils.debug-info` and `sink.ctf.fs`
component classes use the updated API.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iba5da648ca69ec0ca0c5df09a9f383dd4b1e3972
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/451996
Simon Marchi [Wed, 3 Apr 2019 18:08:18 +0000 (14:08 -0400)]
tests/bindings/python: Mark all tests as skipped
This patch makes us skip all the Python bindings tests. The goal is for
these commands to run with success (even though they doesn't actually test
anything):
$ tests/bindings/python/bt2/test_python_bt2
$ tests/bindings/python/babeltrace/test_python_babeltrace
The strategy will be to gradually fix the bindings and their tests, and
gradually remove those skip annotations. At any point, we should be
able to run the testsuite with success, ensuring that we don't regress.
After this patch, "make check" is clean for me, with python bindings
enabled (--enable-python-bindings).
I am not sure what is still relevant in the python/babeltrace
directory, I suppose the ctf writer stuff still is. I think we can sort
this out later.
Change-Id: I1169c255c0c7c29fa5de75a358c02c4cd57aae20
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452155
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 25 Apr 2019 21:10:31 +0000 (17:10 -0400)]
bindings/python/bt2: Make the bt2 package importable
This patch changes the minimum necessary to make the bt2 package
importable. In other words, for this command to succeed:
$ tests/utils/test_python_bt2_env python3 -c "import bt2"
In some cases, I've replaced some references to concepts that don't
exist with the new concepts (e.g. some NOTIFICATION_TYPE_* to
MESSAGE_TYPE_*). In other cases, (e.g. fields.py and field_types.py),
it was easier to remove the code, knowing we'll add it back when
tackling the tests that require these files.
After this milestone, we'll be able to at least run some tests that
import the bt2 package, so we'll be able to make sure we don't regress
things while we fix others.
Change-Id: I930d5a4dd129777cb40c607670e27002bb727e39
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452154
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 25 Apr 2019 20:48:17 +0000 (16:48 -0400)]
lib: Fix function name to match declaration
Commit
c4cae502570e ("lib: Fix function name to match declaration")
used an erroneous name for a function definition, this patches fixes it.
Change-Id: I4190b60c9f6db62bf6b50fd095c402494d596a27
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452153
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 1 Apr 2019 19:46:57 +0000 (15:46 -0400)]
Add env wrapper to facilitate importing the in-tree python bindings
The test_python_bt2 script sets up a special environment for running the
Python bindings tests. Crucially, it sets up PYTHONPATH so we are able
to "import bt2" from a Python interpreter. It can be difficult to
reproduce this environment exactly in an interactive shell, or when
trying to run a single test.
This patch introduces test_python_bt2_env, which can be used to run a
command in the same environment. This command can be anything from a
single test run to a sub-shell.
Also, we expect that many Babeltrace tests will test some non-Python
features using Python, for convenience. These tests will also need to
run in the right environment to be able to import the bt2 Python
package. Therefore, I think it makes sense to put it under tests/utils.
Once the bindings and their tests work better, we should make
the test_python_bt2 script use test_python_bt2_env, to avoid the duplication, but
for now I prefer to leave it as-is.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I4e1655614756d638ef6bb9a4426719d4b754aa4b
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452152
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 22 Apr 2019 15:17:23 +0000 (11:17 -0400)]
bindings/python/bt2: Make the bt2 Python bindings build
This patch is just a little bit more than the bare minimum to make the
Python bindings build (that is, configure with --enable-python-bindings
and build). It consists of sync'ing the .i SWIG interface definition
files with the corresponding headers. It's possible that the interfaces
are incomplete, in which case they'll be adjusted in the a later pass.
For example, output parameters are currently not named in a way that
match the type maps.
For simplicity, I have included at the same time some other changes to
the .i files, such as adjusting the typemap definitions (in
native_bt.i). The helper functions (such as at the bottom of
native_bt_componentclass.i) are also changed to the "final" form they
have on my development branch. Even though these are not immediatly used,
they need to be changed for the bindings to build.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I87a438a692690639f956b214f878df65885ed78c
Simon Marchi [Wed, 3 Apr 2019 16:08:11 +0000 (12:08 -0400)]
lib: Make bt_value_null a const pointer
We probably don't want anything to change the value of this pointer,
which points to the only instance of BT_VALUE_TYPE_NULL,
bt_value_null_instance. Therefore, declare it as a constant value.
It also helps a little bit the Python bindings: if we copy the
declaration verbatim to the .i file, without const, bt_value_null is
available through the special "cvar" global object (and can be
modified!). With const, it becomes read-only, so can be accessed
directly as native_bt.value_null.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Simon Marchi [Thu, 25 Apr 2019 15:00:02 +0000 (11:00 -0400)]
ctf: Add dash to stream name suffixes
We add numerical suffixes to stream names, if needed, to make them
unique. For trace directories, we do something similar and decided to
format these suffixes with a dash to avoid confusion if the original
name ends with a number. This patch does the same thing but for stream
names.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I3041fe98bbeb3c122d06e5fa54449ed6e55017bd
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452110
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 23 Apr 2019 13:32:58 +0000 (09:32 -0400)]
ctf: Use environment fields provided by LTTng to make output trace path
Starting with version 2.11, the LTTng tracer includes in the trace
environment all the information necessary to rebuild the output path
that it itself uses when outputting traces. This lets us recreate an
output path similar to what LTTng does when outputting ctf traces (with
the exception that we also add a level with the hostname, which LTTng
doesn't).
If the trace does not come from LTTng, or comes from LTTng < 2.11, we
keep using the same strategy: use a trace path based on the trace name,
which is itself based on the original directory.
This feature will especially be useful in conjunction with session
rotation: since the input trace is actually composed of multiple
traces/chunks, the trace name would otherwise be based on one particular
of these chunks. With the environment values, we can recreate a path
that describes correctly the trace as a whole. The output path is then
similar to what one would have been output by LTTng, if one had not used
the session rotation feature in the first place.
Change-Id: I03c0569869561ec11873b808c47d30196889cb36
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/451942
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Thu, 25 Apr 2019 00:55:47 +0000 (20:55 -0400)]
cli: put space after comma between array elements
This is more readable when looking at the output of `--run-args`.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I75a4622fb2f2c864f4af1599c18044bb696c3307
Philippe Proulx [Thu, 25 Apr 2019 00:50:39 +0000 (20:50 -0400)]
Fix: test_convert_args: fix malformed test line
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ia164a1703d12f0e3caff9e9d6fcd9a5c6deb58fd
Philippe Proulx [Thu, 25 Apr 2019 00:38:13 +0000 (20:38 -0400)]
test_convert_args: test multiple leftover arguments
When `babeltrace convert` is given multiple leftover arguments:
babeltrace /path/to/trace1 /path/to/trace2 /path/to/trace3
it configures a single `src.ctf.fs` component with a `paths` array
parameter containing the three paths.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I0c19c730bc276dba7160b9efcb72dc8077c078f5
Philippe Proulx [Thu, 25 Apr 2019 00:34:12 +0000 (20:34 -0400)]
Fix: test_convert_args: fix expected arguments
Changes:
* `src.ctf.fs` paths are given as an array now.
* What used to be `params=...` is now two arguments: `--params ...`.
* There's a new default parameter when instantiating a
`src.ctf.lttng-live` component: `session-not-found-action="end"`.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ic08db60b280ca9babb1ddc21829392d14a0d3fd3
Francis Deslauriers [Wed, 24 Apr 2019 20:13:07 +0000 (16:13 -0400)]
cli: mimic behavior of BT1 when trying to attach to live session
In Babeltrace 1, when trying to attach to a LTTng live session the
`babeltrace` command would exit with status 0 (SUCCESS) if it
successfully connected to the relay daemon _even if_ it did not find the
requested session.
To mimic the behavior of BT1, we set the `session-not-found-action`
parameter to "end". This makes the message iterator of an lttng-live
component return a END status if the requested session is not found
on the relay daemon and makes the cli return gracefully with SUCCESS.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I3b3810f97c090d102fd30902fda37434f62d5c01
Simon Marchi [Tue, 16 Apr 2019 20:16:01 +0000 (16:16 -0400)]
plugins/ctf/fs-src: Session rotation support: merge traces with same uuid
This patch makes the src.ctf.fs component merge traces that have the
same UUID, with the intent of supporting traces output by LTTng's
session rotation feature.
When using this feature of LTTng, the user ends up with multiple traces
that are independent (with their own metadata and data files), except
for the fact that they share the same trace uuid. The goal of this
patch is to make Babeltrace realize this and make all those traces
appear as a single trace.
The approach taken is to scan the search paths (passed as parameter to
the component) as usual and create a ctf_fs_trace for each found trace.
We then go over the list of traces in the component and merge those
having the same UUID.
Merging traces consists of merging corresponding data stream file groups
(ctf_fs_ds_file_group structs). Two ctf_fs_ds_file_group structs are
corresponding if they have the same stream_id (aka stream_instance_id in
CTF) and stream class id.
Merging two ctf_fs_ds_file_group structs consists of merging their list
of ctf_fs_ds_file_info structs, making sure to keep the resulting list
sorted by begin timestamp.
Since the trace-info query also uses create_ctf_fs_traces, its behavior
is updated as expected. Doing a trace-info on a directory containing
multiple traces with the same UUID will result in a single trace with
multiple files per stream. A little drawback/inconsistency that will be
address later is that the trace object in the output has a single
"path", which is set to the path of one of the original traces.
Ideally, it should have also have a list of paths and list all the
paths of the "physical" traces that form this "logical" trace.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ib290cf08119f9be4344057b2544b4627eea3f450
Simon Marchi [Tue, 23 Apr 2019 16:03:29 +0000 (12:03 -0400)]
cli, plugins/ctf/fs-src: Make src.ctf.fs accept multiple root paths
A following patch will make it possible to process multiple traces that
share the same UUID as a single trace. One requirement is to be able to
do this event when passing multiple arguments, like:
babeltrace path1 path2 ...
With the current code, this instantiates two src.ctf.fs components, and
therefore makes it impossible to do this merging by UUID.
This patch therefore changes the design so that we only instantiate a
single src.ctf.fs component and pass an array with the paths.
We also need to make the trace-info query support receiving multiple
paths. One reason is that in general, we want trace-info queries to
support the same parameters as the components. A more pragmatic reason
is that it will need to do the same kind of UUID-merging anyway. I
therefore made the trace-info query re-use more of the code used by the
component to locate and create the ctf_fs_trace list. One difference
between the two usages is that in the case of the query, we don't want
to create IR streams or component ports. I moved those outside of the
shared code path and made the component do that as a separate step.
One notable change in babeltrace.c is in set_stream_intersections.
We previously extracted the "path" parameter from the component creation
parameter, to make the query parameters. Instead, we now directly pass
the component creation parameters to the query. The idea is the same as
above, we want to pass the same parameters to the trace-info query as
what will be used to create the component, since it might alter how the
traces will be open, and therefore the results.
So in practice the changes boil down to:
- babeltrace-cfg-cli-args.c: Make it possible to serialize bt_value of
type BT_VALUE_TYPE_ARRAY, so we can build the list of paths in a
bt_value array, then serialize it to send it to "babeltrace run".
Make it instantiate a single ctf component, this even simplifies the
code a little bit.
- fs.c: Accept "paths" parameter with a list of paths, rather than
"path" with a single path, iterate on that list to find traces and
create trace objects just as before. Separate creation or IR streams
and component ports from the ctf_fs_trace creation.
- query.c: Re-use more of fs.c's functions to locate and create
ctf_fs_trace objects.
There are no functional changes intended, except if you are the kind of
person to pass params by hand to the src.ctf.fs component.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Simon Marchi [Tue, 23 Apr 2019 15:16:00 +0000 (11:16 -0400)]
cli: Make append_parameter_to_args accept a bt_value value
append_parameter_to_args is used to append a --params=KEY=VALUE argument
to a list of arguments. It currently assumes that VALUE is a simple
string. We will want to generalize this to support arrays (in the form
of a bt_value of type array). This patch does a bit of refactoring in
preparation of that, making append_parameter_to_args accept a value of
type bt_value* instead of const char*.
append_string_parameter_to_args is introduced as a wrapper, for those
spots that still want to pass a simple string value. It converts the
string to a temporary bt_value of type string.
No functional changes intended.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Simon Marchi [Tue, 9 Apr 2019 23:00:33 +0000 (19:00 -0400)]
cli: Remove support for --key and --value arguments
There are currently two ways of passing parameters to the current
component on the Babeltrace command line:
--params=KEY=VALUE
--key KEY --value VALUE
The method with --params is more versatile, as VALUE can have different
types (string, number, bool). The value in the --key/--value method is
always converted to a string.
This patch removes the less-versatile --key/--value way, in order to
keep only --params.
I have remove or updated references to --key/--value in man pages. The
only remaining mention of --key/--value that I know of is in
babeltrace-log.c, which I was told is going to disappear anyway, so I
have left it.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Simon Marchi [Tue, 23 Apr 2019 14:14:08 +0000 (10:14 -0400)]
cli: Support arrays in parameters
This patch adds support for arrays in the parameters one can pass to
components on the Babeltrace command line. For example:
--params="value=[1,2,\"Hello\"]"
When we are starting to parse a value and the token is a '[', we start
parsing it as an array. We accept comma-separated values until we reach
the matching ']'. The code should be pretty self-explanatory/commented.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Simon Marchi [Tue, 23 Apr 2019 14:03:34 +0000 (10:03 -0400)]
cli: Adjust integer range check, replace magic numbers with constants
The value (1ULL << 63) - 1), used for checking that integer values are
within range, actually mean INT64_MAX, so use that instead.
Also, the negative case is not quite right: the value -(INT64_MAX + 1),
-
9223372036854775808, is within the range of a signed 64-bits number
(assuming two's complement), but is not accepted right now. Adjust the
check so it accepts that value.
I tested this patch manually: we accept -
9223372036854775808 but reject
-
9223372036854775809.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Simon Marchi [Tue, 23 Apr 2019 14:09:33 +0000 (10:09 -0400)]
cli: Refactor command line value parsing code
This patch breaks out the code that parses values from the command line
to bt_value objects. It introduces a new function which returns a
parsed value directly as a bt_value.
This enables the following patch to introduce support for arrays, by
having this function call itself recursively.
No functional changes intended.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Simon Marchi [Mon, 22 Apr 2019 14:41:39 +0000 (10:41 -0400)]
cli: Refactor handling of negative numbers
This patch breaks out the code that reads a number just after having
read the minus sign introducing a negative number.
Instead of keeping a state in the parser, and going through a new
iteration, we call the new function which returns a bt_value directly.
This enables the following patch to do a similar change, but for the
parsing of all values (which includes the parsing of negative numbers).
In turn, this will allow parsing values recursively, which is needed to
support array values. Orthogonally, I think the code is easier to
follow this way.
No functional changes intended.
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Philippe Proulx [Wed, 24 Apr 2019 17:59:38 +0000 (13:59 -0400)]
Fix: tests/Makefile.am: do not run missing `flt.utils.muxer`
This test does not exist anymore.
Most plugins will be tested in Python or even in Bash with a specific
testing sink component class.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Mon, 4 Mar 2019 16:02:10 +0000 (11:02 -0500)]
Adapt `src.ctf.lttng-live` to current API
A `src.ctf.lttng-live` component now ensures the monotonic ordering of
the timestamps its outgoing messages. The component can receive messages
from multiples viewer session (UST 64bit, UST 32bit and/or Kernel) that
in turn may contain one or more traces that in turn may contain one or
more streams of messages. Messages from all these streams have to be
ordered into a single flow of messages where every message has a
timestamp equal or larger than the previous one.. This muxing is done by
tracking the next message of each of the live stream iterator and
returning the message with the smallest timestamp.
The live viewer sessions and everything required to get data and
metadata from the LTTng Relay daemon are now owned by the message
iterator and not the component as it was before.
Parameters
==========
The `url` mandatory string parameter controls the URL of the LTTng Relay
Daemon to which the component should register to received traces.
The `session-not-found-action` optional string parameter controls the
behavior of the component in case the requested session is not
configured on the LTTng Relay Daemon. The three accepted value of this
parameter are: "continue", "fail", and "end".
continue: The message iterator will try to connect (or reconnect) to
the requested session for ever.
fail: The message iterator will return an ERROR status if the session
is not available at the message iterator initialization stage and
return END status when the session is no longer available.
end: The message iterator always returns END status if the session is
not found or is no longer available.
The `session-not-found-action` defaults to "continue" if not specified.
Future improvement
==================
Using a priority queue to order the messages would speed up the muxing
of messages.
Known limitation
================
If a new live stream iterator returns a message that has a timestamp
smaller (that happened before) than the last message forwarded
downstream but the `src.ctf.lttng-live` message iterator. The message
iterator will return with an error status. I am not sure if this
situation can happen in a single host configuration (which is the only
supported configuration).
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Francis Deslauriers [Mon, 22 Apr 2019 20:21:07 +0000 (16:21 -0400)]
sink.text.pretty: print inactivity msg handling with BT_LOGD_STR
Instead of printing that the component received a message iterator
inactivity message to standard error; log this information with
BT_LOGD().
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Francis Deslauriers [Mon, 1 Apr 2019 13:58:02 +0000 (09:58 -0400)]
graph: Fix: bt_graph_configure() does not propagate errors
Issue
=====
When configuring the graph, message iterator initialize functions may fail
and return an error status (e.g. _STATUS_NOMEM and _STATUS_ERROR). Those
error status are not propagated back to the caller of
`bt_graph_configure()` function. The caller that will consider the graph
to be configured properly and run it will it assertions down the road.
Solution
========
Return `BT_GRAPH_STATUS_ERROR` if any of the sinks returned a non-OK
status from its `graph_is_configured()` function.
Known drawbacks
===============
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Francis Deslauriers [Wed, 24 Apr 2019 15:16:48 +0000 (11:16 -0400)]
Fix: flt.lttng-utils.debug-info: leaking `bin_dir` char array
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Francis Deslauriers [Wed, 24 Apr 2019 14:54:31 +0000 (10:54 -0400)]
Fix: flt.lttng-utils.debug-info: ".debug" extension not appended
Issue
=====
The g_strconcat() function returns a newly allocated string and does not
change the string in place as the code seems to assume. This results in
the call to g_strconcat() having no effects. Because of this, the
".debug" extension is not appended to the file name resulting in a
failure find the file on the file system.
Ignoring the return value of this call also results in the leaking of
the resulting char array.
Solution
========
Use g_snprintf() instead to concatenate the file name and its extension.
Known drawbacks
===============
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Philippe Proulx [Wed, 24 Apr 2019 04:19:06 +0000 (00:19 -0400)]
lib: field path: have a specific item for "current array element"
This patch makes a field path object have a list of items, which are
unique objects, instead of simple member/choice indexes. One type of
item is an index item (which contains only a structure member or variant
choice index) while the other is a "current array element" item.
The previous algorithm to "walk" a field path from a known root field
or field class was (Python pseudocode):
current_fc = root_fc
i = 0
while i < len(field_path):
index = field_path[i]
if type(current_fc) is in (StructureFieldClass, VariantFieldClass):
current_fc = current_fc[index]
i += 1
else:
current_fc = current_fc.element_field_class
As you can see, there's no special field path index to indicate that
we're in the current element of an array: you just pass through arrays
without "consuming" a field path index.
In TSDL, it can happen like this:
fields := struct {
struct {
int abc;
int len;
string strings[len];
} s[4];
};
Currently, the field path of the `strings` dynamic array is:
event payload: [0, 1]
With this patch, the same field path becomes:
event payload: [0, <CUR>, 1]
and the walking algorithm above becomes:
current_fc = root_fc
for item in field_path:
if type(current_fc) is in (StructureFieldClass, VariantFieldClass):
assert(type(item) is IndexFieldPathItem)
current_fc = current_fc[item.index]
else:
assert(type(item) is CurrentArrayElementFieldPathItem)
current_fc = current_fc.element_field_class
or it could also be:
current_fc = root_fc
for item in field_path:
if type(item) is IndexFieldPathItem:
current_fc = current_fc[item.index]
else:
assert(type(item) is CurrentArrayElementFieldPathItem)
current_fc = current_fc.element_field_class
There is no special case with this now more complete field path.
I also intend to have something like this in CTF 2. Currently, CTF 1.8
does not allow a relative field path to be rewritten as an absolute
field path if it's in an array. For example, you could not rewrite the
TSDL example above as:
fields := struct {
struct {
int abc;
int len;
string strings[event.fields.s.len];
} s[4];
};
Babeltrace 1 does not accept this, so Babeltrace 2 does not either, and
I don't think CTF is designed this way. I think it's limiting, so I'm
making this patch to accommodate CTF 2 in the future.
This patch also opens the door to having other types of field path items
in the future, like any element within an array (as long as it's before
the requesting dynamic array or variant field), so that you could have:
event payload: [1, 3, 0]
^ ^ ^-- first member of a structure
| `----- fourth element of an array
`-------- second member of a structure
This patch also makes the `flt.lttng-utils.debug-info` and `sink.ctf.fs`
component classes use the modified API.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Tue, 23 Apr 2019 23:54:42 +0000 (19:54 -0400)]
Fix: bfcr_get_sequence_length_cb(): do not set text array's length
Issue
=====
In `msg-iter.c`, bfcr_get_sequence_length_cb() gets called when starting
the decoding of any sequence, including text sequences. However, text
arrays are translated into trace IR string field classes.
bfcr_get_sequence_length_cb() calls bt_field_dynamic_array_set_length()
unconditionally, but its field argument can be a string field at this
point. This is a precondition break.
Solution
========
In bt_field_dynamic_array_set_length(), only call
bt_field_dynamic_array_set_length() if the CTF IR field class is NOT a
text sequence. I'm also adding an assertion to confirm that the trace IR
field is a dynamic array field.
Known drawbacks
===============
None.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Tue, 23 Apr 2019 22:00:34 +0000 (18:00 -0400)]
Fix: `tests/Makefile.am`: do not run missing tests
Test sources were removed, but they are still mentioned in this file, so
`make check` cannot find them.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Tue, 23 Apr 2019 21:57:44 +0000 (17:57 -0400)]
Fix: `tests/ctf-traces/succeed` traces: change CTF version from 0.1 to to 1.8
This version of CTF, 0.1, never really existed. Also, the first lines of
the `metadata` files changed by this patch already contain `CTF 1.8`,
indicating that this is a bug in the `trace` block.
Somehow Babeltrace 1 is less strict than Babeltrace 2 and accepts those
traces. We take the deliberate decision to refuse them.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Tue, 23 Apr 2019 21:46:00 +0000 (17:46 -0400)]
Fix: `test_packet_seq_num.in`: change expected disc. packets messages order
Issue
=====
The `test_packet_seq_num` test expects that Babeltrace reports 3, 2, and
1 discard packets in three different messages for CTF trace
`2_streams_lost_in_2`. Babeltrace 1 reports this, but Babeltrace 2
reports 2, 3, and 1.
I believe it's a bug in Babeltrace 1 because it also reports time ranges
which cover the packets which have an unexpected sequence number.
For example, Babeltrace 1:
[warning] Tracer lost 3 trace packets between [06:15:09.
000000090]
and [06:15:09.
000000110] in trace UUID
eb5045f7b471488eb963221ddf423a7, at path:
"../ctf-traces/packet_seq_num/2_streams_lost_in_2", within stream id
0, at relative path: "test_stream_1". You should consider recording
a new trace with larger buffers or with fewer events enabled.
Babeltrace 2:
WARNING: Tracer discarded 3 packets between [06:15:09.
000000090] and
[06:15:09.
000000091] in trace "2_streams_lost_in_2" (UUID:
eb5045f7-b471-488e-b963-
0221ddf423a7) within stream
"/home/eepp/dev/babeltrace/tests/ctf-traces/packet_seq_num/2_streams_lost_in_2/test_stream_1"
(stream class ID: 0, stream ID: 1).
The `test_packet_seq_num` test does not check the reported time ranges,
but this shows that the packet sequence number check might not be done
at the same time in Babeltrace 1 and Babeltrace 2. Because the test
trace contains two data streams with an intersection, and packets were
discarded in this intersection, the order of the warnings is not
guaranteed to be the same.
The time ranges reported by Babeltrace 2 are correct, however. In the
example above, it's okay to report that three packets were discarded
between 06:15:09.
000000090 and 06:15:09.
000000110, but it's even more
precise to report that they were discarded between 06:15:09.
000000090
and 06:15:09.
000000091. The time range of the packet with an unexpected
sequence number is 06:15:09.
000000091 to 06:15:09.
000000110.
Solution
========
Change the test so that it expects 2, 3, and 1 now.
Known drawbacks
===============
Some incompatibility with Babeltrace 1 regarding the order of the
warnings printed by `sink.text.pretty`. However, the locations and the
time ranges of the messages in Babeltrace 2's output are correct.
Most tools and scripts which rely on Babeltrace's text output only check
if there's something (anything) written to the standard error stream
anyway to detect a problem. LTTng analyses is one of those.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.053998 seconds and 4 git commands to generate.