babeltrace.git
11 months agoport: disable debug-info by default on FreeBSD stable-1.5
Michael Jeanson [Mon, 19 Oct 2020 20:03:44 +0000 (16:03 -0400)] 
port: disable debug-info by default on FreeBSD

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I5acd4e897f50e95d2517079c0845825951aa43b5
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
11 months agoport: add missing includes for FreeBSD compat
Michael Jeanson [Mon, 19 Oct 2020 19:53:52 +0000 (15:53 -0400)] 
port: add missing includes for FreeBSD compat

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I3c1b16a94d7bcf2a2760fc51d66b40b868c5a63b
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
20 months agobindings: try importing collections.abc first for forward compatibility
Christophe Bedard [Sat, 25 Apr 2020 02:54:45 +0000 (22:54 -0400)] 
bindings: try importing collections.abc first for forward compatibility

Using the babeltrace Python module with Python 3.3-3.8 gives a warning:

/usr/lib/python3/dist-packages/babeltrace/babeltrace.py:811:
DeprecationWarning: Using or importing the ABCs from 'collections'
instead of from 'collections.abc' is deprecated since Python 3.3,
and in 3.9 it will stop working

Therefore, for forward compability (Python 3.9+), try importing it
using the new way first. Otherwise, fall back on the old way.

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
Change-Id: I7f650593a013643b2fb0b77b0d388cf57bc2b765
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
20 months agoman: fix typo in babeltrace.1
Christophe Bedard [Sat, 25 Apr 2020 02:23:33 +0000 (22:23 -0400)] 
man: fix typo in babeltrace.1

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
Change-Id: I1b815d96ca03d2ce30a5c33881b340c9b73e0b9c
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
23 months agoUpdate version to v1.5.8 v1.5.8
Jérémie Galarneau [Wed, 5 Feb 2020 19:43:31 +0000 (14:43 -0500)] 
Update version to v1.5.8

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1fb3a8cebcba49ca0d4dfd0437380b574c71c39b

2 years agoFix: lttng-live format: do not error out on empty streams hang up
Mathieu Desnoyers [Thu, 5 Dec 2019 06:58:09 +0000 (01:58 -0500)] 
Fix: lttng-live format: do not error out on empty streams hang up

Attaching to a stream hung up before providing any trace packet
causes ctf_open_mmap_stream_read() to return an error.

This kind of scenario can happen with the upcoming "lttng clear"
feature.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
2 years agoFix: lttng-live: ctf_live_packet_seek stream hang up handling
Mathieu Desnoyers [Thu, 5 Dec 2019 06:58:08 +0000 (01:58 -0500)] 
Fix: lttng-live: ctf_live_packet_seek stream hang up handling

When get_next_index sets the index position to EOF,
ctf_live_packet_seek() should in turn set the stream position to EOF
to propagate the hung up state.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
2 years agoFix: lib/iterator.c: unbalanced ctx put (leak)
Mathieu Desnoyers [Thu, 5 Dec 2019 06:58:07 +0000 (01:58 -0500)] 
Fix: lib/iterator.c: unbalanced ctx put (leak)

Missing context put in iterator init error path.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
2 years agoFix: lttng-live: lttng_live_open_trace_read memory leak
Mathieu Desnoyers [Thu, 5 Dec 2019 06:58:06 +0000 (01:58 -0500)] 
Fix: lttng-live: lttng_live_open_trace_read memory leak

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
2 years agoFix: trace-collection: trace clock use after free
Mathieu Desnoyers [Thu, 5 Dec 2019 06:58:05 +0000 (01:58 -0500)] 
Fix: trace-collection: trace clock use after free

The trace collection should copy the trace clock object rather
than take a reference to the first trace's trace clock, because
it may be freed when the trace is removed (e.g. application going
away in per-pid live tracing).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
2 years agoFix: lttng-live: use-after-free in get_next_index()
Mathieu Desnoyers [Thu, 5 Dec 2019 06:58:04 +0000 (01:58 -0500)] 
Fix: lttng-live: use-after-free in get_next_index()

Running babeltrace under valgrind with a test-cases doing per-pid
lttng tracing in live mode triggers this use-after-free in
get_next_index() when stream is hung up.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
2 years agoDo not use diagnostic pragma when GCC version is lower than 4.6.0
Jonathan Rajotte [Thu, 4 Jul 2019 18:40:03 +0000 (14:40 -0400)] 
Do not use diagnostic pragma when GCC version is lower than 4.6.0

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Id17713b2683ea0bbe17388282557d2a75be8f177
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
2 years agoMissing define when not building with gcc
Jonathan Rajotte [Thu, 4 Jul 2019 18:39:01 +0000 (14:39 -0400)] 
Missing define when not building with gcc

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Ieb7484ad0680483d7a7290ff688a161cc69925e3
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
2 years agoUpdate version to v1.5.7 v1.5.7
Jérémie Galarneau [Tue, 25 Jun 2019 17:50:21 +0000 (13:50 -0400)] 
Update version to v1.5.7

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4d3c374e762888679474b3330bf959b87d3910d2

2 years agoCleanup: bitfields: streamline use of underscores
Mathieu Desnoyers [Fri, 17 May 2019 21:40:43 +0000 (17:40 -0400)] 
Cleanup: bitfields: streamline use of underscores

Do not prefix macro arguments with underscores. Use one leading
underscore as prefix for local variables defined within macros.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie1c2f7f59f605ac62d483aba67b3f70cef27bf21
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
2 years agoFix: bitfield: shift undefined/implementation defined behaviors
Mathieu Desnoyers [Fri, 17 May 2019 19:32:38 +0000 (15:32 -0400)] 
Fix: bitfield: shift undefined/implementation defined behaviors

bitfield.h uses the left shift operator with a left operand which
may be negative. The C99 standard states that shifting a negative
value is undefined.

When building with -Wshift-negative-value, we get this gcc warning:

In file included from /home/smarchi/src/babeltrace/include/babeltrace/ctfser-internal.h:44:0,
                 from /home/smarchi/src/babeltrace/ctfser/ctfser.c:42:
/home/smarchi/src/babeltrace/include/babeltrace/ctfser-internal.h: In function ‘bt_ctfser_write_unsigned_int’:
/home/smarchi/src/babeltrace/include/babeltrace/bitfield-internal.h:116:24: error: left shift of negative value [-Werror=shift-negative-value]
   mask = ~((~(type) 0) << (__start % ts));  \
                        ^
/home/smarchi/src/babeltrace/include/babeltrace/bitfield-internal.h:222:2: note: in expansion of macro ‘_bt_bitfield_write_le’
  _bt_bitfield_write_le(ptr, type, _start, _length, _v)
  ^~~~~~~~~~~~~~~~~~~~~
/home/smarchi/src/babeltrace/include/babeltrace/ctfser-internal.h:418:3: note: in expansion of macro ‘bt_bitfield_write_le’
   bt_bitfield_write_le(mmap_align_addr(ctfser->base_mma) +
   ^~~~~~~~~~~~~~~~~~~~

This boils down to the fact that the expression ~((uint8_t)0) has type
"signed int", which is used as an operand of the left shift.  This is due
to the integer promotion rules of C99 (6.3.3.1):

    If an int can represent all values of the original type, the value is
    converted to an int; otherwise, it is converted to an unsigned int.
    These are called the integer promotions. All other types are unchanged
    by the integer promotions.

We also need to cast the result explicitly into the left hand
side type to deal with:

warning: large integer implicitly truncated to unsigned type [-Woverflow]

The C99 standard states that a right shift has implementation-defined
behavior when shifting a signed negative value. Add a preprocessor check
that the compiler provides the expected behavior, else provide an
alternative implementation which guarantees the intended behavior.

A preprocessor check is also added to ensure that the compiler
representation for signed values is two's complement, which is expected
by this header.

Document that this header strictly respects the C99 standard, with
the exception of its use of __typeof__.

Adapt use of _bt_piecewise_lshift in plugins/text/pretty/print.c
to the new API.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Icf02c4a6d2b7fb955d36f2843eaf62b8ceef5679

2 years agoFix: array and sequence field's 'elems' members can be left NULL
Jérémie Galarneau [Thu, 4 Apr 2019 14:19:54 +0000 (10:19 -0400)] 
Fix: array and sequence field's 'elems' members can be left NULL

Issue
---

The behaviour of a number of "rw" functions associated with array and
sequence field types differ when their element's declaration meets the
following criteria:
  - is an integer,
  - is byte-aligned,
  - is byte-sized,
  - is UTF-8 or ASCII encoded.

Those criteria are used to determine if the elements of either arrays
or sequences should be interpreted as characters.

1) The implementation of sequence and array definitions creation
   functions do not initialize their 'elems' member (a g_ptr_array),
   instead initializing a 'string' member (a g_string).

2) The 'ctf' format plug-in does not initialize the 'elems' array with
   the decoded integer definitions, instead only initializing the
   'string' member with the field's contents.

3) The 'ctf-text' format plug-in uses the internal headers to
   access the 'string' member of those definitions directly.

The 'string' member of both sequence and array definitions is meant as
a helper to allow the access to their contents in textual form.

However, while an array's content is made available under that form
through the public bt_ctf_get_char_array() function, there is no
equivalent accessor for the sequence type, as reported by a number of
users [1][2]. The 'ctf-text' format implementation works around this
limitation by making use of the internal headers to access the string
member directly.

Moreover, bypassing the creation and initialization of the 'elems'
member of both array and sequence definitions results in a crash when
bt_ctf_get_field_list() is used with these types when they contain
character elements, as reported on the mailing list [1].

Solution
---

This fix eliminates the bypass used by the definition creation
functions and 'ctf' format plug-in, ensuring that both the 'string'
and 'elems' members are initialized even if the elements fit the
"character" criteria.

This fixes the crash on a unchecked NULL pointer in
bt_ctf_get_field_list() reported in [1] when trying to access the
sequence's contents.

The checks for the various criteria that make an integer a
character have been moved to an internal function, bt_int_is_char()
since their (incorrect) duplication obscured the underlying problem.

For instance, a sequence's 'string' member is allocated if the
elements are ASCII or UTF-8 encoded integers, but only used when
the elements are byte-sized and byte-aligned (as opposed to the
intended behaviour in types/array.c).

With this fix applied, sequence elements can be accessed normally
through the existing bt_ctf_get_field_list() or bt_ctf_get_index()
functions.

Example:
```
/*
 * Print a sequence's content if it is text.
 * Error handling omitted.
 */
void print_sequence(const struct bt_ctf_event *event,
                const struct bt_definition *sequence_definition)
{
        int signedness, integer_len;
        unsigned int i, element_count;
        const struct bt_definition * const *elements;
        const struct bt_definition *element;
        const struct bt_declaration *element_declaration;
        enum ctf_string_encoding encoding;

        bt_ctf_get_field_list(event, sequence_definition, &elements,
                &element_count);
        if (element_count == 0) {
                return;
        }

        /* Is this a text sequence? */
        element = elements[0];
        element_declaration = bt_ctf_get_decl_from_def(element);
        if (bt_ctf_field_type(element_declaration) != CTF_TYPE_INTEGER) {
                /* Not a text sequence. */
                return;
        }

        signedness = bt_ctf_get_int_signedness(element_declaration);
        encoding = bt_ctf_get_encoding(element_declaration);
        integer_len = bt_ctf_get_int_len(element_declaration);
        if (integer_len != 8 ||
                (encoding != CTF_STRING_UTF8 && encoding != CTF_STRING_ASCII)) {
                /* Not a text sequence. */
                return;
        }

        putchar('"');
        for (i = 0; i < element_count; i++) {
                int val = signedness ?
                        bt_ctf_get_int64(elements[i]) :
                        bt_ctf_get_uint64(elements[i]);

                putchar(val);
        }
        putchar('"');
}
```

Notes
---

Since it is not possible for a user of the public API to determine the
alignment of a field in the ctf trace, it is not possible to check for
the criteria that make an array a "character array".

An array's element declaration could indicate that it is a byte-sized
and UTF8/ASCII encoded integer. Yet, the 'string' member could be left
NULL if the element's alignment is not '8'.

Hence, while it is possible to use the bt_ctf_get_char_array()
function on array definitions that look like "character arrays", users
should be careful in doing so.

bt_ctf_get_char_array() returning NULL should not be assumed to
indicate that an array is empty. Under such circumstances, reader code
should fall-back to using bt_ctf_get_field_list() to access the
array's contents, as shown in the example above.

[1] https://lists.lttng.org/pipermail/lttng-dev/2019-April/028704.html
[2] https://github.com/efficios/babeltrace/pull/98

Reported-by: romendmsft <romend@microsoft.com>
Reported-by: Milian Wolff <milian.wolff@kdab.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: invalid alignment of enumeration fields
Jérémie Galarneau [Tue, 30 Oct 2018 23:32:06 +0000 (00:32 +0100)] 
Fix: invalid alignment of enumeration fields

Issue
---

According to the CTF specification, the alignment of an enumeration is
that of its container integer field declaration. However, an
enumeration field's alignment is always initialized to 1.

This causes babeltrace to fail to read traces produced by lttng-ust
following a fix that causes it to generate extended event headers. The
problem is observed on ARM platforms since lttng-ust will produce a
layout that does not result in unaligned memory accesses.

Solution
---

The alignment of the enumeration declaration's container is sampled
when the enumeration declaration is created.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoUpdate version to v1.5.6 v1.5.6
Jérémie Galarneau [Tue, 3 Jul 2018 19:29:09 +0000 (15:29 -0400)] 
Update version to v1.5.6

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: remove left-over debug logging statement
Jérémie Galarneau [Tue, 3 Jul 2018 18:38:02 +0000 (14:38 -0400)] 
Fix: remove left-over debug logging statement

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoUse trace->trace_id in check to remove trace from bt_ctx
Jonathan Rajotte [Tue, 3 Jul 2018 16:28:54 +0000 (12:28 -0400)] 
Use trace->trace_id in check to remove trace from bt_ctx

Commit b9e6498df8b3e7c2ad312dccddf9f1a5e181648e removes the existence
guarantee of the trace_id hash table key by moving the trace->in_use
assignation before the assignation of trace_id and insertion into the
hash table.

Use the trade_id field value to validate if it should be removed from
the hash table. A NULL trace_id field indicates that no insertion was
performed.

This is mostly a workaround to a problem found in, at least, glib 2.28
where g_hash_table_lookup_node() aborts on a SIGFPE signal due to
modulo by zero. The exact cause for this is unknown for now, but a
similar problem was reported against Nautilus [1].

There is little reason for "mod" to be 0 at that point, as explained
in the bug report.

Currently unable to reproduce.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1074401

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: missing initializer braces warning
Jérémie Galarneau [Fri, 8 Jun 2018 16:16:16 +0000 (12:16 -0400)] 
Fix: missing initializer braces warning

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: zero out URL parsing array before use and ensure proper error reporting
Francis Deslauriers [Fri, 4 May 2018 16:07:34 +0000 (12:07 -0400)] 
Fix: zero out URL parsing array before use and ensure proper error reporting

The remain[2] array is being used uninitialized when such URI is used:
`net://localhost:1234`.
The following line (142) will return 1:
  `ret = sscanf(remain[0], ":%d%s", &ctx->port, remain[1]);`
because `sscanf` won't match on the string (%s) delimiter.
This will leave `remain[2]` uninitialized.

This potentially uninitialized array is being used further down the function.

As a fix, we zero out the array at initialization time to prevent the
`strlen(remain[2])` call from using uninitialized memory.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoUpdate version to v1.5.5 v1.5.5
Jérémie Galarneau [Mon, 26 Mar 2018 19:01:54 +0000 (15:01 -0400)] 
Update version to v1.5.5

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoPropagate error from packet_seek in case of truncated packet
Jonathan Rajotte [Wed, 7 Feb 2018 22:52:05 +0000 (17:52 -0500)] 
Propagate error from packet_seek in case of truncated packet

Report the error all the way up allowing users/scripts to perform error
detection and act on it.

Print to stderr the truncated packet information for easier
identification.

Introduce bt_packet_seek_error enum for specific error handling.

Use the ERANGE errno for error propagation inside bt_iter_next and
ctf_read_event.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: report truncated files while reading
Mathieu Desnoyers [Tue, 6 Feb 2018 20:40:19 +0000 (15:40 -0500)] 
Fix: report truncated files while reading

When index files are available, this ensures we report the issue
properly before mapping a truncated packet rather than hitting a
SIGBUS.

For traces without index files, remove the check that was done at
index creation, and use the new check done when mapping the packet
instead. This ensures babeltrace can print stream data prior to the
truncated packet for this stream.

TODO: What is _not_ done in this patch is changing handling of truncated
packets: this should be treated as a warning rather than an error, so
processing of other streams continue.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
CC: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoUpdate version to v1.5.4 v1.5.4
Jérémie Galarneau [Thu, 1 Feb 2018 03:01:42 +0000 (22:01 -0500)] 
Update version to v1.5.4

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: use signed accessors for clock offsets
Jérémie Galarneau [Thu, 1 Feb 2018 02:31:08 +0000 (21:31 -0500)] 
Fix: use signed accessors for clock offsets

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: signedness error in python complements
Jérémie Galarneau [Thu, 1 Feb 2018 02:24:10 +0000 (21:24 -0500)] 
Fix: signedness error in python complements

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: handle packet_seek errors
Mathieu Desnoyers [Sun, 23 Aug 2015 03:50:56 +0000 (20:50 -0700)] 
Fix: handle packet_seek errors

This is needed to correctly handle SIGINT in live view mode. Without
handling this situation correctly, we can often see the following issue
upon SIGINT:

[error] Stream 18446744073709551615 is not declared in metadata.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: prevent calling adding the same trace recursively
Julien Desfossez [Thu, 23 Nov 2017 23:43:52 +0000 (18:43 -0500)] 
Fix: prevent calling adding the same trace recursively

add_one_trace may need to fetch new streams, which may lead to adding
new traces to the ctf_traces hashtable and recursively calling
add_one_trace. This is problematic because we cannot modify a hashtable
we are iterating on, and we cannot perform twice the add_one_trace for
the same trace.

This fix, ensures this situation cannot happen, by checking if the
number of traces changed during the iteration and by making sure a trace
is considered in_use as soon as we enter the add_one_trace function.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Acked-by: Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
Tested-by: Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: Make sure we have all the metadata streams before adding new traces
Julien Desfossez [Thu, 23 Nov 2017 23:00:14 +0000 (18:00 -0500)] 
Fix: Make sure we have all the metadata streams before adding new traces

The add_one_trace function needs to have a metadata stream for all the
known traces. If it does not, we could end up in situations where we
fetch new streams while adding a trace which causes a lot of problems.

Now we ensure we have all the metadata streams before adding the traces.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Acked-by: Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
Tested-by: Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoAdd missing debugging information in the live plugin
Julien Desfossez [Thu, 23 Nov 2017 21:54:44 +0000 (16:54 -0500)] 
Add missing debugging information in the live plugin

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: set stream id in HUP case
Mathieu Desnoyers [Tue, 25 Aug 2015 18:41:04 +0000 (14:41 -0400)] 
Fix: set stream id in HUP case

In the case where a stream is closed when we get its first index, we
still need a valid stream_id to assign it in the right stream (channel).
In this case, it is not useful afterwards, but the debug output has the
right value instead of -1ULL.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: Use list rather than ptr array for trace streams
Mathieu Desnoyers [Tue, 25 Aug 2015 16:35:27 +0000 (12:35 -0400)] 
Fix: Use list rather than ptr array for trace streams

This fixes stream removal on HUP.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: leak of streams
Mathieu Desnoyers [Tue, 25 Aug 2015 12:24:13 +0000 (08:24 -0400)] 
Fix: leak of streams

Streams can be added when we attach to a session and if new streams are
added while the session is running. We were overriding the session
streams array in get_new_stream, so at teardown we could leak the
streams that were added before that call. We now keep a list of all the
streams in the session and add each stream in that list in both code
paths.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: handle 0 session case in ask new streams
Mathieu Desnoyers [Tue, 25 Aug 2015 12:16:37 +0000 (08:16 -0400)] 
Fix: handle 0 session case in ask new streams

If all sessions are closed by the time we ask for new streams, we could
end up looping forever waiting for new streams, so we now check we are
still waiting for something before looping.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: break loop on getting metadata error
Mathieu Desnoyers [Wed, 19 Aug 2015 17:47:53 +0000 (10:47 -0700)] 
Fix: break loop on getting metadata error

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: return error on ask_new_stream when should quit
Mathieu Desnoyers [Tue, 18 Aug 2015 21:27:07 +0000 (14:27 -0700)] 
Fix: return error on ask_new_stream when should quit

Otherwise, the caller will try to continue adding partially set streams
to the trace.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: don't access missing ctf trace when getting metadata
Mathieu Desnoyers [Fri, 14 Aug 2015 18:55:11 +0000 (14:55 -0400)] 
Fix: don't access missing ctf trace when getting metadata

We can get metadata when still in the trace open functions, in which
case the ctf trace is not allocated nor available yet. This fixes a
segmentation fault in stress-test.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
3 years agoFix: lttng-live discarded event count after inactivity
Julien Desfossez [Tue, 9 Jan 2018 22:12:54 +0000 (17:12 -0500)] 
Fix: lttng-live discarded event count after inactivity

When a stream is inactive, the consumer produces fake indexes which are
beacons to let the viewer know a stream has not produced any data up to
a certain timestamp. These beacon are actually real packet indexes with
all the fields set to 0 except for the timestamp_end. Currently we keep
these beacons just like we keep real indexes. The problem is that when
we switch packet, we compare the events_discarded field in the index we
just received with the same field in the previous index. In the case
where a stream has been inactive, we have received inactivity beacons,
and set the discarded_event field to 0, so the difference with the next
real index might be wrong.

In fact, since the inactivity beacons are only used to push the
timestamp end of a stream, we don't need to keep them and we actually
need to keep most of the data from the real previous index. So we now
copy the entire prev_index into the cur_index when we receive an
inactivity beacon. We could refactor the code to avoid performing the
pointer swap of cur and prev indexes, but this implies a redesign of
much of the packet switching code which would affect other code paths.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoFix: timegm compat on Solaris
Michael Jeanson [Mon, 13 Nov 2017 20:06:29 +0000 (15:06 -0500)] 
Fix: timegm compat on Solaris

On Solaris 11 setting TZ to an empty string before calling mktime will
in some circumstances do the conversion in localtime instead of UTC as
expected.

Replace the empty string by "UTC".

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoFix: python bindings when building with PIE hardening
Michael Jeanson [Wed, 25 Oct 2017 20:30:31 +0000 (16:30 -0400)] 
Fix: python bindings when building with PIE hardening

Work around a bug/limitation in python distutils where object files are
built with -fPIC appended after the CFLAGS but the final shared object
is linked with -shared before the LDFLAGS which can then be overriden by
hardening flags and result in an invalid build.

The work around is to append -shared to the LDFLAGS making sure it's not
overriden.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agolttng-live: print discarded event and packet lost warnings on stderr
Mathieu Desnoyers [Thu, 28 Sep 2017 14:00:32 +0000 (10:00 -0400)] 
lttng-live: print discarded event and packet lost warnings on stderr

Reported-by: Liguang Li <liguang.lee6@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoUpdate version to v1.5.3 v1.5.3
Jérémie Galarneau [Fri, 4 Aug 2017 17:07:23 +0000 (13:07 -0400)] 
Update version to v1.5.3

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoFix: unknown variable name in Python writer
Marie Martin [Fri, 4 Aug 2017 16:40:35 +0000 (12:40 -0400)] 
Fix: unknown variable name in Python writer

Signed-off-by: Marie Martin <marie.martin@etu.utc.fr>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoFix live-comm: only apply retry timeout for already seen inactive indexes.
Jonathan Rajotte [Mon, 24 Jul 2017 20:06:18 +0000 (16:06 -0400)] 
Fix live-comm: only apply retry timeout for already seen inactive indexes.

Tested-by: Anton Smyk <anton.smyk@itiviti.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoFix live-comm: merge TCP socket write-write sequence in a single write
Jonathan Rajotte [Mon, 24 Jul 2017 20:06:17 +0000 (16:06 -0400)] 
Fix live-comm: merge TCP socket write-write sequence in a single write

The live protocol implementation is often sending content
on TCP sockets in two separate writes. One to send a command header,
and the second one sending the command's payload. This was presumably
done under the assumption that it would not result in two separate
TCP packets being sent on the network (or that it would not matter).

Delayed ACK-induced delays were observed [1] on the second write of the
"write header, write payload" sequence and result in problematic
latency build-ups for live clients connected to moderately/highly
active sessions.

Fundamentaly, this problem arises due to the combination of Nagle's
algorithm and the delayed ACK mechanism which make write-write-read
sequences on TCP sockets problematic as near-constant latency is
expected when clients can keep-up with the event production rate.

In such a write-write-read sequence, the second write is held up until
the first write is acknowledged (TCP ACK). The solution implemented
by this patch bundles the writes into a single one [2].

[1] https://github.com/tbricks/wireshark-lttng-plugin
Basic Wireshark dissector for lttng-live by Anto Smyk from Itiviti
[2] https://lists.freebsd.org/pipermail/freebsd-net/2006-January/009527.html

Reported-by: Anton Smyk <anton.smyk@itiviti.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoFix: use LDFLAGS instead of LIBS for python bindings
Michael Jeanson [Fri, 2 Jun 2017 15:56:44 +0000 (11:56 -0400)] 
Fix: use LDFLAGS instead of LIBS for python bindings

Turns out that contrary to what is documented some versions of distutils
don't honor the LIBS variable, use LDFLAGS instead.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoFix: Add missing LIBS to python bindings
Michael Jeanson [Fri, 26 May 2017 18:25:37 +0000 (14:25 -0400)] 
Fix: Add missing LIBS to python bindings

Also move includes to CPPFLAGS.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoax_lib_elfutils -> bt_lib_elfutils
Philippe Proulx [Wed, 2 Nov 2016 06:01:30 +0000 (02:01 -0400)] 
ax_lib_elfutils -> bt_lib_elfutils

`ax` is a prefix for the GNU Autoconf Archive. `ax_lib_elfutils`
should be namespaced within the project here, with the `bt_` prefix.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agom4/ax_lib_elfutils.m4: use m4_default() for optional args.
Philippe Proulx [Wed, 2 Nov 2016 05:41:13 +0000 (01:41 -0400)] 
m4/ax_lib_elfutils.m4: use m4_default() for optional args.

The current macro code does not work because, if you provide 4
arguments to the macro, then `true_action` is not defined (but
it should be: it's the third argument).

Use m4_default() here to expand to a default value if the
argument does not exist.

Also use [:] instead of [] (good practice, safer for shells).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agom4/ax_lib_elfutils.m4: add cache variable
Philippe Proulx [Wed, 2 Nov 2016 05:40:12 +0000 (01:40 -0400)] 
m4/ax_lib_elfutils.m4: add cache variable

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoBuild Python bindings with distutils for consistent installs
Francis Deslauriers [Tue, 11 Apr 2017 19:27:37 +0000 (15:27 -0400)] 
Build Python bindings with distutils for consistent installs

v5: Manually load shared objects used by the Babeltrace Python module

This patch changes the build system used to compile and install the
Python Bindings. Distutils is used to find the right install directory.
When the install directory generated from the install prefix is not in
the Python search path (PYTHONPATH), we print a warning explaining what
can be done to include it.
It uses Distutils which is part of the Python standard library.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoSet the minimum Python version to 3.0
Francis Deslauriers [Fri, 26 May 2017 13:20:41 +0000 (09:20 -0400)] 
Set the minimum Python version to 3.0

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoFix: disable debug by default info on Cygwin
Michael Jeanson [Fri, 7 Apr 2017 19:44:34 +0000 (15:44 -0400)] 
Fix: disable debug by default info on Cygwin

elfutils is not available on Cygwin.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoFix: ctf writer test on Cygwin
Michael Jeanson [Thu, 6 Apr 2017 19:00:44 +0000 (15:00 -0400)] 
Fix: ctf writer test on Cygwin

In the ctf writer test we execl() some libtool wrappers that get confused
when arg[0] is not the full path to the binary.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoFix: text output missing separator when printing the domain
Julien Desfossez [Fri, 17 Mar 2017 20:15:23 +0000 (16:15 -0400)] 
Fix: text output missing separator when printing the domain

With the "-f all" option, we expect to see
<hostname>:<domain>:<loglevel>, but instead we see
<hostname><domain>:<loglevel>.

Judging from the pattern of the other printed fields, the check for
"dom_print" variable seems to be missing when printing the domain.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoUpdate version to v1.5.2 v1.5.2
Jérémie Galarneau [Tue, 21 Feb 2017 03:06:28 +0000 (22:06 -0500)] 
Update version to v1.5.2

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoAdd empty plug-in hooks to prevent their elimination by the linker
Jérémie Galarneau [Thu, 2 Feb 2017 22:03:12 +0000 (17:03 -0500)] 
Add empty plug-in hooks to prevent their elimination by the linker

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoPort: Link live lib with ctf to satisfy cygwin linker
Michael Jeanson [Thu, 2 Feb 2017 22:03:11 +0000 (17:03 -0500)] 
Port: Link live lib with ctf to satisfy cygwin linker

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoPort: Link with no-undefined on Windows
Michael Jeanson [Thu, 2 Feb 2017 22:03:10 +0000 (17:03 -0500)] 
Port: Link with no-undefined on Windows

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 years agoPort: win32 DLLs don't support hidden symbols
Michael Jeanson [Thu, 2 Feb 2017 22:03:09 +0000 (17:03 -0500)] 
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>
4 years agoPort: replace strerror_r() with glib g_strerror()
Michael Jeanson [Thu, 2 Feb 2017 22:03:08 +0000 (17:03 -0500)] 
Port: replace strerror_r() with glib g_strerror()

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoUpdate version to v1.5.1 v1.5.1
Jérémie Galarneau [Fri, 6 Jan 2017 20:13:18 +0000 (15:13 -0500)] 
Update version to v1.5.1

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: perform an explicit stdout flush in live even on empty packets
Jérémie Galarneau [Tue, 13 Dec 2016 17:17:10 +0000 (12:17 -0500)] 
Fix: perform an explicit stdout flush in live even on empty packets

This ensures that babeltrace makes the content of live buffers
visible even if the data packets received are empty.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoUpdate version to v1.5.0 v1.5.0
Jérémie Galarneau [Tue, 29 Nov 2016 21:56:05 +0000 (16:56 -0500)] 
Update version to v1.5.0

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: remove BT_HIDDEN from bt_value_null singleton declaration
Jérémie Galarneau [Fri, 28 Oct 2016 20:06:37 +0000 (16:06 -0400)] 
Fix: remove BT_HIDDEN from bt_value_null singleton declaration

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix mixing of bt_ctf_scope and bt_ctf_ir_scope enums
Jérémie Galarneau [Fri, 28 Oct 2016 18:53:12 +0000 (14:53 -0400)] 
Fix mixing of bt_ctf_scope and bt_ctf_ir_scope enums

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoRevert ABI-breaking enum bt_ctf_string_encoding change
Jérémie Galarneau [Fri, 28 Oct 2016 18:46:49 +0000 (14:46 -0400)] 
Revert ABI-breaking enum bt_ctf_string_encoding change

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: warnings emitted because of enum ctf_string_encoding mixing
Jérémie Galarneau [Fri, 28 Oct 2016 16:33:18 +0000 (12:33 -0400)] 
Fix: warnings emitted because of enum ctf_string_encoding mixing

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoUpdate version to v1.5.0-rc1 v1.5.0-rc1
Jérémie Galarneau [Mon, 24 Oct 2016 17:39:11 +0000 (13:39 -0400)] 
Update version to v1.5.0-rc1

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoUpdate version to 1.5.0
Jérémie Galarneau [Sat, 22 Oct 2016 14:52:37 +0000 (10:52 -0400)] 
Update version to 1.5.0

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoPython build fix
Jérémie Galarneau [Mon, 24 Oct 2016 02:05:10 +0000 (22:05 -0400)] 
Python build fix

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix enum rename warnings
Jérémie Galarneau [Mon, 24 Oct 2016 01:54:39 +0000 (21:54 -0400)] 
Fix enum rename warnings

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide bt_ctf_writer_get_trace()
Jérémie Galarneau [Mon, 24 Oct 2016 01:34:13 +0000 (21:34 -0400)] 
Hide bt_ctf_writer_get_trace()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide bt_ctf_trace_* symbols
Jérémie Galarneau [Mon, 24 Oct 2016 01:33:51 +0000 (21:33 -0400)] 
Hide bt_ctf_trace_* symbols

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide get_field_paths_lca_index()
Jérémie Galarneau [Mon, 24 Oct 2016 01:33:32 +0000 (21:33 -0400)] 
Hide get_field_paths_lca_index()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoRemove bt_ctf_writer_add_environment_field_int64
Jérémie Galarneau [Mon, 24 Oct 2016 01:25:00 +0000 (21:25 -0400)] 
Remove bt_ctf_writer_add_environment_field_int64

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide new bt_ctf_stream_* symbols
Jérémie Galarneau [Mon, 24 Oct 2016 01:17:26 +0000 (21:17 -0400)] 
Hide new bt_ctf_stream_* symbols

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide new bt_ctf_stream_class_* symbols
Jérémie Galarneau [Mon, 24 Oct 2016 01:12:19 +0000 (21:12 -0400)] 
Hide new bt_ctf_stream_class_* symbols

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide new bt_ctf_field_type_* symbols
Jérémie Galarneau [Sun, 23 Oct 2016 23:47:52 +0000 (19:47 -0400)] 
Hide new bt_ctf_field_type_* symbols

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide new bt_ctf_packet_* symbols
Jérémie Galarneau [Sun, 23 Oct 2016 23:35:36 +0000 (19:35 -0400)] 
Hide new bt_ctf_packet_* symbols

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide new bt_ctf_field_* symbols
Jérémie Galarneau [Sun, 23 Oct 2016 22:42:53 +0000 (18:42 -0400)] 
Hide new bt_ctf_field_* symbols

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide new bt_ctf_field_path_* symbols
Jérémie Galarneau [Sun, 23 Oct 2016 22:34:57 +0000 (18:34 -0400)] 
Hide new bt_ctf_field_path_* symbols

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide new bt_ctf_event_* symbols
Jérémie Galarneau [Sun, 23 Oct 2016 20:04:25 +0000 (16:04 -0400)] 
Hide new bt_ctf_event_* symbols

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide bt_ctf_event_class_* symbols
Jérémie Galarneau [Sun, 23 Oct 2016 19:50:15 +0000 (15:50 -0400)] 
Hide bt_ctf_event_class_* symbols

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide new bt_ctf_clock_* symbols
Jérémie Galarneau [Sun, 23 Oct 2016 19:02:50 +0000 (15:02 -0400)] 
Hide new bt_ctf_clock_* symbols

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide bt_get and bt_put
Jérémie Galarneau [Sun, 23 Oct 2016 18:03:09 +0000 (14:03 -0400)] 
Hide bt_get and bt_put

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoHide bt_values and bt_attributes in libbabeltrace-ctf
Jérémie Galarneau [Sat, 22 Oct 2016 21:06:41 +0000 (17:06 -0400)] 
Hide bt_values and bt_attributes in libbabeltrace-ctf

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoBackport the CTF-IR interface
Jérémie Galarneau [Wed, 12 Oct 2016 10:43:48 +0000 (06:43 -0400)] 
Backport the CTF-IR interface

5 years agodebug info: Call register_event_debug_infos for all events
Simon Marchi [Sun, 19 Jun 2016 15:14:29 +0000 (11:14 -0400)] 
debug info: Call register_event_debug_infos for all events

The register_event_debug_infos function is responsible for setting the
debug_info_src field of the struct definition_integer representing the
"ip" context field.  This pointer is used later to print the
source and binary location of the tracepoint.

Currently, it's not called for the events that have a special meaning
for the debug info analysis (statedump start, dlopen, bin_info, etc).
This means that for these events, the debug_info_src pointer keeps the
value of the previous event from that stream (since the ip field is in
stream event context, there is one instance per stream), which leads to
wrong information and/or crash.  A crash can happen when the debug info
structures are cleared because a statedump start is encountered.
debug_info_src becomes a stale pointer and babeltrace tries to print a
string in free memory.

The fix is to call register_event_debug_infos for all events, which will
always set debug_info_src properly.  The events used to do the debug
info analysis are still regular events and have their own location
information.

The trace in bug #1018 shows a crash caused by this issue.

Here's an example of wrong info from the same trace:

... lttng_ust_statedump:bin_info: { cpu_id = 1 }, { vpid = 28991, ip = 0x7FD26665657D, debug_info = { bin = "libX11.so.6.3.0+0x213fa" } }, ...
... lttng_ust_statedump:build_id: { cpu_id = 1 }, { vpid = 28991, ip = 0x7FD266656656, debug_info = { bin = "libX11.so.6.3.0+0x213fa" } }, ...

We can see that the ip values are different, but the debug info refers
to the same location, which is impossible.  Here's the result with this
patch applied.

... lttng_ust_statedump:bin_info: { cpu_id = 1 }, { vpid = 28991, ip = 0x7FD26665657D, debug_info = { bin = "liblttng-ust.so.0.0.0+0x3557d", func = "trace_bin_info_cb+0xfa" } }, ...
... lttng_ust_statedump:build_id: { cpu_id = 1 }, { vpid = 28991, ip = 0x7FD266656656, debug_info = { bin = "liblttng-ust.so.0.0.0+0x35656", func = "trace_build_id_cb+0xbc" } }, ...

which seems more reasonnable.

Fixed #1018

Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTypo: configure.ac implemenation -> implementation
Jérémie Galarneau [Mon, 25 Jul 2016 19:16:18 +0000 (15:16 -0400)] 
Typo: configure.ac implemenation -> implementation

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoconfigure: fix uuid support detection on static build
Samuel Martin [Wed, 1 Jun 2016 19:56:32 +0000 (21:56 +0200)] 
configure: fix uuid support detection on static build

This change adds uuid detection using pkg-config helper before falling
back on the standard AC_CHECK_LIB detection for platforms missing
pkg-config.

AC_CHECK_LIB function achieves its test by trying to link against the
requested library, without taking care of its dependency
requirements/flags that may differ between different targets.
Therefore, in case of static build, it can fail on the uuid detection
like [1], because the uuid's dependency flags (regarding gettext) are
missing.

Instead, using pkg-config to do the check will take care of getting and
setting all required flags.

This issue [1] has been triggered on Buildroot farms.

[1] http://autobuild.buildroot.net/results/43b/43b98ddf9eb44152ed9ac4a98d887af14831d8da/build-end.log

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: no substitution needed for multi-trace intersection test
Jérémie Galarneau [Tue, 7 Jun 2016 16:09:27 +0000 (12:09 -0400)] 
Tests: no substitution needed for multi-trace intersection test

The use of AC_CONFIG_FILES on with src == dest causes the source
file to be deleted on make distclean.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoUpdate version to v1.4.0 v1.4.0
Jérémie Galarneau [Mon, 6 Jun 2016 18:26:09 +0000 (14:26 -0400)] 
Update version to v1.4.0

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: dereference of NULL pointer on allocation failure
Jérémie Galarneau [Fri, 3 Jun 2016 11:21:29 +0000 (07:21 -0400)] 
Tests: dereference of NULL pointer on allocation failure

Reported by Coverity as:
CID 1354904 (#1 of 1): Dereference null return value (NULL_RETURNS)

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: abort dwarf test on open() failure
Jérémie Galarneau [Fri, 3 Jun 2016 11:17:42 +0000 (07:17 -0400)] 
Tests: abort dwarf test on open() failure

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoFix: lttng-live does not set a trace descriptor
Jérémie Galarneau [Thu, 2 Jun 2016 17:40:25 +0000 (13:40 -0400)] 
Fix: lttng-live does not set a trace descriptor

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 years agoTests: Add missing --merge LOG_DRIVER_FLAGS
Jérémie Galarneau [Tue, 31 May 2016 11:31:55 +0000 (07:31 -0400)] 
Tests: Add missing --merge LOG_DRIVER_FLAGS

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