babeltrace.git
8 years agoSupport ctf index version 1.1
Julien Desfossez [Thu, 20 Aug 2015 01:19:57 +0000 (21:19 -0400)] 
Support ctf index version 1.1

Produced by LTTng as of 2.8 (no compatibility breakage with 1.0)

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoCleanup: Don't hardcode include paths unnecessarily
Jérémie Galarneau [Sat, 17 Oct 2015 19:19:05 +0000 (15:19 -0400)] 
Cleanup: Don't hardcode include paths unnecessarily

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: include ctf-scanner-symbols.h to prefix yy_* symbols
Jérémie Galarneau [Sat, 17 Oct 2015 19:18:40 +0000 (15:18 -0400)] 
Fix: include ctf-scanner-symbols.h to prefix yy_* symbols

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: missing includes break the out-of-tree build
Jérémie Galarneau [Fri, 16 Oct 2015 19:31:28 +0000 (15:31 -0400)] 
Fix: missing includes break the out-of-tree build

Addresses out-of-tree build breakage introduced by
commit 3842465694945829d76452ff83924aa0103c6293

Reported-by: Nathan Lynch <Nathan_Lynch@mentor.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: memstream compat layer requires use of babeltrace_close_memstream
Mathieu Desnoyers [Thu, 15 Oct 2015 16:08:48 +0000 (12:08 -0400)] 
Fix: memstream compat layer requires use of babeltrace_close_memstream

In compatibility mode, the babeltrace compat layer around memstream
copies the file content into the buffer only at close.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agocompat send no SIGPIPE: multithread-safe
Mathieu Desnoyers [Thu, 15 Oct 2015 16:07:46 +0000 (12:07 -0400)] 
compat send no SIGPIPE: multithread-safe

The current implementation of the no-SIGPIPE send in the compatibility
layer has side-effects on multithreaded processes due to use of
sigaction(). Although multithread-safety is not strictly needed since
Babeltrace is single-threaded for now, there is no reason to keep this
limitation deeply rooted in a compatibility layer.

Use the multithreaded-safe algorithm to catch SIGPIPE implemented in
LTTng-UST for the write() system call for platforms that do not have
MSG_NOSIGNAL. It was originally implented in LTTng-UST as part of the
ring buffer wakeup. This is a re-implementation of this same algorithm
under MIT license. It uses signal masks and sigtimedwait.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: truncated value in fgetc() usage
Jérémie Galarneau [Thu, 15 Oct 2015 17:43:06 +0000 (13:43 -0400)] 
Fix: truncated value in fgetc() usage

Reported by Coverity Scan:
CID 1327417:  API usage errors  (CHAR_IO)
Assigning the return value of "fgetc" to char "c" truncates
its value.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: handle EINTR return value for bt_posix_fallocate
Mathieu Desnoyers [Tue, 13 Oct 2015 20:04:23 +0000 (16:04 -0400)] 
Fix: handle EINTR return value for bt_posix_fallocate

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoConfigure: Add missing checks
Michael Jeanson [Tue, 13 Oct 2015 19:29:58 +0000 (15:29 -0400)] 
Configure: Add missing checks

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoImplement bt_getline
Mathieu Desnoyers [Tue, 13 Oct 2015 18:56:44 +0000 (14:56 -0400)] 
Implement bt_getline

Implement our own getline to remove dependency from glibc 2.10+ and to
increase portability to other operating systems.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: initialize getline linesize argument to 0
Mathieu Desnoyers [Tue, 13 Oct 2015 18:44:05 +0000 (14:44 -0400)] 
Fix: initialize getline linesize argument to 0

It works by accident because getline() reallocates based on the initial
pointer, but doing this falls into a blind spot of the Linux man pages.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: warning, may be used uninitialized
Michael Jeanson [Fri, 9 Oct 2015 21:16:37 +0000 (17:16 -0400)] 
Fix: warning, may be used uninitialized

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Replace dirent->d_type by stat S_ISREG
Michael Jeanson [Fri, 9 Oct 2015 20:19:40 +0000 (16:19 -0400)] 
Port: Replace dirent->d_type by stat S_ISREG

dirent->d_type is Linux specific while 'stat' is part of POSIX

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Include config.h globally trough DEFAULT_INCLUDES
Michael Jeanson [Fri, 9 Oct 2015 19:50:25 +0000 (15:50 -0400)] 
Port: Include config.h globally trough DEFAULT_INCLUDES

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Add compat for dirfd
Michael Jeanson [Fri, 9 Oct 2015 16:24:20 +0000 (12:24 -0400)] 
Port: Add compat for dirfd

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Add compat for mkdtemp
Michael Jeanson [Fri, 9 Oct 2015 16:15:12 +0000 (12:15 -0400)] 
Port: Add compat for mkdtemp

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Add compat for strnlen and strndup
Michael Jeanson [Fri, 9 Oct 2015 16:01:46 +0000 (12:01 -0400)] 
Port: Add compat for strnlen and strndup

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Use bash to run tests
Michael Jeanson [Tue, 6 Oct 2015 20:30:12 +0000 (16:30 -0400)] 
Port: Use bash to run tests

The Solaris base shell does not support subshells with $()

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Implement faccessat wrapper
Mathieu Desnoyers [Thu, 1 Oct 2015 20:26:20 +0000 (16:26 -0400)] 
Port: Implement faccessat wrapper

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: implement posix_fallocate wrapper
Jérémie Galarneau [Thu, 1 Oct 2015 19:53:47 +0000 (15:53 -0400)] 
Port: implement posix_fallocate wrapper

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Set required compiler flags to use pthreads
Michael Jeanson [Wed, 7 Oct 2015 19:35:46 +0000 (15:35 -0400)] 
Port: Set required compiler flags to use pthreads

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Add configure check for __attribute__ support
Michael Jeanson [Wed, 7 Oct 2015 19:33:34 +0000 (15:33 -0400)] 
Port: Add configure check for __attribute__ support

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: cleanup and portability fix to configure.ac
Michael Jeanson [Wed, 7 Oct 2015 19:23:18 +0000 (15:23 -0400)] 
Port: cleanup and portability fix to configure.ac

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Add support for linkers with no support for 'no-as-needed'
Alexis Martin [Thu, 1 Oct 2015 20:12:25 +0000 (16:12 -0400)] 
Port: Add support for linkers with no support for 'no-as-needed'

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Add compat for platforms with no MSG_NOSIGNAL or SO_NOSIGPIPE
Michael Jeanson [Mon, 28 Sep 2015 15:53:19 +0000 (11:53 -0400)] 
Port: Add compat for platforms with no MSG_NOSIGNAL or SO_NOSIGPIPE

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Add AX_LIB_SOCKET_NSL macro to configure.ac
Michael Jeanson [Mon, 28 Sep 2015 15:42:50 +0000 (11:42 -0400)] 
Port: Add AX_LIB_SOCKET_NSL macro to configure.ac

This is required on platforms that need extra libraries to
link socket programs.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Replace bzero() by memset()
Michael Jeanson [Mon, 28 Sep 2015 14:50:54 +0000 (10:50 -0400)] 
Port: Replace bzero() by memset()

bzero() was deprecated in POSIX 2001 and removed from POSIX 2008,
while memset() is part of standard C.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Add dummy.c to libcompat
Michael Jeanson [Mon, 28 Sep 2015 14:26:50 +0000 (10:26 -0400)] 
Port: Add dummy.c to libcompat

The BSD 'ar' command won't accept an empty file list, add a dummy c file.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: uname can return a positive value on success
Michael Jeanson [Mon, 28 Sep 2015 14:17:23 +0000 (10:17 -0400)] 
Port: uname can return a positive value on success

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Replace NAME_MAX by MAXNAMLEN
Michael Jeanson [Mon, 28 Sep 2015 14:13:27 +0000 (10:13 -0400)] 
Port: Replace NAME_MAX by MAXNAMLEN

MAXNAMLEN is defined on Linux, Solaris and BSD

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoChange UUID API prefix from babeltrace_ to bt_
Jérémie Galarneau [Tue, 13 Oct 2015 20:36:56 +0000 (16:36 -0400)] 
Change UUID API prefix from babeltrace_ to bt_

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Add Solaris libuuid compat
Michael Jeanson [Mon, 28 Sep 2015 12:26:00 +0000 (08:26 -0400)] 
Port: Add Solaris libuuid compat

Solaris libuuid lack const qualifiers, add compat functions.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: Add Solaris endian.h compat
Michael Jeanson [Tue, 6 Oct 2015 16:09:02 +0000 (12:09 -0400)] 
Port: Add Solaris endian.h compat

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPort: make bootstrap script work on most shell
Michael Jeanson [Tue, 6 Oct 2015 16:08:00 +0000 (12:08 -0400)] 
Port: make bootstrap script work on most shell

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: babeltrace-log packet seek
Mathieu Desnoyers [Tue, 13 Oct 2015 16:06:26 +0000 (12:06 -0400)] 
Fix: babeltrace-log packet seek

Packet seek has been removed from ctf helper headers somewhere around
Babeltrace 1.1. Since then, babeltrace-log is broken when it needs to
output a file larger than the fixed-sized packet (WRITE_PACKET_LEN
currently defined as (getpagesize() * 8 * CHAR_BIT).

Correctly handle the non-zero return values on ctf_align_pos() and
ctf_move_pos() on the dummy position copy, which are used to validate
whether we need to switch packet or not. Also add an initial packet seek
at the beginning of the file.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: posix_fallocate() returns int > 0 on errors
Michael Jeanson [Tue, 13 Oct 2015 16:13:11 +0000 (12:13 -0400)] 
Fix: posix_fallocate() returns int > 0 on errors

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoConfigure: add check for type
Jonathan Rajotte [Mon, 23 Feb 2015 20:50:38 +0000 (15:50 -0500)] 
Configure: add check for type

Based on autoscan report:

configure.ac: warning: missing AC_TYPE_INT16_T wanted by: formats/ctf/types/integer.c:111
configure.ac: warning: missing AC_TYPE_INT32_T wanted by: formats/ctf/types/integer.c:120
configure.ac: warning: missing AC_TYPE_INT64_T wanted by: lib/trace-collection.c:111
configure.ac: warning: missing AC_TYPE_INT8_T wanted by: formats/ctf/types/integer.c:103
configure.ac: warning: missing AC_TYPE_OFF_T wanted by: formats/ctf/ctf.c:863
configure.ac: warning: missing AC_TYPE_SSIZE_T wanted by: lib/iterator.c:51
configure.ac: warning: missing AC_TYPE_UINT16_T wanted by: formats/ctf/types/integer.c:71
configure.ac: warning: missing AC_TYPE_UINT32_T wanted by: converter/babeltrace-log.c:127
configure.ac: warning: missing AC_TYPE_UINT64_T wanted by: lib/iterator.c:52
configure.ac: warning: missing AC_TYPE_UINT8_T wanted by: converter/babeltrace-log.c:141

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoConfigure: add check on headers
Jonathan Rajotte [Mon, 23 Feb 2015 20:50:37 +0000 (15:50 -0500)] 
Configure: add check on headers

Based on autoscan report:

configure.ac: warning: missing AC_CHECK_HEADERS([fcntl.h]) wanted by: lib/context.c:44
configure.ac: warning: missing AC_CHECK_HEADERS([limits.h]) wanted by: include/babeltrace/compat/limits.h:26
configure.ac: warning: missing AC_CHECK_HEADERS([netdb.h]) wanted by: formats/lttng-live/lttng-live-comm.c:27
configure.ac: warning: missing AC_CHECK_HEADERS([netinet/in.h]) wanted by: formats/lttng-live/lttng-live-comm.c:26
configure.ac: warning: missing AC_CHECK_HEADERS([stddef.h]) wanted by: include/babeltrace/compiler.h:28
configure.ac: warning: missing AC_CHECK_HEADERS([sys/socket.h]) wanted by: formats/lttng-live/lttng-live-comm.c:24

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoConfigure: add missing check for used funcs
Jonathan Rajotte [Mon, 23 Feb 2015 20:50:36 +0000 (15:50 -0500)] 
Configure: add missing check for used funcs

Based on autoscan report:
configure.ac: warning: missing AC_CHECK_FUNCS([ftruncate]) wanted by: formats/ctf/writer/writer.c:237
configure.ac: warning: missing AC_CHECK_FUNCS([gethostbyname]) wanted by: formats/lttng-live/lttng-live-comm.c:122
configure.ac: warning: missing AC_CHECK_FUNCS([localtime_r]) wanted by: formats/ctf/ctf.c:341
configure.ac: warning: missing AC_CHECK_FUNCS([memset]) wanted by: converter/babeltrace-log.c:228
configure.ac: warning: missing AC_CHECK_FUNCS([mkdir]) wanted by: converter/babeltrace-log.c:404
configure.ac: warning: missing AC_CHECK_FUNCS([rmdir]) wanted by: converter/babeltrace-log.c:467
configure.ac: warning: missing AC_CHECK_FUNCS([setenv]) wanted by: include/babeltrace/compat/utc.h:71
configure.ac: warning: missing AC_CHECK_FUNCS([socket]) wanted by: formats/lttng-live/lttng-live-comm.c:129
configure.ac: warning: missing AC_CHECK_FUNCS([strchr]) wanted by: converter/babeltrace-log.c:244
configure.ac: warning: missing AC_CHECK_FUNCS([strdup]) wanted by: converter/babeltrace.c:701
configure.ac: warning: missing AC_CHECK_FUNCS([strerror]) wanted by: formats/ctf/ctf.c:682
configure.ac: warning: missing AC_CHECK_FUNCS([strndup]) wanted by: formats/lttng-live/lttng-live-comm.c:280
configure.ac: warning: missing AC_CHECK_FUNCS([strrchr]) wanted by: converter/babeltrace-log.c:334
configure.ac: warning: missing AC_CHECK_FUNCS([strtoull]) wanted by: converter/babeltrace.c:354
configure.ac: warning: missing AC_CHECK_FUNCS([tzset]) wanted by: include/babeltrace/compat/utc.h:72

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: add compat for glib < 2.32
Michael Jeanson [Tue, 22 Sep 2015 18:46:07 +0000 (14:46 -0400)] 
Fix: add compat for glib < 2.32

A dependency on glib >= 2.32 was introduced in this commit:

commit 347829f5b1eaf79a540f4623f7ae5ee4e9e3d4c7
Author: Philippe Proulx <eeppeliteloop@gmail.com>
Date:   Thu Mar 12 16:14:31 2015 -0400

    Add basic object system

To stay compatible with SLES11, keep our dependency on 2.22 and add a
compatibility header.

Fixes #890

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: make check in OOT build with absolute path
Michael Jeanson [Fri, 4 Sep 2015 21:23:12 +0000 (17:23 -0400)] 
Fix: make check in OOT build with absolute path

The previous patch fixed the out of tree build when the configure script
was called with a path relative to the builddir but still failed when
the path was absolute. This works with both.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: make check in out of tree build
Michael Jeanson [Thu, 3 Sep 2015 18:13:21 +0000 (14:13 -0400)] 
Fix: make check in out of tree build

Use the tracefiles from the source dir when running make check in an out
of tree builddir.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: 32bit values index_major/minor used as 64bit
Michael Jeanson [Tue, 18 Aug 2015 19:39:41 +0000 (15:39 -0400)] 
Fix: 32bit values index_major/minor used as 64bit

This patch fixes compiler warnings on big endian architectures where
be64toh() is a nop and returns the original type.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoHide the packet_seq_num field
Julien Desfossez [Mon, 3 Aug 2015 15:35:38 +0000 (11:35 -0400)] 
Hide the packet_seq_num field

The packet_seq_num is a new field in LTTng 2.8 that should be hidden
from the ctf-text output as it is not really relevant for the users of
the text output.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add bt_ctf_field_type_sequence/array_set_element_type()
Philippe Proulx [Fri, 31 Jul 2015 14:11:58 +0000 (10:11 -0400)] 
ir: add bt_ctf_field_type_sequence/array_set_element_type()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: do not cache variant type's alignment
Philippe Proulx [Tue, 28 Jul 2015 19:09:06 +0000 (15:09 -0400)] 
ir: do not cache variant type's alignment

A variant type's alignment will always be 0
any way, so this caching step is not needed.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: test_ctf_writer: assert() without side effects
Philippe Proulx [Thu, 30 Jul 2015 20:42:32 +0000 (16:42 -0400)] 
Fix: test_ctf_writer: assert() without side effects

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: empty structures are legal in CTF
Philippe Proulx [Thu, 30 Jul 2015 19:31:38 +0000 (15:31 -0400)] 
ir: empty structures are legal in CTF

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add field instance type ID helpers
Philippe Proulx [Mon, 27 Jul 2015 13:02:25 +0000 (09:02 -0400)] 
ir: add field instance type ID helpers

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add bt_ctf_field_get_type_id()
Philippe Proulx [Mon, 27 Jul 2015 12:49:09 +0000 (08:49 -0400)] 
ir: add bt_ctf_field_get_type_id()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add field type ID helpers
Philippe Proulx [Mon, 27 Jul 2015 12:56:02 +0000 (08:56 -0400)] 
ir: add field type ID helpers

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoUnify reference counting using a common bt_object base
Jérémie Galarneau [Thu, 30 Jul 2015 04:16:27 +0000 (00:16 -0400)] 
Unify reference counting using a common bt_object base

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add bt_ctf_trace_get_stream_class_by_id()
Philippe Proulx [Mon, 27 Jul 2015 13:13:46 +0000 (09:13 -0400)] 
ir: add bt_ctf_trace_get_stream_class_by_id()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add internal field path getters
Philippe Proulx [Mon, 27 Jul 2015 12:40:33 +0000 (08:40 -0400)] 
ir: add internal field path getters

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRename bt_object to bt_value
Philippe Proulx [Thu, 23 Jul 2015 21:11:27 +0000 (17:11 -0400)] 
Rename bt_object to bt_value

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add BT_CTF_MOVE()
Philippe Proulx [Wed, 22 Jul 2015 21:05:36 +0000 (17:05 -0400)] 
ir: add BT_CTF_MOVE()

Adds semantics to ownership transfers of CTF IR objects.

This is something that is done often enough to justify the
existence of this macro:

    struct bt_ctf_field_type *type;
    struct bt_ctf_field_type *ret_type;

    /* ... */

    /* move ownership */
    ret_type = type;
    type = NULL;

    /* ... */

    /* put both (safe since type was set to NULL) */
    bt_ctf_put(ret_type);
    bt_ctf_put(type);

With BT_CTF_MOVE():

    struct bt_ctf_field_type *type;
    struct bt_ctf_field_type *ret_type;

    /* ... */

    /* move ownership */
    BT_CTF_MOVE(ret_type, type);

    /* ... */

    /* put both (safe since ownership was moved) */
    bt_ctf_put(ret_type);
    bt_ctf_put(type);

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agotest_ctf_writer.c: use bt_ctf_put() everywhere
Philippe Proulx [Thu, 16 Jul 2015 17:08:53 +0000 (13:08 -0400)] 
test_ctf_writer.c: use bt_ctf_put() everywhere

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: consolidate reference counting functions
Philippe Proulx [Thu, 16 Jul 2015 17:04:50 +0000 (13:04 -0400)] 
ir: consolidate reference counting functions

This patch adds the bt_ctf_get() and bt_ctf_put() functions
which resp. get and put references of any CTF IR object.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: allow structure types to have a minimum align
Philippe Proulx [Tue, 14 Jul 2015 23:42:23 +0000 (19:42 -0400)] 
Fix: allow structure types to have a minimum align

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agotest_ctf_writer: add type alignment tests
Philippe Proulx [Tue, 14 Jul 2015 23:41:34 +0000 (19:41 -0400)] 
test_ctf_writer: add type alignment tests

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: require power of two for type alignment
Philippe Proulx [Tue, 14 Jul 2015 23:36:15 +0000 (19:36 -0400)] 
Fix: require power of two for type alignment

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: do not init. BO of enums/arrays/sequences
Philippe Proulx [Tue, 14 Jul 2015 23:01:02 +0000 (19:01 -0400)] 
Fix: do not init. BO of enums/arrays/sequences

The functions used to create enumeration, array, and
sequence types are different from the other creation
functions in that they register another type at creation
time. Other compound types are empty when created. When a
type is initialized, its byte order setting function is
called, which is recursive for compound types and for the
enumeration type. This overrides the previously set byte
order of the underlying type passed to those creation functions.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoBuild: Update m4 for bison & flex version check to match autoconf-archive file
Jonathan Rajotte [Fri, 10 Jul 2015 15:36:45 +0000 (11:36 -0400)] 
Build: Update m4 for bison & flex version check to match autoconf-archive file

Officials m4 were merged in [1][2].

[1] https://github.com/peti/autoconf-archive/commit/b2bdd8591b2d6b1eb580ead5f978a30e3ecfc36c
[2] https://github.com/peti/autoconf-archive/commit/fd1f2862c1524e73495d67646d26000e2e85e807

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoBuild: add version check on flex
Jonathan Rajotte [Thu, 2 Jul 2015 22:20:25 +0000 (18:20 -0400)] 
Build: add version check on flex

This new m4 macro is valid starting from [1].

[1]http://sourceforge.net/p/flex/flex/ci/712c03b38fb35f9d7f16e0fdd27441c3efda0071/tree/

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoBuild: add version check on autoconf
Jonathan Rajotte [Thu, 2 Jul 2015 19:50:20 +0000 (15:50 -0400)] 
Build: add version check on autoconf

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoBuild: m4 macro for Bison version check
Jonathan Rajotte [Thu, 2 Jul 2015 19:12:31 +0000 (15:12 -0400)] 
Build: m4 macro for Bison version check

This new m4 macro make check for a supported version of Bison.
This macro is valid starting from commit id
e79137accc7ea0352cd4677ff22818f9c68d4eab of the GNU Bison git tree[1].
This check works for version 1.29b to this day.

[1] http://git.savannah.gnu.org/cgit/bison.git/commit/?id=e79137accc7ea0352cd4677ff22818f9c68d4eab

Fixes: #891
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTest: Add a test to ensure multiple keywords can be used in a field path
Jérémie Galarneau [Thu, 2 Jul 2015 18:47:26 +0000 (14:47 -0400)] 
Test: Add a test to ensure multiple keywords can be used in a field path

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Missing postfix_expression DOT keywords in CTF grammar
Jérémie Galarneau [Thu, 2 Jul 2015 18:46:06 +0000 (14:46 -0400)] 
Fix: Missing postfix_expression DOT keywords in CTF grammar

This would cause expressions of the form:

uint32_t a[stream.event.header.seq_len]

to fail to parse since two keywords (stream and event) are used in the
path.

Reported-by: Staffan Mansson <staffan@mansson-net.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Create stream after adding its stream class to a trace
Jérémie Galarneau [Thu, 2 Jul 2015 18:43:12 +0000 (14:43 -0400)] 
Fix: Create stream after adding its stream class to a trace

This ensures that a stream class' id is set before we create a stream
instance and initialize its packet header. Otherwise, the packet header
stream_id is initialized to its default value (0).

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Remove overly-strict freeze check on variants and structures
Jérémie Galarneau [Thu, 2 Jul 2015 18:39:51 +0000 (14:39 -0400)] 
Fix: Remove overly-strict freeze check on variants and structures

bt_ctf_field_type_structure_set_field_index() and
bt_ctf_field_type_variant_set_field_index() are both internal APIs
which are used when resolving field paths.

For exemple, when a sequence's field path is resolved, the sequence
is copied and replaced in its parent since we are setting the
resolved path as part of the sequence. This is done so that different
sequence members which would have been declared using the same sequence
type instance can have length fields which resolve to different absolute
paths.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoDocs: A stream has no ownership of its trace
Jérémie Galarneau [Thu, 2 Jul 2015 18:38:08 +0000 (14:38 -0400)] 
Docs: A stream has no ownership of its trace

Add a comment to explain why the trace's refcount is not incremented
when setting a stream's trace.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Missing NULL check in bt_ctf_field_sequence_destroy
Jérémie Galarneau [Thu, 2 Jul 2015 18:37:03 +0000 (14:37 -0400)] 
Fix: Missing NULL check in bt_ctf_field_sequence_destroy

A sequence's "elements" array might be NULL if
bt_ctf_field_sequence_set_length() was never called during its lifetime.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoAdd test_bt_objects to .gitignore
Jérémie Galarneau [Wed, 27 May 2015 19:47:58 +0000 (15:47 -0400)] 
Add test_bt_objects to .gitignore

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add tests for bt_ctf_field_variant_get_current_field()
Philippe Proulx [Mon, 25 May 2015 00:33:37 +0000 (20:33 -0400)] 
ir: add tests for bt_ctf_field_variant_get_current_field()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add bt_ctf_field_variant_get_current_field()
Philippe Proulx [Mon, 25 May 2015 00:24:54 +0000 (20:24 -0400)] 
ir: add bt_ctf_field_variant_get_current_field()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoClean-up: get_field_type should only have one return statement
Jérémie Galarneau [Mon, 25 May 2015 20:09:27 +0000 (16:09 -0400)] 
Clean-up: get_field_type should only have one return statement

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: bt_ctf_trace_freeze must fail if type resolving fails
Jérémie Galarneau [Mon, 25 May 2015 20:08:26 +0000 (16:08 -0400)] 
Fix: bt_ctf_trace_freeze must fail if type resolving fails

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Return a variant's alignment as 0 (undefined).
Jérémie Galarneau [Fri, 22 May 2015 20:31:59 +0000 (16:31 -0400)] 
Fix: Return a variant's alignment as 0 (undefined).

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: copy variants and sequences when setting a field path
Jérémie Galarneau [Thu, 14 May 2015 16:58:52 +0000 (12:58 -0400)] 
ir: copy variants and sequences when setting a field path

Variants and sequences might be used in multiple structures. Therefore,
they are replaced by a copy with the path to their tag or sequence
length field set.

This is done on freeze, hence a user should not expect to be able
to modify a sequence's or variant's attributes subsequently.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: ir: disallow setting the alignment of certain types
Jérémie Galarneau [Wed, 13 May 2015 18:11:35 +0000 (14:11 -0400)] 
Fix: ir: disallow setting the alignment of certain types

Setting the alignment of sequences, arrays, variants and structures
makes no sense.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: compute array, sequence and structure alignment dynamically
Jérémie Galarneau [Wed, 13 May 2015 18:09:23 +0000 (14:09 -0400)] 
ir: compute array, sequence and structure alignment dynamically

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: support optional parameters in bt_ctf_field_type_variant_get_field
Jérémie Galarneau [Wed, 13 May 2015 18:07:37 +0000 (14:07 -0400)] 
ir: support optional parameters in bt_ctf_field_type_variant_get_field

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: support optional parameters in bt_ctf_field_type_structure_get_field
Jérémie Galarneau [Wed, 13 May 2015 18:05:53 +0000 (14:05 -0400)] 
ir: support optional parameters in bt_ctf_field_type_structure_get_field

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoClean-up: clean multi-line function call
Jérémie Galarneau [Wed, 13 May 2015 18:03:40 +0000 (14:03 -0400)] 
Clean-up: clean multi-line function call

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoTests: fix possible null pointer dereference
Jérémie Galarneau [Wed, 13 May 2015 16:04:35 +0000 (12:04 -0400)] 
Tests: fix possible null pointer dereference

Reported by Coverity Scan
*** CID 1297896:  Null pointer dereferences  (NULL_RETURNS)
/tests/lib/test_ctf_writer.c: 865 in append_complex_event()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Check validity of returned ctf_type_id
Jérémie Galarneau [Wed, 13 May 2015 15:50:05 +0000 (11:50 -0400)] 
Fix: Check validity of returned ctf_type_id

Reported by Coverity Scan as
** CID 1297897:  Error handling issues  (CHECKED_RETURN)
/formats/ctf/ir/visitor.c: 726 in print_path()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Missing check that token linked-list is not NULL
Jérémie Galarneau [Tue, 12 May 2015 18:22:01 +0000 (14:22 -0400)] 
Fix: Missing check that token linked-list is not NULL

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: validate sequence length fields and variant tags of stream classes
Jérémie Galarneau [Mon, 11 May 2015 21:38:50 +0000 (17:38 -0400)] 
ir: validate sequence length fields and variant tags of stream classes

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: validate sequence length fields and variant tags of event classes
Jérémie Galarneau [Mon, 11 May 2015 21:37:59 +0000 (17:37 -0400)] 
ir: validate sequence length fields and variant tags of event classes

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: Implement a field type visitor to resolve dynamic scopes
Jérémie Galarneau [Mon, 11 May 2015 21:35:28 +0000 (17:35 -0400)] 
ir: Implement a field type visitor to resolve dynamic scopes

Implement a visitor looking for sequences' length field and variants'
tag names and resolve them to their proper type field in the trace.

Validate that sequence lengths are unsigned integers and variant
tags are enumerations and that both respect CTF's lexical and dynamic
scoping rules.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: only perform trace freeze if not already frozen
Jérémie Galarneau [Mon, 11 May 2015 21:34:06 +0000 (17:34 -0400)] 
ir: only perform trace freeze if not already frozen

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoClean-up: line exceeding 80 chars in trace.c
Jérémie Galarneau [Mon, 11 May 2015 21:33:25 +0000 (17:33 -0400)] 
Clean-up: line exceeding 80 chars in trace.c

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoDocs: add comment about bt_ctf_trace_add_stream_class validation
Jérémie Galarneau [Mon, 11 May 2015 21:32:36 +0000 (17:32 -0400)] 
Docs: add comment about bt_ctf_trace_add_stream_class validation

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add bt_ctf_field_type_variant_set_tag()
Jérémie Galarneau [Mon, 11 May 2015 21:31:06 +0000 (17:31 -0400)] 
ir: add bt_ctf_field_type_variant_set_tag()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add tag field path to variant field type
Jérémie Galarneau [Mon, 11 May 2015 21:29:53 +0000 (17:29 -0400)] 
ir: add tag field path to variant field type

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add length_field_path to sequence field type
Jérémie Galarneau [Mon, 11 May 2015 21:27:09 +0000 (17:27 -0400)] 
ir: add length_field_path to sequence field type

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add bt_ctf_field_path internal API
Jérémie Galarneau [Mon, 11 May 2015 21:24:24 +0000 (17:24 -0400)] 
ir: add bt_ctf_field_path internal API

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add bt_ctf_field_type_variant_get_field_name_index()
Jérémie Galarneau [Mon, 11 May 2015 21:22:27 +0000 (17:22 -0400)] 
ir: add bt_ctf_field_type_variant_get_field_name_index()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoir: add bt_ctf_field_type_structure_get_field_name_index()
Jérémie Galarneau [Mon, 11 May 2015 21:19:17 +0000 (17:19 -0400)] 
ir: add bt_ctf_field_type_structure_get_field_name_index()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoClean-up: Missing space in event-types-internal.h
Jérémie Galarneau [Mon, 11 May 2015 20:02:04 +0000 (16:02 -0400)] 
Clean-up: Missing space in event-types-internal.h

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