deliverable/babeltrace.git
7 years agoFix copytrace: copy the entire payload_type
Julien Desfossez [Fri, 2 Jun 2017 13:37:01 +0000 (09:37 -0400)] 
Fix copytrace: copy the entire payload_type

Copy payload_type directly rather than iterating on its members.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoclock description is optional
Julien Desfossez [Fri, 2 Jun 2017 13:18:31 +0000 (09:18 -0400)] 
clock description is optional

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agomove the copy of event_context in ctf_copy_event_class
Julien Desfossez [Fri, 2 Jun 2017 13:12:03 +0000 (09:12 -0400)] 
move the copy of event_context in ctf_copy_event_class

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix copytrace: packet header is optional
Julien Desfossez [Fri, 2 Jun 2017 12:44:22 +0000 (08:44 -0400)] 
Fix copytrace: packet header is optional

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agosupport adding streams on non-static traces
Julien Desfossez [Thu, 1 Jun 2017 20:09:15 +0000 (16:09 -0400)] 
support adding streams on non-static traces

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoRemove dead code from the debug-info component class
Julien Desfossez [Thu, 1 Jun 2017 19:49:52 +0000 (15:49 -0400)] 
Remove dead code from the debug-info component class

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix debug-info: handle event layouts of lttng-ust traces prior to 2.9
Julien Desfossez [Thu, 1 Jun 2017 19:16:18 +0000 (15:16 -0400)] 
Fix debug-info: handle event layouts of lttng-ust traces prior to 2.9

Traces produced by lttng-ust < 2.9 emitted errors on dl_open events, but
those are not errors, just missing information that we already handle.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agofs-sink: fix handling static notifications
Julien Desfossez [Thu, 1 Jun 2017 18:16:59 +0000 (14:16 -0400)] 
fs-sink: fix handling static notifications

Instead of relying on a stream count, keep a state for each stream.
This allows to check that we only see each stream once and works even if
each stream is started/completed sequentially.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agofs-sink: move stream and stream_class maps in fs_writer struct
Julien Desfossez [Wed, 31 May 2017 19:19:22 +0000 (15:19 -0400)] 
fs-sink: move stream and stream_class maps in fs_writer struct

The fs_writer struct is now responsible for those HT since they are only
relevant within the scope of a writer, not the whole component.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agofs-sink: explicitely handle stream_begin notif
Julien Desfossez [Wed, 31 May 2017 18:35:54 +0000 (14:35 -0400)] 
fs-sink: explicitely handle stream_begin notif

Instead of creating the new streams lazily when packets begin, this
allows to handle empty streams.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agofs-sink: trace static handling + cleanup teardown
Julien Desfossez [Mon, 29 May 2017 22:30:27 +0000 (18:30 -0400)] 
fs-sink: trace static handling + cleanup teardown

When a trace is static and we have seen the stream_end notification for
all the active streams, we can free the resources for handling the
trace.

This also highlighted that a few bits were missing for a clean teardown
of the plugin.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoUse abort() instead of a false assertion
Philippe Proulx [Fri, 2 Jun 2017 17:48:13 +0000 (13:48 -0400)] 
Use abort() instead of a false assertion

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agodoc/Makefile.am: do not install internal documentation
Philippe Proulx [Fri, 2 Jun 2017 17:26:02 +0000 (13:26 -0400)] 
doc/Makefile.am: do not install internal documentation

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agolib/ctf-writer/writer.c: logging: change tag to `CTF-WRITER`
Philippe Proulx [Fri, 2 Jun 2017 17:25:44 +0000 (13:25 -0400)] 
lib/ctf-writer/writer.c: logging: change tag to `CTF-WRITER`

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAdd missing include of unistd.h
Michael Jeanson [Thu, 1 Jun 2017 22:31:48 +0000 (18:31 -0400)] 
Add missing include of unistd.h

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: use portable print format for size_t
Michael Jeanson [Tue, 30 May 2017 19:55:15 +0000 (15:55 -0400)] 
Port: use portable print format for size_t

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: internal logging print format for mingw
Michael Jeanson [Tue, 30 May 2017 19:38:24 +0000 (15:38 -0400)] 
Port: internal logging print format for mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: replace strerror_r() with glib g_strerror()
Michael Jeanson [Fri, 9 Sep 2016 21:08:13 +0000 (21:08 +0000)] 
Port: replace strerror_r() with glib g_strerror()

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Use g_setenv instead of setenv
Michael Jeanson [Fri, 17 Feb 2017 20:11:16 +0000 (15:11 -0500)] 
Port: Use g_setenv instead of setenv

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Plugin extension is platform specific
Michael Jeanson [Wed, 15 Feb 2017 20:36:57 +0000 (15:36 -0500)] 
Port: Plugin extension is platform specific

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: No setuid on windows
Michael Jeanson [Fri, 13 Jan 2017 16:43:02 +0000 (11:43 -0500)] 
Port: No setuid on windows

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Use glib g_get_home_dir to get home dir on mingw
Michael Jeanson [Fri, 13 Jan 2017 16:42:31 +0000 (11:42 -0500)] 
Port: Use glib g_get_home_dir to get home dir on mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Dummy locking of stdout on mingw in libtap
Michael Jeanson [Thu, 15 Sep 2016 21:19:51 +0000 (21:19 +0000)] 
Port: Dummy locking of stdout on mingw in libtap

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Add missing includes for mingw
Michael Jeanson [Fri, 21 Oct 2016 16:19:05 +0000 (12:19 -0400)] 
Port: Add missing includes for mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: memstream compat for mingw
Michael Jeanson [Thu, 15 Sep 2016 15:18:11 +0000 (15:18 +0000)] 
Port: memstream compat for mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Use portable format string for ISO 8601 dates
Michael Jeanson [Thu, 12 Jan 2017 17:08:26 +0000 (12:08 -0500)] 
Port: Use portable format string for ISO 8601 dates

The %F format string to reprensent ISO 8601 dates is specific to C99 and
not available on all platforms, use basic %Y-%m-%d to get the same
result.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: add missing include for stdio.h compat
Michael Jeanson [Thu, 15 Sep 2016 21:19:29 +0000 (21:19 +0000)] 
Port: add missing include for stdio.h compat

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Add utsname.h compat for mingw
Michael Jeanson [Thu, 15 Sep 2016 20:52:05 +0000 (20:52 +0000)] 
Port: Add utsname.h compat for mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Add mman.h compat for mingw
Michael Jeanson [Thu, 15 Sep 2016 18:51:45 +0000 (14:51 -0400)] 
Port: Add mman.h compat for mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Namespace tokens in ctf metadata parser/lexer
Michael Jeanson [Tue, 13 Sep 2016 16:21:33 +0000 (16:21 +0000)] 
Port: Namespace tokens in ctf metadata parser/lexer

Namespace generic types as they conflict on different platforms.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Add posix_fallocate compat for mingw
Michael Jeanson [Tue, 13 Sep 2016 21:34:57 +0000 (21:34 +0000)] 
Port: Add posix_fallocate compat for mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Add timegm compat for mingw
Michael Jeanson [Thu, 15 Sep 2016 19:47:01 +0000 (19:47 +0000)] 
Port: Add timegm compat for mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Add time.h compat for mingw
Michael Jeanson [Tue, 13 Sep 2016 21:39:44 +0000 (21:39 +0000)] 
Port: Add time.h compat for mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Disable debug info by default on mingw
Michael Jeanson [Mon, 12 Sep 2016 20:38:25 +0000 (20:38 +0000)] 
Port: Disable debug info by default on mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: win32 DLLs don't support hidden symbols
Michael Jeanson [Tue, 13 Sep 2016 20:38:17 +0000 (20:38 +0000)] 
Port: win32 DLLs don't support hidden symbols

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Add missing byteswap compat for mingw
Michael Jeanson [Tue, 13 Sep 2016 20:37:26 +0000 (20:37 +0000)] 
Port: Add missing byteswap compat for mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Fix libuuid compat on mingw
Michael Jeanson [Wed, 14 Sep 2016 17:45:37 +0000 (13:45 -0400)] 
Port: Fix libuuid compat on mingw

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Add AC_USE_SYSTEM_EXTENSIONS with mingw support
Michael Jeanson [Mon, 12 Sep 2016 20:37:31 +0000 (20:37 +0000)] 
Port: Add AC_USE_SYSTEM_EXTENSIONS with mingw support

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Add bt_common_get_page_size
Michael Jeanson [Mon, 12 Sep 2016 18:36:58 +0000 (18:36 +0000)] 
Port: Add bt_common_get_page_size

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: Use glib portable macros to convert gpointer to int
Michael Jeanson [Mon, 12 Sep 2016 20:01:27 +0000 (20:01 +0000)] 
Port: Use glib portable macros to convert gpointer to int

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoPort: use portable pointer type in bt_list_entry
Michael Jeanson [Tue, 13 Sep 2016 15:32:00 +0000 (15:32 +0000)] 
Port: use portable pointer type in bt_list_entry

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: test-utils-muxer.c: initialize "next" return with OK status
Philippe Proulx [Thu, 1 Jun 2017 21:25:51 +0000 (17:25 -0400)] 
Fix: test-utils-muxer.c: initialize "next" return with OK status

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoir: do not create empty structure for optional scope field types
Philippe Proulx [Thu, 1 Jun 2017 21:05:11 +0000 (17:05 -0400)] 
ir: do not create empty structure for optional scope field types

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agotest_ctf_writer.c: set PACKET_RESIZE_TEST_LENGTH to 100000 again
Philippe Proulx [Thu, 1 Jun 2017 21:04:03 +0000 (17:04 -0400)] 
test_ctf_writer.c: set PACKET_RESIZE_TEST_LENGTH to 100000 again

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoutils.muxer: remove upstream notif. iter. once ended/canceled
Philippe Proulx [Thu, 1 Jun 2017 20:27:36 +0000 (16:27 -0400)] 
utils.muxer: remove upstream notif. iter. once ended/canceled

This was not a bug, but it was a source of leak during the graph's
lifetime (upstream notification iterator does not exist anymore but
utils.muxer notification iterator keeps a structure associated to it.)

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoconfigure.ac: use $enableval in AC_ARG_ENABLE()
Philippe Proulx [Thu, 1 Jun 2017 20:20:09 +0000 (16:20 -0400)] 
configure.ac: use $enableval in AC_ARG_ENABLE()

This allows all the following to work:

* --enable-x
* --enable-x=yes
* --enable-x=no
* --disable-x

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agodoc/logging-guide.adoc: minor fixes + add "Instrument a module" section
Philippe Proulx [Wed, 31 May 2017 19:18:33 +0000 (15:18 -0400)] 
doc/logging-guide.adoc: minor fixes + add "Instrument a module" section

The new "Instrument a module" function documents the steps to instrument
a new module in a standard way.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agocli: use standard logging files and macros
Philippe Proulx [Wed, 31 May 2017 18:32:36 +0000 (14:32 -0400)] 
cli: use standard logging files and macros

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agopython-plugin-provider: use standard logging files and macros
Philippe Proulx [Wed, 31 May 2017 17:01:36 +0000 (13:01 -0400)] 
python-plugin-provider: use standard logging files and macros

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoplugins/ctf/lttng-live: use standard logging files and macros
Philippe Proulx [Wed, 31 May 2017 16:57:58 +0000 (12:57 -0400)] 
plugins/ctf/lttng-live: use standard logging files and macros

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoplugins/ctf/common/btr: use standard logging files and macros
Philippe Proulx [Wed, 31 May 2017 16:52:27 +0000 (12:52 -0400)] 
plugins/ctf/common/btr: use standard logging files and macros

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agologging-internal.h: add BT_LOG_LEVEL_EXTERN_SYMBOL(), BT_LOG_INIT_LOG_LEVEL()
Philippe Proulx [Wed, 31 May 2017 16:48:52 +0000 (12:48 -0400)] 
logging-internal.h: add BT_LOG_LEVEL_EXTERN_SYMBOL(), BT_LOG_INIT_LOG_LEVEL()

BT_LOG_INIT_LOG_LEVEL() defines a hidden log level symbol and a static
constructor which initializes this symbol according to the value of
a given environment variable. This macro should be used in a module-wise
dedicated logging source file, `logging.c`, as such:

    #define BT_LOG_OUTPUT_LEVEL some_log_level_symbol
    #include <babeltrace/logging-internal.h>

    BT_LOG_INIT_LOG_LEVEL(some_log_level_symbol, "BABELTRACE_SOME_LOG_LEVEL");

BT_LOG_LEVEL_EXTERN_SYMBOL() declares this symbol as `extern`. It
should be used in a module-wise dedicated logging header, `logging.h`,
as such:

    #define BT_LOG_OUTPUT_LEVEL some_log_level_symbol
    #include <babeltrace/logging-internal.h>

    BT_LOG_LEVEL_EXTERN_SYMBOL(some_log_level_symbol);

Any module source file which contains log statements should use the
following lines **before any #include line**:

    #define BT_LOG_TAG "THE-MODULE-TAG"
    #include "logging.h"

If there are subdirectories within a module, it is possible that you
need to include "../logging.h" or "../../logging.h", for example. The
rule of thumb is that no module file, except `logging.c`, should include
<babeltrace/logging-internal.h> directly.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoplugins/ctf/common/btr/btr.c: add logging
Philippe Proulx [Wed, 31 May 2017 16:34:26 +0000 (12:34 -0400)] 
plugins/ctf/common/btr/btr.c: add logging

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoLogging: require modules to define BT_LOG_OUTPUT_LEVEL
Philippe Proulx [Wed, 31 May 2017 14:42:33 +0000 (10:42 -0400)] 
Logging: require modules to define BT_LOG_OUTPUT_LEVEL

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agobt_value_get_type(): not a warning if value is NULL
Philippe Proulx [Wed, 31 May 2017 13:32:53 +0000 (09:32 -0400)] 
bt_value_get_type(): not a warning if value is NULL

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agobitfield-internal.h: fix negative value shifting warnings
Philippe Proulx [Wed, 31 May 2017 00:13:37 +0000 (20:13 -0400)] 
bitfield-internal.h: fix negative value shifting warnings

This patch makes _bt_unsigned_cast() shift the complement of 0 casted to
uint64_t instead of the complement of 0 casted to a possibly signed
type, which results in shifting a negative value, an undefined operation
in C.

Because we're imposing uint64_t now, the size of the type and value's
type cannot be greater than the size of uint64_t... not a considerable
worry with the current state of commercial computing. Having said that,
the new _bt_check_max_64bit() macro, a static assertion, checks that
those type sizes are not greater than the size of uint64_t at build
time.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agotests/lib: do not call bt_ctf_trace_set_native_byte_order() if not needed
Philippe Proulx [Tue, 30 May 2017 22:47:31 +0000 (18:47 -0400)] 
tests/lib: do not call bt_ctf_trace_set_native_byte_order() if not needed

It's not mandatory anymore to call bt_ctf_trace_set_native_byte_order()
on a trace object before it's frozen.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoir: add BT_CTF_BYTE_ORDER_NONE and make it the default trace's native BO
Philippe Proulx [Tue, 30 May 2017 22:27:28 +0000 (18:27 -0400)] 
ir: add BT_CTF_BYTE_ORDER_NONE and make it the default trace's native BO

There's a problem now where you need to explicitly set the native byte
order of a trace you create with bt_ctf_trace_create() with
bt_ctf_trace_set_native_byte_order() before the trace object is frozen,
otherwise the function which would cause the freezing fails.

Some trace formats have no byte order concept. Other properties like
alignment and binary field sizes may have no meaning either. Source
component classes which implement the decoding of those formats should
do a best effort to represent their trace's metadata using CTF IR. That
said, choosing an arbitrary trace's native byte order imposes this byte
order when a ctf.fs sink writes the trace. Here, BT_CTF_BYTE_ORDER_NONE
means that we don't care about the byte order, that it was not
meaningful when decoding the original trace, therefore you can choose
any output byte order you want.

With this patch, the initial trace's native byte order is
BT_CTF_BYTE_ORDER_NONE, and this is a valid byte order when the trace
needs to be frozen. A non-CTF writer trace cannot be used by a CTF
writer object anyway; a CTF writer always creates its own trace object.
The initial native byte order of a CTF writer trace is the machine's
byte order. You cannot set a CTF writer trace's native byte order to
BT_CTF_BYTE_ORDER_NONE. Also, you cannot set any field type's byte order
to BT_CTF_BYTE_ORDER_NONE: it's only valid for a non-CTF writer trace.

libctfcopytrace is modified to only explicitly set the CTF writer
trace's native byte order if the original trace's native byte order is
not BT_CTF_BYTE_ORDER_NONE.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoctf plugins: prepend trace's hostname, if exists, to trace name
Philippe Proulx [Tue, 30 May 2017 00:21:46 +0000 (20:21 -0400)] 
ctf plugins: prepend trace's hostname, if exists, to trace name

This makes the trace names a little more precise.

Note that as of this patch the visitor sets the trace's name just before
adding the first stream class, because after this, the trace is frozen
and we cannot set its name anymore. This is done as lately as possible
to increase our chance of having decoded the metadata's `env` block
(where the hostname is), if any. This can lead to an unnamed trace if
there's no stream classes. But if there's no stream classes, there can't
be any packet or event anyway, so there can't be any notification which
refers to this trace, so no other component should see the fact that
there's no name.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoctf.fs source: use last path parameter's element as base for trace names
Philippe Proulx [Mon, 29 May 2017 23:55:16 +0000 (19:55 -0400)] 
ctf.fs source: use last path parameter's element as base for trace names

Without this patch:

    Trace directory:  /home/user/my-traces/trace/yes/kernel
    `path` parameter: /home/user/my-traces/trace
    Trace name:                                      kernel

With this patch:

    Trace directory:  /home/user/my-traces/trace/yes/kernel
    `path` parameter: /home/user/my-traces/trace
    Trace name:                            trace/yes/kernel

This takes into account absolute vs. relative paths, resolves `..` and
`.`, and more. Most of the job is done by bt_common_normalize_path().
The process used to craft the trace names using the base directory as
passed by the user is really easy once all the paths are known to be
normalized.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoDocs: add informal comments to common-internal.h
Philippe Proulx [Mon, 29 May 2017 23:13:30 +0000 (19:13 -0400)] 
Docs: add informal comments to common-internal.h

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAdd bt_common_normalize_path()
Philippe Proulx [Mon, 29 May 2017 22:48:48 +0000 (18:48 -0400)] 
Add bt_common_normalize_path()

This new function does a part of realpath()'s job: it resolves `..` and
`.` in the path, resolves a relative path with a custom working
directory or the current working directory, and removes consecutive
separators (`/` or `\` depending on the platform) and the last
separator. The function always returns an absolute path. The function
does NOT resolve symbolic links.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agostream.c: allow stream PC's `events_discarded` field to be set by user
Philippe Proulx [Mon, 29 May 2017 20:15:00 +0000 (16:15 -0400)] 
stream.c: allow stream PC's `events_discarded` field to be set by user

If a stream packet context `events_discarded` field is set a flush time,
check if its value keeps the count monotonic, and use this value to set
the stream's current discarded events count if so. If it's not set, do
like before and set it automatically from the stream's current count.

This will make it possible for a ctf.fs sink component to write the
original `events_discarded` field without having to read it, compute
the difference with the previous value, and use
bt_ctf_stream_append_discarded_events() to change the stream's discarded
events count.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoRemove remaining old test files
Philippe Proulx [Mon, 29 May 2017 19:49:09 +0000 (15:49 -0400)] 
Remove remaining old test files

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agotests/cli/Makefile.am: remove duplicate test in TESTS list
Philippe Proulx [Mon, 29 May 2017 19:47:01 +0000 (15:47 -0400)] 
tests/cli/Makefile.am: remove duplicate test in TESTS list

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: test_convert_args: use util.muxer's `assume-absolute-clock-classes` param
Philippe Proulx [Mon, 29 May 2017 19:45:08 +0000 (15:45 -0400)] 
Fix: test_convert_args: use util.muxer's `assume-absolute-clock-classes` param

util.muxer's `force-absolute` parameter is now named
`assume-absolute-clock-classes`. Modify test to satisfy this.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: test_ir_visit.c: create valid SC PC/EH and trace packet header
Philippe Proulx [Mon, 29 May 2017 19:33:55 +0000 (15:33 -0400)] 
Fix: test_ir_visit.c: create valid SC PC/EH and trace packet header

Since CTF IR is more strict regarding the semantics of trace packet
header, stream class packet context and event header field types, this
test fails because the default packet context field type of a stream
class which is not created for a CTF writer object contains
`timestamp_begin` and `timestamp_end` fields which are not mapped to a
clock class.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: test_ctf_ir_ref.c: create valid SC PC/EH and trace packet header
Philippe Proulx [Mon, 29 May 2017 19:27:23 +0000 (15:27 -0400)] 
Fix: test_ctf_ir_ref.c: create valid SC PC/EH and trace packet header

Since CTF IR is more strict regarding the semantics of trace packet
header, stream class packet context and event header field types, this
test fails because the default packet context field type of a stream
class which is not created for a CTF writer object contains
`timestamp_begin` and `timestamp_end` fields which are not mapped to a
clock class.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoRemove warnings when using bt_plugin_create_all_from_dir()
Philippe Proulx [Mon, 29 May 2017 18:47:52 +0000 (14:47 -0400)] 
Remove warnings when using bt_plugin_create_all_from_dir()

bt_plugin_create_all_from_dir() expects an existing directory, otherwise
it fails with a WARN-level log message because it's the user's
responsibility to ensure this.

A few functions of the library and the CLI call this with nonexisting
paths, resulting in warnings under normal usage (for example, default
plugin search paths which do not exist; this is not an error nor a
warning).

This patch fixes this by testing the existence of the paths passed to
bt_plugin_create_all_from_dir() with g_file_test(), skipping (usually
with a VERBOSE-level message) when it's not the case.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: make Python plugin provider have its own log level
Philippe Proulx [Mon, 29 May 2017 18:28:30 +0000 (14:28 -0400)] 
Fix: make Python plugin provider have its own log level

It cannot share libbabeltrace's log level because it's in a different
shared object itself. Because it's not using the library's global log
level, we don't initialize it with the BABELTRACE_LOGGING_GLOBAL_LEVEL,
but with its own BABELTRACE_PYTHON_PROVIDER_LOG_LEVEL.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAdd bt_log_get_level_from_env() and use it
Philippe Proulx [Sat, 27 May 2017 06:55:04 +0000 (02:55 -0400)] 
Add bt_log_get_level_from_env() and use it

This is a common function for all the project's modules to use the same
names (`VERBOSE`, `WARN`, `ERROR`, etc.) to set the various log levels
based on the value of a specific environment variable.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoconfigure.ac: add details to final report
Philippe Proulx [Sat, 27 May 2017 06:09:23 +0000 (02:09 -0400)] 
configure.ac: add details to final report

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agopython-plugin-provider/python-plugin-provider.c: add logging
Philippe Proulx [Sat, 27 May 2017 03:25:43 +0000 (23:25 -0400)] 
python-plugin-provider/python-plugin-provider.c: add logging

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agocli: check for cancellation before running the graph, add relevant logging
Philippe Proulx [Sat, 27 May 2017 02:23:41 +0000 (22:23 -0400)] 
cli: check for cancellation before running the graph, add relevant logging

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agolib/plugin/plugin-so.c: add logging
Philippe Proulx [Sat, 27 May 2017 02:23:29 +0000 (22:23 -0400)] 
lib/plugin/plugin-so.c: add logging

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agotest_ctf_writer.c: add "trace is static" listener tests
Philippe Proulx [Sat, 27 May 2017 00:51:33 +0000 (20:51 -0400)] 
test_ctf_writer.c: add "trace is static" listener tests

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoAdd bt_ctf_trace_add_is_static_listener() and ..._remove_is_static_listener()
Philippe Proulx [Sat, 27 May 2017 00:50:07 +0000 (20:50 -0400)] 
Add bt_ctf_trace_add_is_static_listener() and ..._remove_is_static_listener()

See the functions's documentation for more details.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix builds with built-in plugins
Philippe Proulx [Fri, 26 May 2017 23:24:13 +0000 (19:24 -0400)] 
Fix builds with built-in plugins

The recent convenience libraries are an issue for built-in plugins
because they lead to multiple definitions of the same symbols. This is
because we have to use --whole-archive when embedding the plugin
archives (.a), so the linker wants to embed all the symbols found. If
the same symbol is found twice, the linker is not happy.

For example: the `ctf` plugin's archive includes the symbols of
libbabeltrace-common.a. The CLI also includes the symbols of
libbabeltrace-common.a. When adding the `ctf` archive to the CLI with
--whole-archive, the symbols of libbabeltrace-common.a already exist in
the CLI, so we get the multiple definition error.

My solution here is to avoid adding the convenience libraries to the
individual plugins and to the library itself when BUILT_IN_PLUGINS is
true. The convenience libraries are added only one time to the CLI (in
cli/Makefile.am directly). When BUILT_IN_PLUGINS is false, it is
important to include the convenience library functions in each plugin
because they could be loaded outside the CLI, where those functions do
not exist.

There's also a fix to properly embed the Python plugin provider into the
library, and to print an error at configure time when
BUILT_IN_PYTHON_PLUGIN_SUPPORT=1 is used without
--enable-python-plugins.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agolib/plugin/plugin.c: improve log levels
Philippe Proulx [Fri, 26 May 2017 20:17:06 +0000 (16:17 -0400)] 
lib/plugin/plugin.c: improve log levels

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agotext.pretty: create an event string instead of using fprintf()/fputs()
Philippe Proulx [Fri, 26 May 2017 20:14:49 +0000 (16:14 -0400)] 
text.pretty: create an event string instead of using fprintf()/fputs()

Because the component calls library functions which can log between its
calls to fprintf() or fputs(), the output when logging is enabled is the
output of the component interlaced with library logging statements.

Instead of printing directly to the file stream, append to a component
GString and fwrite() this content at the end.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix debug-info: prevent invalid access in the original event_context
Julien Desfossez [Fri, 26 May 2017 19:41:48 +0000 (15:41 -0400)] 
Fix debug-info: prevent invalid access in the original event_context

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoMake bt_graph_add_*_listener() function return a listener ID
Philippe Proulx [Fri, 26 May 2017 19:02:51 +0000 (15:02 -0400)] 
Make bt_graph_add_*_listener() function return a listener ID

This is the expected API to identify all the user listeners of the
library. You can keep the returned ID, a simple int, to remove the
listener from the object later if needed. With the current API, you
cannot remove graph listeners, but we could add the functions to do so
in the future.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoRename "ignore-absolute" parameter to "assume-absolute-clock-classes"
Jérémie Galarneau [Sun, 28 May 2017 17:12:37 +0000 (13:12 -0400)] 
Rename "ignore-absolute" parameter to "assume-absolute-clock-classes"

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoTests: possible dereference of NULL argument to strcmp
Jérémie Galarneau [Sat, 27 May 2017 19:46:04 +0000 (15:46 -0400)] 
Tests: possible dereference of NULL argument to strcmp

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: return error on empty list in get_unary_unsigned
Jérémie Galarneau [Sat, 27 May 2017 19:40:58 +0000 (15:40 -0400)] 
Fix: return error on empty list in get_unary_unsigned

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: missing error code on signed clock value in trimmer
Jérémie Galarneau [Sat, 27 May 2017 19:36:45 +0000 (15:36 -0400)] 
Fix: missing error code on signed clock value in trimmer

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: uninitialized destination component on unknown args
Jérémie Galarneau [Sat, 27 May 2017 19:26:54 +0000 (15:26 -0400)] 
Fix: uninitialized destination component on unknown args

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: use of uninitialized value in visit_*_decl_entry
Jérémie Galarneau [Sat, 27 May 2017 19:10:37 +0000 (15:10 -0400)] 
Fix: use of uninitialized value in visit_*_decl_entry

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: return of garbage value in copy_find_clock_array_field on error
Jérémie Galarneau [Sat, 27 May 2017 19:06:32 +0000 (15:06 -0400)] 
Fix: return of garbage value in copy_find_clock_array_field on error

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: return of garbage value on empty specifier list
Jérémie Galarneau [Sat, 27 May 2017 19:04:19 +0000 (15:04 -0400)] 
Fix: return of garbage value on empty specifier list

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: return of garbage value when trace has no stream classes
Jérémie Galarneau [Sat, 27 May 2017 19:02:32 +0000 (15:02 -0400)] 
Fix: return of garbage value when trace has no stream classes

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: NULL dereference in logging on btr allocation failure
Jérémie Galarneau [Sat, 27 May 2017 19:00:39 +0000 (15:00 -0400)] 
Fix: NULL dereference in logging on btr allocation failure

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: NULL dereference in logging on notit allocation failure
Jérémie Galarneau [Sat, 27 May 2017 18:59:30 +0000 (14:59 -0400)] 
Fix: NULL dereference in logging on notit allocation failure

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: dereference of NULL mdec when opening packetized metadata file
Jérémie Galarneau [Sat, 27 May 2017 18:54:16 +0000 (14:54 -0400)] 
Fix: dereference of NULL mdec when opening packetized metadata file

ctf_metadata_decoder_packetized_file_stream_to_buf() uses
ctf_metadata_decoder_packetized_file_stream_to_buf_with_mdec() with
a NULL mdec. This results in a NULL dereference whenever the mdec
error sream is accessed.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: potential NULL dereference of ctf_fs_file path
Jérémie Galarneau [Sat, 27 May 2017 18:48:20 +0000 (14:48 -0400)] 
Fix: potential NULL dereference of ctf_fs_file path

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: ds_file_munmap must check ds_file for NULL
Jérémie Galarneau [Sat, 27 May 2017 18:44:06 +0000 (14:44 -0400)] 
Fix: ds_file_munmap must check ds_file for NULL

ds_file_munmap may be called with a NULL file in
ctf_fs_ds_file_create()'s error path.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: unchecked bt_ctf_event_set_clock_value return value
Jérémie Galarneau [Sat, 27 May 2017 18:37:18 +0000 (14:37 -0400)] 
Fix: unchecked bt_ctf_event_set_clock_value return value

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoClean-up: unused next_return assignation in muxer test
Jérémie Galarneau [Sat, 27 May 2017 18:35:58 +0000 (14:35 -0400)] 
Clean-up: unused next_return assignation in muxer test

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: uninitialized ret value used in set_debug_info_field
Jérémie Galarneau [Sat, 27 May 2017 18:31:40 +0000 (14:31 -0400)] 
Fix: uninitialized ret value used in set_debug_info_field

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
7 years agoFix: possible NULL dereference of uuid in test
Jérémie Galarneau [Sat, 27 May 2017 18:26:06 +0000 (14:26 -0400)] 
Fix: possible NULL dereference of uuid in test

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.042627 seconds and 5 git commands to generate.