babeltrace.git
6 years agoFix: writer.py: make `uint64_ft` a 64-bit (instead of 32-bit) int FT
Philippe Proulx [Thu, 9 Nov 2017 16:24:30 +0000 (11:24 -0500)] 
Fix: writer.py: make `uint64_ft` a 64-bit (instead of 32-bit) int FT

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: Replace bt_timegm with a thread-safe implementation
Michael Jeanson [Mon, 13 Nov 2017 20:17:47 +0000 (15:17 -0500)] 
Fix: Replace bt_timegm with a thread-safe implementation

The current compat wrapper for timegm is not thread-safe, it modifies
the process wide time settings with tzset. This was not a problem in bt1
as it was only used in the cli binary but it is now used in the trimmer
plugin which is used by the library.

Replace the wrapper with a basic implementation and add more tests.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTypo: informations -> information
Michael Jeanson [Mon, 13 Nov 2017 23:23:56 +0000 (18:23 -0500)] 
Typo: informations -> information

Information is an uncountable noun in english.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTypo: paramater -> parameter
Michael Jeanson [Mon, 13 Nov 2017 23:22:42 +0000 (18:22 -0500)] 
Typo: paramater -> parameter

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTypo: priorty -> priority
Michael Jeanson [Thu, 12 Oct 2017 21:15:25 +0000 (17:15 -0400)] 
Typo: priorty -> priority

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: uninitialized variable may be used warning
Jérémie Galarneau [Wed, 8 Nov 2017 15:55:16 +0000 (10:55 -0500)] 
Fix: uninitialized variable may be used warning

gcc 7.2 warns of potentially uninitialized variables being
used as the callers rely on output parameters being
initialized by the callees on error. This behaviour is not
specified as part of the API so relying on this is iffy.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agocli: support --output opt. for -o ctf-metadata and -i lttng-live
Philippe Proulx [Tue, 7 Nov 2017 19:57:32 +0000 (14:57 -0500)] 
cli: support --output opt. for -o ctf-metadata and -i lttng-live

Babeltrace 1 supports the -w/--output option to print the metadata text
or the available LTTng live sessions to a file instead of the standard
output.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: doc/man/Makefile.am: use appropriate variable for sources
Philippe Proulx [Thu, 2 Nov 2017 17:37:47 +0000 (13:37 -0400)] 
Fix: doc/man/Makefile.am: use appropriate variable for sources

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAdd basic flt.lttng-utils.debug-info tests
Philippe Proulx [Thu, 2 Nov 2017 17:20:18 +0000 (13:20 -0400)] 
Add basic flt.lttng-utils.debug-info tests

This new test uses the bt2 Python bindings to test the
flt.lttng-utils.debug-info component class. The test opens the
tests/debug-info-data/trace trace and makes it pass through a
flt.lttng-utils.debug-info component to inject debugging information.
The test then checks that specific debugging information fields in
specific event notifications have the expected values.

This patch also removes the old tests/cli/test_debug_info.in test which
is not even enabled and relied on the output of sink.text.pretty.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agobt2: TraceCollectionNotificationIterator: support custom filter CCs
Philippe Proulx [Thu, 2 Nov 2017 17:14:54 +0000 (13:14 -0400)] 
bt2: TraceCollectionNotificationIterator: support custom filter CCs

This patch adds an optional `filter_component_specs` parameter to
TraceCollectionNotificationIterator's constructor so that the trace
collection notification iterator supports a chain of custom filter
components. The filter chain is connected to the implicit muxer's output
port or to the implicit trimmer's output port if it exists.

This is useful to add debugging information, for example:

    src = bt2.ComponentSpec('ctf', 'fs', trace_path)
    flt = bt2.ComponentSpec('lttng-utils', 'debug-info')
    it = bt2.TraceCollectionNotificationIterator(src, flt)

    for notif in it:
        ...

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: debug-info: remove `_` prefix when finding fields by name
Philippe Proulx [Thu, 2 Nov 2017 15:30:38 +0000 (11:30 -0400)] 
Fix: debug-info: remove `_` prefix when finding fields by name

The CTF plugin source components now remove the `_` prefix from field
names, so that other downstream components should not expect it as it's
an escaping mechanism in CTF 1.8.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoRemove doc/API.txt (Babeltrace 1.x API documentation)
Philippe Proulx [Thu, 5 Oct 2017 21:02:15 +0000 (17:02 -0400)] 
Remove doc/API.txt (Babeltrace 1.x API documentation)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAdd modern Babeltrace man pages
Philippe Proulx [Tue, 28 Feb 2017 19:41:57 +0000 (14:41 -0500)] 
Add modern Babeltrace man pages

The configuration to generate man pages from their AsciiDoc sources is
the same as the LTTng-tools setup, although doc/man/README.adoc is
specific to the Babeltrace project.

See doc/man/README.adoc for more details.

This patch also removes legacy documentation files of which the content
is now in the new man pages.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoRemove `PLUGIN` from component class log level environment variables
Philippe Proulx [Thu, 5 Oct 2017 18:05:42 +0000 (14:05 -0400)] 
Remove `PLUGIN` from component class log level environment variables

For example, `BABELTRACE_PLUGIN_CTF_FS_SRC_LOG_LEVEL` becomes
`BABELTRACE_SRC_CTF_FS_LOG_LEVEL`. This is in line with the way we
specify the component classes in the CLI and documentation, for
example `src.ctf.fs`.

The log level environment variables common to a whole plugin are still
prefixed with `PLUGIN`, for example
`BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL`.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agosink.text.dmesg: remove `read-from-stdin` parameter, use absent `path`
Philippe Proulx [Thu, 5 Oct 2017 04:15:23 +0000 (00:15 -0400)] 
sink.text.dmesg: remove `read-from-stdin` parameter, use absent `path`

We don't need separate `path` and `read-from-stdin` parameters for
this component class: if `path` is absent, read from standard input.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoLazy load the python plugin provider
Michael Jeanson [Mon, 2 Oct 2017 21:28:17 +0000 (17:28 -0400)] 
Lazy load the python plugin provider

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: no sighandlers on Windows
Michael Jeanson [Mon, 2 Oct 2017 18:12:43 +0000 (14:12 -0400)] 
Port: no sighandlers on Windows

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: normalize path in test_plugin_bt2
Michael Jeanson [Mon, 2 Oct 2017 17:52:14 +0000 (13:52 -0400)] 
Port: normalize path in test_plugin_bt2

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: fix library load in python tests on Windows
Michael Jeanson [Mon, 2 Oct 2017 17:11:42 +0000 (13:11 -0400)] 
Port: fix library load in python tests on Windows

On Windows, the PATH variable is used to load library dependencies at runtime.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: use configured python in test_python_plugin_provider
Michael Jeanson [Mon, 2 Oct 2017 16:59:30 +0000 (12:59 -0400)] 
Fix: use configured python in test_python_plugin_provider

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: open files in binary mode on Windows
Michael Jeanson [Thu, 15 Sep 2016 15:11:29 +0000 (15:11 +0000)] 
Port: open files in binary mode on Windows

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: ctf: notif-iter: do not call request_medium_bytes() when not needed
Philippe Proulx [Wed, 4 Oct 2017 00:10:17 +0000 (20:10 -0400)] 
Fix: ctf: notif-iter: do not call request_medium_bytes() when not needed

Do not systematically call request_medium_bytes(), that is, at the
beginning of read_dscope_begin_state(), because the scope field which is
about to be decoded might be empty, an already aligned structure
field or the equivalent (through a variant field for example, of which
the tag is outside this scope).

To do this we also need to make bt_btr_start() accept a size of 0. In
this case, if the field to decode is an empty structure which is already
aligned, then bt_btr_start() does not need to consume any bit and
returns BT_BTR_STATUS_OK with 0 consumed bits. In this case, the next
notif-iter state is not a continuing state, thus request_medium_bytes()
is not called yet.

Checking for a bad state when request_medium_bytes() receives
BT_NOTIF_ITER_MEDIUM_STATUS_EOF from the medium is easier. Good states
are:

* If the current packet size is set:
** Current packet offset is current packet size.
* Otherwise:
** Current packet offset is 0.
** Last event header offset is set and current offset is equal to it.

All other states are invalid.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoflt.lttng-utils.debug-info: `dir`/`debug-dir` param -> `debug-info-dir`
Philippe Proulx [Mon, 2 Oct 2017 20:03:40 +0000 (16:03 -0400)] 
flt.lttng-utils.debug-info: `dir`/`debug-dir` param -> `debug-info-dir`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agocli: do not automatically create an implicit filter.lttng-utils.debug-info comp.
Philippe Proulx [Mon, 2 Oct 2017 17:18:39 +0000 (13:18 -0400)] 
cli: do not automatically create an implicit filter.lttng-utils.debug-info comp.

Remove --no-debug-info option, and add --debug-info option to explicitly
enable this filter.

Fix tests/cli/test_convert_args.in which now does not depend on
ENABLE_DEBUG_INFO.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoctf, ir: escape and unescape enumeration FT labels starting with `_`
Philippe Proulx [Mon, 2 Oct 2017 16:57:12 +0000 (12:57 -0400)] 
ctf, ir: escape and unescape enumeration FT labels starting with `_`

This is a solution to work with TSDL 1.8 which asks identifiers starting
with `_` to be named without the `_` for viewing and analysis purposes.
Since a variant FT can refer to an enumeration FT tag which also has its
labels starting with `_`, we systematically remove leading `_` in
enumeration FT labels too.

For example:

    enum {
        _salut,
        hello,
        __zoom,
        _integer,
    } tag;

    variant <tag> {
        A _salut;
        B hello;
        C __zoom;
        D _integer;
    } var;

Once in CTF IR, the equivalent is:

    enum {
        salut,
        hello,
        _zoom,
        integer,
    } tag;

    variant <tag> {
        A salut;
        B hello;
        C _zoom;
        D integer;
    } var;

Once back to TSDL (through CTF writer), it is:

    enum {
        salut,
        hello,
        __zoom,
        _integer,
    } tag;

    variant <tag> {
        A salut;
        B hello;
        C __zoom;
        D _integer;
    } var;

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agocli: --stream-intersection is not an implicit src.ctf.fs component's option
Philippe Proulx [Thu, 28 Sep 2017 13:36:22 +0000 (09:36 -0400)] 
cli: --stream-intersection is not an implicit src.ctf.fs component's option

You can use the --stream-intersection option with any source component
class which supports the `trace-info` query, not just with src.ctf.fs.
Also, using --stream-intersection does not imply a src.ctf.fs component
like --clock-class-offset-s does for example.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agocli: do not use --component in help command, only use leftover argument
Philippe Proulx [Wed, 20 Sep 2017 00:04:03 +0000 (20:04 -0400)] 
cli: do not use --component in help command, only use leftover argument

Options should be used for optional arguments. In the case of
`babeltrace help`, the component class specification is mandatory when
you don't want help about a plugin, so use the first positional
"leftover" argument.

First try the TYPE.PLUGIN.COMPCLS form, then fallback to PLUGIN if it's
invalid.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAdd compat layer's log level env. var. to CLI's list of known env. vars
Philippe Proulx [Tue, 19 Sep 2017 20:10:08 +0000 (16:10 -0400)] 
Add compat layer's log level env. var. to CLI's list of known env. vars

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agocli: put the project's version on the first line with no args.
Philippe Proulx [Mon, 25 Sep 2017 19:44:47 +0000 (15:44 -0400)] 
cli: put the project's version on the first line with no args.

This is to ensure backward compatibility with Babeltrace 1.x, especially
for the LTTng analyses project which check the Babeltrace's version this
way because of a missing --version option.

Reported-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: legacy python bindings Makefile
Michael Jeanson [Thu, 21 Sep 2017 19:09:38 +0000 (15:09 -0400)] 
Fix: legacy python bindings Makefile

No need for build_ext, this is a pure python module.
Add missing stamp file to CLEANFILES.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agobt2, babeltrace: apply PEP 8 except for E501 and E722
Philippe Proulx [Fri, 22 Sep 2017 19:37:52 +0000 (15:37 -0400)] 
bt2, babeltrace: apply PEP 8 except for E501 and E722

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: babeltrace: writer.py: do not use += on bt2.trace._TraceEnv
Philippe Proulx [Fri, 22 Sep 2017 19:08:14 +0000 (15:08 -0400)] 
Fix: babeltrace: writer.py: do not use += on bt2.trace._TraceEnv

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agobindings/python/babeltrace/Makefile.am: do not clean __init__.py
Philippe Proulx [Fri, 22 Sep 2017 05:24:04 +0000 (01:24 -0400)] 
bindings/python/babeltrace/Makefile.am: do not clean __init__.py

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoRename bt_ctf_X -> bt_X, maintain backward compat. for pre-2.0 CTF writer
Philippe Proulx [Fri, 22 Sep 2017 00:51:34 +0000 (20:51 -0400)] 
Rename bt_ctf_X -> bt_X, maintain backward compat. for pre-2.0 CTF writer

This patch replaces the `bt_ctf_` prefix with `bt_` for all the
functions, types, and enumerations. It also replaces the `BT_CTF_`
prefix with `BT_` for all the preprocessor definitions and enumerators.

Since there is only one IR as of Babeltrace 2, there is no need for this
superfluous prefix: there's no confusion without it, and it might even
be more straightforward for the newcomer to see `bt_trace` instead of
`bt_ctf_trace`, for example.

Backward compatibility is maintained with the help of specific
preprocessor definitions placed in each relevant public header file to
create aliases for legacy function names, type names, enumerator names,
and preprocessor definition names. Because Babeltrace 2 asks current
applications to be rebuilt anyway (soname is bumped), it is okay to lose
some symbol names as long as the API is equivalent.

The only possible issue that I can see is if an application uses a new
API name as a variable name, for example:

    struct bt_ctf_trace bt_ctf_trace;
    struct something_else bt_trace;

This is an error after this patch is applied because, after the
preprocessor pass, it is the equivalent of:

    struct bt_trace bt_trace;
    struct something_else bt_trace;

because of (include/babeltrace/ctf-ir/trace.h):

    #define bt_ctf_trace bt_trace

which affects both the type name and the variable name. This should not
be a problem in most cases, and it is easy to fix otherwise.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: variable declaration shadows previously declared variable
Jérémie Galarneau [Thu, 5 Oct 2017 20:39:39 +0000 (16:39 -0400)] 
Fix: variable declaration shadows previously declared variable

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: use tabs rather than spaces in makefile
Mathieu Desnoyers [Wed, 20 Sep 2017 17:58:43 +0000 (13:58 -0400)] 
Fix: use tabs rather than spaces in makefile

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reported-by: Jonah Caplan <jcaplan@blackberry.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: do not depend on GNU readlink
Michael Jeanson [Tue, 19 Sep 2017 20:26:30 +0000 (16:26 -0400)] 
Port: do not depend on GNU readlink

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: use the configured swig executable
Michael Jeanson [Mon, 18 Sep 2017 21:28:13 +0000 (17:28 -0400)] 
Fix: use the configured swig executable

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTests python: reference ctf traces are not copied to the build dir
Jérémie Galarneau [Mon, 18 Sep 2017 21:36:38 +0000 (17:36 -0400)] 
Tests python: reference ctf traces are not copied to the build dir

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: tests/Makefile.am: add missing LOG_DRIVER
Philippe Proulx [Mon, 18 Sep 2017 21:27:28 +0000 (17:27 -0400)] 
Fix: tests/Makefile.am: add missing LOG_DRIVER

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTests: moved files pointed-to in Makefile
Jérémie Galarneau [Mon, 18 Sep 2017 21:15:49 +0000 (17:15 -0400)] 
Tests: moved files pointed-to in Makefile

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython babeltrace docs: Add missing sphinx dist file
Jérémie Galarneau [Mon, 18 Sep 2017 21:14:59 +0000 (17:14 -0400)] 
Python babeltrace docs: Add missing sphinx dist file

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDoc: babeltrace: update the Read the Docs Sphinx theme
Philippe Proulx [Mon, 18 Sep 2017 20:30:39 +0000 (16:30 -0400)] 
Doc: babeltrace: update the Read the Docs Sphinx theme

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDoc: babeltrace: mention _legacy_ Python bindings
Philippe Proulx [Mon, 18 Sep 2017 20:29:27 +0000 (16:29 -0400)] 
Doc: babeltrace: mention _legacy_ Python bindings

This is to avoid confusion with the _new_ Babeltrace Python bindings
which are under the `bt2` package (not documented yet).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: doc/bindings/python: make the doc buildable
Philippe Proulx [Mon, 18 Sep 2017 20:22:47 +0000 (16:22 -0400)] 
Fix: doc/bindings/python: make the doc buildable

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: bt2: do not assign an exception to a local variable
Philippe Proulx [Mon, 18 Sep 2017 19:52:12 +0000 (15:52 -0400)] 
Fix: bt2: do not assign an exception to a local variable

According to <https://docs.python.org/3/reference/compound_stmts.html#try>:

> Exceptions are cleared because with the traceback attached to them,
> they form a reference cycle with the stack frame, keeping all locals
> in that frame alive until the next garbage collection occurs.

According to <http://portingguide.readthedocs.io/en/latest/exceptions.html>:

> As discussed previously, in Python 3, all information about an
> exception, including the traceback, is contained in the exception
> object. Since the traceback holds references to the values of all
> local variables, storing an exception in a local variable usually
> forms a reference cycle, keeping all local variables allocated until
> the next garbage collection pass.

This reference cycle can make some tests fail because, with the
Babeltrace Python bindings, some operations are performed when a
Babeltrace native object is destroyed: this means the Python reference
count must be "stable" and as deterministic as possible so as to avoid
gc.collect() when using the bindings.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython bt2 fix: missing import in CtfWriter
Jérémie Galarneau [Mon, 18 Sep 2017 19:55:31 +0000 (15:55 -0400)] 
Python bt2 fix: missing import in CtfWriter

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython babeltrace fix: handle bt2.Error exception on stream flush
Jérémie Galarneau [Mon, 18 Sep 2017 19:55:06 +0000 (15:55 -0400)] 
Python babeltrace fix: handle bt2.Error exception on stream flush

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython babeltrace fix: allow None for event header and packet context setters
Jérémie Galarneau [Mon, 18 Sep 2017 19:54:37 +0000 (15:54 -0400)] 
Python babeltrace fix: allow None for event header and packet context setters

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython babeltrace fix: missing return statement in field accessor
Jérémie Galarneau [Mon, 18 Sep 2017 19:53:55 +0000 (15:53 -0400)] 
Python babeltrace fix: missing return statement in field accessor

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoSet version to 2.0-pre4
Jérémie Galarneau [Mon, 18 Sep 2017 15:36:05 +0000 (11:36 -0400)] 
Set version to 2.0-pre4

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython babeltrace fix: initialize stream class with default values
Jérémie Galarneau [Mon, 18 Sep 2017 03:41:19 +0000 (23:41 -0400)] 
Python babeltrace fix: initialize stream class with default values

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython babeltrace: use long form attribute names
Jérémie Galarneau [Mon, 18 Sep 2017 03:40:56 +0000 (23:40 -0400)] 
Python babeltrace: use long form attribute names

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTests babeltrace: adapt python tests to use unittest
Jérémie Galarneau [Sun, 17 Sep 2017 22:01:03 +0000 (18:01 -0400)] 
Tests babeltrace: adapt python tests to use unittest

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: ctf-writertype serialization must 'escape' '_'-prefixed field names
Jérémie Galarneau [Sun, 17 Sep 2017 19:27:17 +0000 (15:27 -0400)] 
Fix: ctf-writertype serialization must 'escape' '_'-prefixed field names

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: use tabs for code indentation
Jérémie Galarneau [Sun, 17 Sep 2017 18:51:17 +0000 (14:51 -0400)] 
Cleanup: use tabs for code indentation

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: NULL dereference on sampling and restoration of graph's 'can_consume'
Jérémie Galarneau [Sun, 17 Sep 2017 18:44:22 +0000 (14:44 -0400)] 
Fix: NULL dereference on sampling and restoration of graph's 'can_consume'

Found by Coverity Scan. A graph's 'can_consume' state must only
be sampled after the graph argument's validation. The error paths
must also repeat that check on restoration of the state.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTests: confusion between python bindings and plugins tests
Jérémie Galarneau [Sun, 17 Sep 2017 18:35:58 +0000 (14:35 -0400)] 
Tests: confusion between python bindings and plugins tests

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoUpdate .gitignore: ignore generated API doc files
Jérémie Galarneau [Sun, 17 Sep 2017 18:09:14 +0000 (14:09 -0400)] 
Update .gitignore: ignore generated API doc files

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoUpdate .gitignore: ignore generated __init__.py file
Jérémie Galarneau [Sun, 17 Sep 2017 18:07:42 +0000 (14:07 -0400)] 
Update .gitignore: ignore generated __init__.py file

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agocli: do not use --component in query command, use leftover argument
Philippe Proulx [Sat, 16 Sep 2017 19:32:14 +0000 (15:32 -0400)] 
cli: do not use --component in query command, use leftover argument

Options should be used for optional arguments. In the case of
`babeltrace query`, the component class specification is mandatory,
so use a positional "leftover" argument:

    babeltrace [GEN OPTS] query [OPTS] TYPE.PLUGIN.CLS OBJECT

Example:

    babeltrace query src.ctf.fs trace-info -p 'path="/path/to/trace"'

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agotests/lib/test_ctf_writer.c: test structure field name is a keyword
Philippe Proulx [Sat, 16 Sep 2017 19:12:34 +0000 (15:12 -0400)] 
tests/lib/test_ctf_writer.c: test structure field name is a keyword

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agotests/lib/test_ctf_writer.c: open trace with `-o dummy` to make it faster
Philippe Proulx [Sat, 16 Sep 2017 19:12:13 +0000 (15:12 -0400)] 
tests/lib/test_ctf_writer.c: open trace with `-o dummy` to make it faster

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agotests/lib/test_ctf_writer.c: update number of tests
Philippe Proulx [Sat, 16 Sep 2017 19:11:54 +0000 (15:11 -0400)] 
tests/lib/test_ctf_writer.c: update number of tests

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAdd bindings/python/babeltrace/.gitignore
Philippe Proulx [Sat, 16 Sep 2017 18:26:19 +0000 (14:26 -0400)] 
Add bindings/python/babeltrace/.gitignore

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: remove underscores from CTF IR field names at the source
Philippe Proulx [Sat, 16 Sep 2017 18:20:40 +0000 (14:20 -0400)] 
Fix: remove underscores from CTF IR field names at the source

The CTF spec. states that if a structure field type's field name or a
variant field type's choice name starts with `_` in the TSDL metadata
stream, then this underscore should be removed from the effective
field/choice name.

This patch applies this at the source (src.ctf plugin), in the TSDL
metadata text to CTF IR objects visitor. To do so it must also remove
such underscore characters from the components of field references (tag
and length names).

The behaviour is removed from plugins/text/pretty/print.c which did it
at the output level.

A potential issue is that a variant field type can have its enumeration
tag field type contain mappings which still have the underscore
prefixes. To circumvent this, we add the field names and the field names
with underscores to the field types's hash tables of field names to
field indexes, so that `field_name` and `_field_name` refer to the same
index within the structure/variant field type, for example.

When serializing the structure/variant field types to TSDL (for the CTF
writer API), we prefix each field with `_` if it's a CTF identifier so
as to avoid conflicts. We also remove the check that structure/variant
field type field names must not be CTF identifiers since it is safe to
serialize them now.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agobt2: trace collection notif. iter.: try to check the query result
Philippe Proulx [Sat, 16 Sep 2017 05:05:20 +0000 (01:05 -0400)] 
bt2: trace collection notif. iter.: try to check the query result

This could fail if the structure is not as expected: just raise
bt2.Error in this case.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoctf: do not add `intersection-range-ns` in `trace-info` query with no intersect.
Philippe Proulx [Sat, 16 Sep 2017 04:59:49 +0000 (00:59 -0400)] 
ctf: do not add `intersection-range-ns` in `trace-info` query with no intersect.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: ctf: notif-iter: accept EOF at beginning of packet context with no PH
Philippe Proulx [Sat, 16 Sep 2017 04:58:25 +0000 (00:58 -0400)] 
Fix: ctf: notif-iter: accept EOF at beginning of packet context with no PH

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTests: add tests for the babeltrace python package
Jérémie Galarneau [Wed, 30 Aug 2017 20:02:54 +0000 (16:02 -0400)] 
Tests: add tests for the babeltrace python package

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agopython: reimplement the babeltrace package as a bt2 wrapper
Jérémie Galarneau [Wed, 30 Aug 2017 20:01:57 +0000 (16:01 -0400)] 
python: reimplement the babeltrace package as a bt2 wrapper

This is how the old bindings work with the new bindings:

* A `babeltrace.TraceCollection` contains a set of
  `babeltrace.TraceHandle`, each of which only contains a CTF trace path
  and a generated ID, unique within the trace collection.

* When you call `babeltrace.TraceCollection.add_trace()`, the function
  makes sure that you're adding a single CTF trace. It creates a trace
  handle, adds it to the trace collection's set, and returns it.

* When you call `babeltrace.TraceCollection.remove_trace()`, the
  function removes the given trace handle from the trace collection's
  set.

* The `timestamp_begin()`, `timestamp_end()`, and `_has_intersection()`
  methods of `babeltrace.TraceHandle` perform the `trace-info` query
  with their path to retrieve the information.

* The `babeltrace.TraceHandle.events` property creates a `bt2` trace
  collection notification iterator, gets the first notification of the
  trace (which is expected to be a stream beginning notification), and
  finds the CTF IR trace object to generate all the event declarations
  from event classes using
  `babeltrace.reader_event_declaration._create_event_declaration()`.

* The `babeltrace.TraceCollection.events` property creates a `bt2` trace
  collection notification iterator, in stream intersection mode if
  needed, and with a beginning and end time if needed, and generates
  event objects using `babeltrace.reader_event._create_event()`.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agopython: Remove native code from babeltrace package
Jérémie Galarneau [Wed, 30 Aug 2017 18:26:35 +0000 (14:26 -0400)] 
python: Remove native code from babeltrace package

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAdd `bt2.TraceCollectionNotificationIterator` tests
Philippe Proulx [Fri, 15 Sep 2017 23:24:38 +0000 (19:24 -0400)] 
Add `bt2.TraceCollectionNotificationIterator` tests

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agobt2: __init__.py: remove unused NoSuchPlugin
Philippe Proulx [Fri, 15 Sep 2017 23:23:48 +0000 (19:23 -0400)] 
bt2: __init__.py: remove unused NoSuchPlugin

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agobt2: add trace collection notification iterator
Philippe Proulx [Fri, 15 Sep 2017 23:18:24 +0000 (19:18 -0400)] 
bt2: add trace collection notification iterator

A trace collection notification iterator is a special notification
iterator which iterates on the multiplexed notifications of all the
output ports of one or more traces. The new notification iterator
supports a stream intersection mode and trimming the whole multiplexed
stream.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoflt.utils.trimmer: allow `begin`/`end` params. to be integers
Philippe Proulx [Fri, 15 Sep 2017 23:12:46 +0000 (19:12 -0400)] 
flt.utils.trimmer: allow `begin`/`end` params. to be integers

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agobt2: values: remove public `value` getter
Philippe Proulx [Wed, 13 Sep 2017 23:05:29 +0000 (19:05 -0400)] 
bt2: values: remove public `value` getter

The public `value` getter (e.g., `my_int_value.value`) is redundant here
since the `bt2.values` object already act like their Python equivalent.
If you need an `int` value out of a `bt2.IntegerValue` object, for
example, you can just use `int(bt_value)` instead of `bt_value.value`.

We keep the `value` setter because this is used to set the underlying
raw value.

Internally, we keep the private `_value` getter to access the object's
raw value.

In the tests, we copy the value to modify instead of using the `value`
property with this pattern:

    orig_value = copy.copy(value)
    # modify value
    self.assertEqual(value, orig_value)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython bt2 fix: erroneous imports following split of clock class and value
Jérémie Galarneau [Sat, 16 Sep 2017 02:49:01 +0000 (22:49 -0400)] 
Python bt2 fix: erroneous imports following split of clock class and value

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoOmit 'value' from is_set and reset field functions
Jérémie Galarneau [Sat, 16 Sep 2017 02:12:32 +0000 (22:12 -0400)] 
Omit 'value' from is_set and reset field functions

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython bt2: remove type restriction on structure __setitem__
Jérémie Galarneau [Fri, 15 Sep 2017 04:07:45 +0000 (00:07 -0400)] 
Python bt2: remove type restriction on structure __setitem__

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: line exceeds 80 chars
Jérémie Galarneau [Thu, 14 Sep 2017 19:03:55 +0000 (15:03 -0400)] 
Cleanup: line exceeds 80 chars

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: ensure sequence length field value is set and freeze it
Jérémie Galarneau [Thu, 14 Sep 2017 16:13:33 +0000 (12:13 -0400)] 
Fix: ensure sequence length field value is set and freeze it

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCleanup: coding style mandates space after cast operator
Jérémie Galarneau [Thu, 14 Sep 2017 16:12:48 +0000 (12:12 -0400)] 
Cleanup: coding style mandates space after cast operator

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix Python bt2: sequence length field may be NULL
Jérémie Galarneau [Thu, 14 Sep 2017 16:09:16 +0000 (12:09 -0400)] 
Fix Python bt2: sequence length field may be NULL

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython bt2: value is a write-only property
Jérémie Galarneau [Thu, 14 Sep 2017 15:47:36 +0000 (11:47 -0400)] 
Python bt2: value is a write-only property

This commit turns 'value' into a write-only property. The
value property is needed to distinguish between:

my_var = bt2.IntegerFieldType(32)(123456)
my_var = 123

my_var = bt2.IntegerFieldType(32)(123456)
my_var.value = 123

The value 'getter' is not necessary since the various field types
implement the interfaces needed to act as native Python types
(collections.abc.Sequence, collections.abc.Mapping, numbers.Integral,
etc.)

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython bt2: add reset and is_set to fields
Jérémie Galarneau [Thu, 14 Sep 2017 15:44:51 +0000 (11:44 -0400)] 
Python bt2: add reset and is_set to fields

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: structure_set_field_by_name doesn't garantee field replacement
Jérémie Galarneau [Wed, 13 Sep 2017 20:52:16 +0000 (16:52 -0400)] 
Docs: structure_set_field_by_name doesn't garantee field replacement

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAdd field value is_set and reset functions to the public API
Jérémie Galarneau [Wed, 13 Sep 2017 20:51:38 +0000 (16:51 -0400)] 
Add field value is_set and reset functions to the public API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAllocate structure fields on creation
Jérémie Galarneau [Wed, 13 Sep 2017 19:19:02 +0000 (15:19 -0400)] 
Allocate structure fields on creation

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython test: remove useless test
Jérémie Galarneau [Wed, 13 Sep 2017 16:06:07 +0000 (12:06 -0400)] 
Python test: remove useless test

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython bt2: value properties for sequence and struct
Jérémie Galarneau [Wed, 13 Sep 2017 16:05:36 +0000 (12:05 -0400)] 
Python bt2: value properties for sequence and struct

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoUse boolean for frozen and set field states
Jérémie Galarneau [Wed, 13 Sep 2017 15:47:05 +0000 (11:47 -0400)] 
Use boolean for frozen and set field states

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoUpdate .gitignore exclusions
Jérémie Galarneau [Tue, 5 Sep 2017 22:40:34 +0000 (18:40 -0400)] 
Update .gitignore exclusions

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTests: use of non-existant API in bt2 python package test
Jérémie Galarneau [Tue, 5 Sep 2017 22:39:04 +0000 (18:39 -0400)] 
Tests: use of non-existant API in bt2 python package test

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPython bt2 fix: _ClockValue is no longer part of bt2.clock_class
Jérémie Galarneau [Sat, 16 Sep 2017 01:48:54 +0000 (21:48 -0400)] 
Python bt2 fix: _ClockValue is no longer part of bt2.clock_class

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoEnumeration mapping iterator's initial position is inconsistent
Jérémie Galarneau [Sat, 16 Sep 2017 01:47:49 +0000 (21:47 -0400)] 
Enumeration mapping iterator's initial position is inconsistent

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCONTRIBUTING.adoc: add step to add env. var. name to cli/babeltrace.c
Philippe Proulx [Wed, 6 Sep 2017 19:29:10 +0000 (15:29 -0400)] 
CONTRIBUTING.adoc: add step to add env. var. name to cli/babeltrace.c

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCONTRIBUTING.adoc: MY_MODULE_LOGGING_H -> BABELTRACE_MY_MODULE_LOGGING_H
Philippe Proulx [Wed, 6 Sep 2017 19:28:55 +0000 (15:28 -0400)] 
CONTRIBUTING.adoc: MY_MODULE_LOGGING_H -> BABELTRACE_MY_MODULE_LOGGING_H

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoCONTRIBUTING.adoc: document BT_LOG*_ERRNO() macros
Philippe Proulx [Wed, 6 Sep 2017 19:28:36 +0000 (15:28 -0400)] 
CONTRIBUTING.adoc: document BT_LOG*_ERRNO() macros

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAdd CONTRIBUTING.adoc
Philippe Proulx [Wed, 6 Sep 2017 19:15:16 +0000 (15:15 -0400)] 
Add CONTRIBUTING.adoc

This new Babeltrace contributor's guide documents the internals of the
Babeltrace project for its developers and contributors. It overrides
doc/logging-guide.adoc, doc/ref-counting.md, and doc/development.txt,
which is why those files are removed.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.044134 seconds and 4 git commands to generate.