babeltrace.git
8 years agoFix: Accept an input port in the live URL when no session is provided
Jérémie Galarneau [Mon, 3 Mar 2014 16:27:29 +0000 (11:27 -0500)] 
Fix: Accept an input port in the live URL when no session is provided

Fixes a regression introduced @ 2a6d197b310 which causes Babeltrace
to not list sessions if the live URL contains a port and complain
that a port number is not provided after the ":" delimiter.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoVersion 1.2.0 v1.2.0
Mathieu Desnoyers [Fri, 28 Feb 2014 18:12:39 +0000 (13:12 -0500)] 
Version 1.2.0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: lttng-live parse url port check
Mathieu Desnoyers [Fri, 28 Feb 2014 13:08:29 +0000 (08:08 -0500)] 
Fix: lttng-live parse url port check

Ensure there is a port number after the ':' delimitor.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoVersion 1.2.0-rc2 v1.2.0-rc2
Mathieu Desnoyers [Thu, 27 Feb 2014 17:53:58 +0000 (12:53 -0500)] 
Version 1.2.0-rc2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: events discarded timing inaccuracy
Mathieu Desnoyers [Tue, 25 Feb 2014 22:36:11 +0000 (17:36 -0500)] 
Fix: events discarded timing inaccuracy

Introduce babeltrace_ctf_console_output too, to ensure we only print
discarded events when a text output is used.

Fixes #589

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Move offset endianness conversion to get_data_packet
Jérémie Galarneau [Tue, 25 Feb 2014 20:47:39 +0000 (15:47 -0500)] 
Fix: Move offset endianness conversion to get_data_packet

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Remove negative comparison to unsigned value
Jérémie Galarneau [Tue, 25 Feb 2014 20:40:42 +0000 (15:40 -0500)] 
Fix: Remove negative comparison to unsigned value

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Uninitialized scalar variable
Jérémie Galarneau [Tue, 25 Feb 2014 20:13:18 +0000 (15:13 -0500)] 
Fix: Uninitialized scalar variable

Defect Reported-by: Coverity Scan

** CID 1187497:  Uninitialized scalar variable  (UNINIT)
/formats/lttng-live/lttng-live-comm.c: 753 in get_data_packet()

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: Don't assert on metadata generation failure
Jérémie Galarneau [Mon, 24 Feb 2014 15:30:50 +0000 (10:30 -0500)] 
Fix: Don't assert on metadata generation failure

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: add missing SIGTERM and SIGINT handler
Mathieu Desnoyers [Tue, 25 Feb 2014 16:26:14 +0000 (11:26 -0500)] 
Fix: add missing SIGTERM and SIGINT handler

Handle expected signals gracefully: stop processing at cancellation
points expected by the protocol, so the relay daemon does not print
error messages when clients quit gracefully.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Reverse incorrect error message argument order
Mathieu Desnoyers [Tue, 25 Feb 2014 16:08:54 +0000 (11:08 -0500)] 
Fix: Reverse incorrect error message argument order

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: add brackets to lttng-live-plugin.c
Mathieu Desnoyers [Tue, 25 Feb 2014 16:25:25 +0000 (11:25 -0500)] 
Cleanup: add brackets to lttng-live-plugin.c

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup lttng-live: add brackets in lttng_live_read()
Mathieu Desnoyers [Tue, 25 Feb 2014 15:53:47 +0000 (10:53 -0500)] 
Cleanup lttng-live: add brackets in lttng_live_read()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup lttng-live: 80 columns wrapping
Mathieu Desnoyers [Tue, 25 Feb 2014 15:51:43 +0000 (10:51 -0500)] 
Cleanup lttng-live: 80 columns wrapping

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: handle new streams in get_data_packet()
Mathieu Desnoyers [Tue, 25 Feb 2014 15:48:13 +0000 (10:48 -0500)] 
Fix: handle new streams in get_data_packet()

- don't skip ask_new_streams() if new metadata _and_
  new streams are available.
- goto retry after getting new streams.
- Add missing "ret = 0" assignment at the end of the function. Takes
  care of "possible use of uninitialized variables" warnings in the
  caller given by gcc.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: accept empty metadata on append
Mathieu Desnoyers [Mon, 24 Feb 2014 18:23:54 +0000 (13:23 -0500)] 
Fix: accept empty metadata on append

"Append" should accept receiving metadata packets that contain exactly 0
byte of metadata payload. This kind of flush can happen on trace
teardown.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: lttng-live: 100ms active poll delay
Mathieu Desnoyers [Mon, 24 Feb 2014 17:54:03 +0000 (12:54 -0500)] 
Fix: lttng-live: 100ms active poll delay

Do a 100ms delay before retry intead of 1s delays (slightly too long in
terms of user experience) and instead of actively hogging the CPU (too
fast).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: lttng-live await metadata
Mathieu Desnoyers [Mon, 24 Feb 2014 17:24:54 +0000 (12:24 -0500)] 
Fix: lttng-live await metadata

Expect at least _some_ metadata in get_new_metadata. Retry until we
receive some metadata.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: lttng-live recv() and send() flags, partial recv()
Mathieu Desnoyers [Mon, 24 Feb 2014 16:49:03 +0000 (11:49 -0500)] 
Fix: lttng-live recv() and send() flags, partial recv()

Introduce lttng_live_recv() and lttng_live_send():

- Enforce MSG_NOSIGNAL flag for send(),
- Continue recv() after partial message is received.
- Handle EINTR within those wrappers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: missing little endian conversion for one index field
Julien Desfossez [Mon, 24 Feb 2014 18:34:01 +0000 (13:34 -0500)] 
Fix: missing little endian conversion for one index field

Locked-step with lttng-tools commit :
Fix: missing big endian conversion for one index field

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: remove logically dead code
Mathieu Desnoyers [Fri, 21 Feb 2014 15:17:22 +0000 (10:17 -0500)] 
Cleanup: remove logically dead code

CID 1021557 (#1 of 1): Logically dead code (DEADCODE)
dead_error_line:
Execution cannot reach this statement "goto end;".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: untrusted value as argument
Mathieu Desnoyers [Fri, 21 Feb 2014 13:58:02 +0000 (08:58 -0500)] 
Fix: untrusted value as argument

Fix coverity:

CID 1132646 (#1 of 1): Untrusted value as argument (TAINTED_SCALAR)8.
tainted_data: Passing tainted variable "index_hdr.packet_index_len" to a
tainted sink.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: off by one in lttng-live path length check
Mathieu Desnoyers [Fri, 21 Feb 2014 02:49:31 +0000 (21:49 -0500)] 
Fix: off by one in lttng-live path length check

Does not account for final \0.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: fclose return value unchecked
Mathieu Desnoyers [Thu, 20 Feb 2014 22:01:55 +0000 (17:01 -0500)] 
Fix: fclose return value unchecked

** CID 1181988:  Unchecked return value  (CHECKED_RETURN)
/formats/lttng-live/lttng-live-comm.c: 900 in get_new_metadata()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: call to append metadata when new metadata is added
Julien Desfossez [Thu, 20 Feb 2014 05:50:27 +0000 (00:50 -0500)] 
Fix: call to append metadata when new metadata is added

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: use memstream instead of tmp file for live metadata
Julien Desfossez [Thu, 20 Feb 2014 05:50:26 +0000 (00:50 -0500)] 
Fix: use memstream instead of tmp file for live metadata

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: assign a trace handle to every live trace
Julien Desfossez [Thu, 20 Feb 2014 05:50:25 +0000 (00:50 -0500)] 
Fix: assign a trace handle to every live trace

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: get_new_metadata receive all the metadata
Julien Desfossez [Thu, 20 Feb 2014 05:50:24 +0000 (00:50 -0500)] 
Fix: get_new_metadata receive all the metadata

Instead of doing the loop in the caller, let get_new_metadata fetch all
the metadata required. Also, call this function when get_packet detects
that we need to refresh the metadata.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Coverity warning CWE-457: Use of Uninitialized Variable
Jérémie Galarneau [Thu, 20 Feb 2014 06:12:01 +0000 (01:12 -0500)] 
Fix: Coverity warning CWE-457: Use of Uninitialized Variable

ret is uninitialized if no streams are declared in the trace
descriptor.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRevert "Fix: get_new_metadata receive all the metadata"
Mathieu Desnoyers [Thu, 20 Feb 2014 03:20:43 +0000 (22:20 -0500)] 
Revert "Fix: get_new_metadata receive all the metadata"

This reverts commit bb17fa55a7694db83af6f00b16b3e545712662f7.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoRevert "Fix: assign a trace handle to every live trace"
Mathieu Desnoyers [Thu, 20 Feb 2014 03:20:18 +0000 (22:20 -0500)] 
Revert "Fix: assign a trace handle to every live trace"

This reverts commit 42423b0a691fb4b2efbb5a45eb7eefa5f350ec30.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: assign a trace handle to every live trace
Julien Desfossez [Wed, 19 Feb 2014 23:23:53 +0000 (18:23 -0500)] 
Fix: assign a trace handle to every live trace

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: get_new_metadata receive all the metadata
Julien Desfossez [Wed, 19 Feb 2014 23:23:52 +0000 (18:23 -0500)] 
Fix: get_new_metadata receive all the metadata

Instead of doing the loop in the caller, let get_new_metadata fetch all
the metadata required. Also, call this function when get_packet detects
that we need to refresh the metadata.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCTF: Support incremental metadata append
Mathieu Desnoyers [Wed, 19 Feb 2014 00:19:26 +0000 (19:19 -0500)] 
CTF: Support incremental metadata append

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: ctf.c fscanf missing integer length check
Mathieu Desnoyers [Wed, 19 Feb 2014 01:40:40 +0000 (20:40 -0500)] 
Fix: ctf.c fscanf missing integer length check

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoBump soname version to 1.0.0
Mathieu Desnoyers [Wed, 19 Feb 2014 01:25:02 +0000 (20:25 -0500)] 
Bump soname version to 1.0.0

Since there were ABI changes since 0.0.0.

Also add missing -Wl,--no-as-needed to lttng-live plugin.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoMove scanner allocation/free outside of ctf_open_trace_metadata_read
Mathieu Desnoyers [Tue, 18 Feb 2014 23:01:55 +0000 (18:01 -0500)] 
Move scanner allocation/free outside of ctf_open_trace_metadata_read

In preparation for incremental metadata parsing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCTF parser: prepare for incremental metadata parsing
Mathieu Desnoyers [Tue, 18 Feb 2014 22:44:37 +0000 (17:44 -0500)] 
CTF parser: prepare for incremental metadata parsing

Associate the file pointer to ctf_scanner_append_ast() rather than to
ctf_scanner_alloc().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPython bindings: return char arrays as strings in value()
Jérémie Galarneau [Tue, 18 Feb 2014 07:04:22 +0000 (02:04 -0500)] 
Python bindings: return char arrays as strings in value()

Implement the same logic as in ctf-text to return a string when
value() is called on an array of elements that are encoded as ASCII
or UTF8 and 8-bits long.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoPython bindings: sched_switch example clean-up
Jérémie Galarneau [Tue, 18 Feb 2014 07:03:01 +0000 (02:03 -0500)] 
Python bindings: sched_switch example clean-up

Remove unecessary while loop to handle event skipping.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: add missing test scripts to Makefile.am
Mathieu Desnoyers [Mon, 17 Feb 2014 14:35:33 +0000 (09:35 -0500)] 
Fix: add missing test scripts to Makefile.am

Fix make check ran from tarball.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoVersion 1.2.0-rc1 v1.2.0-rc1
Mathieu Desnoyers [Fri, 14 Feb 2014 21:39:12 +0000 (16:39 -0500)] 
Version 1.2.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: lttng-live: use perror() rather than fprintf for err msg
Mathieu Desnoyers [Fri, 14 Feb 2014 20:29:12 +0000 (15:29 -0500)] 
Cleanup: lttng-live: use perror() rather than fprintf for err msg

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: lttng-live: handle orderly shutdown
Mathieu Desnoyers [Fri, 14 Feb 2014 20:19:37 +0000 (15:19 -0500)] 
Fix: lttng-live: handle orderly shutdown

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Unchecked array index when importing trace indexes
Jérémie Galarneau [Thu, 13 Feb 2014 19:42:36 +0000 (14:42 -0500)] 
Fix: Unchecked array index when importing trace indexes

import_stream_packet_index may access the streams array with an invalid
stream_id index when a stream has an index but is not declared in the
trace's metadata.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoLTTng-live usage documentation
Julien Desfossez [Mon, 10 Feb 2014 23:50:40 +0000 (18:50 -0500)] 
LTTng-live usage documentation

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: ctf: uninitialized packet_index, misuse of index
Mathieu Desnoyers [Mon, 10 Feb 2014 21:23:24 +0000 (16:23 -0500)] 
Fix: ctf: uninitialized packet_index, misuse of index

Issues introduced by
commit f1f52630ef26bb227cf1e8fedcff9b938d7a2f1e

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: rename lttng live implementation files
Mathieu Desnoyers [Mon, 10 Feb 2014 21:06:19 +0000 (16:06 -0500)] 
Cleanup: rename lttng live implementation files

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAttach and list by session name and hostname
Julien Desfossez [Wed, 5 Feb 2014 23:34:28 +0000 (18:34 -0500)] 
Attach and list by session name and hostname

From now on, the user attaches to a session by hostname and session name
(no ID anymore). With this new features, we automatically merge the
sessions with the same hostname and session name.

The new URL format to attach to a session is :
net://<relay-hostname>/host/<traced-hostname>/<session-name>

All the fields are mandatory.
No changes for the listing :
net://<relay-hostname>

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoget_new_streams and multi-session
Julien Desfossez [Wed, 5 Feb 2014 23:34:27 +0000 (18:34 -0500)] 
get_new_streams and multi-session

We now support the get_new_stream lttng live command. This command
allows us to retrieve new streams added while tracing.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCreate the live viewer session before attaching
Julien Desfossez [Wed, 5 Feb 2014 23:34:26 +0000 (18:34 -0500)] 
Create the live viewer session before attaching

The lttng-live protocol now requires that we create a viewer session
before attaching to a trace.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoSync lttng live ABI with lttng-tools
Julien Desfossez [Thu, 6 Feb 2014 16:13:12 +0000 (11:13 -0500)] 
Sync lttng live ABI with lttng-tools

Rename lttng-viewer.h to lttng-viewer-abi.h
Add the structures for two new commands.
Also, add the missing headers to the Makefile.am.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoExtract adding a trace to the iterator from bt_iter_init
Julien Desfossez [Wed, 5 Feb 2014 23:34:24 +0000 (18:34 -0500)] 
Extract adding a trace to the iterator from bt_iter_init

With live tracing, we have cases where we need to add traces to an
iterator currently in use. Here, we just extract the code from
bt_iter_init that adds the trace to the iterator so we can call it from
elsewhere.
We don't necessarily want to expose this interface to the public, so it
stays in the internal headers for now.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCompute discarded events in live
Mathieu Desnoyers [Wed, 29 Jan 2014 03:15:48 +0000 (22:15 -0500)] 
Compute discarded events in live

We now save the indexes received in live in the two first elements of a
packet index. This allows us to compute the number of discarded events.

We only keep the packet index elements we need in live so we don't leak
packet indexes when reading a live trace over many days (or longer).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoMerge real index and cycles index into a single index
Mathieu Desnoyers [Wed, 29 Jan 2014 02:14:48 +0000 (21:14 -0500)] 
Merge real index and cycles index into a single index

Merge those two into a single index array, rather than having partially
duplicated data.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: import index containing only a header
Julien Desfossez [Fri, 7 Feb 2014 16:12:58 +0000 (11:12 -0500)] 
Fix: import index containing only a header

If the index file is present, we have to make sure we imported at least
one index before using the stream_class.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRemove outdated Python bindings test
Jérémie Galarneau [Tue, 4 Feb 2014 17:53:34 +0000 (12:53 -0500)] 
Remove outdated Python bindings test

This test is based on the old version of the Python bindings which
was part of the experimental branch.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: replace assert with proper error handling
Julien Desfossez [Fri, 17 Jan 2014 18:11:39 +0000 (13:11 -0500)] 
Fix: replace assert with proper error handling

If we receive the wrong packet, we should send the error and exit
cleanly instead of asserting.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoFix: lttng-live: unbounded use of sscanf() in parse_url()
Mathieu Desnoyers [Thu, 16 Jan 2014 19:52:24 +0000 (14:52 -0500)] 
Fix: lttng-live: unbounded use of sscanf() in parse_url()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: lttng-live should accept 0 in addresses
Julien Desfossez [Tue, 7 Jan 2014 19:16:03 +0000 (14:16 -0500)] 
Fix: lttng-live should accept 0 in addresses

Fixes #708

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoRemove default to display field names in live
Julien Desfossez [Tue, 7 Jan 2014 18:04:38 +0000 (13:04 -0500)] 
Remove default to display field names in live

Let Babeltrace option parsing code to set this option instead of
overriding it.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 years agoRemove null checks on g_new0
Mathieu Desnoyers [Sat, 14 Dec 2013 15:38:31 +0000 (10:38 -0500)] 
Remove null checks on g_new0

g_new0 never returns NULL. We need to either always check for NULL, or
never. Remove all NULL checks on pointers returned by g_new0. Coverity
was complaining because we were dereferencing a pointer in an error path
after checking it against NULL, which is certainly never OK.

Found by coverity:

** CID 1136988:  Dereference after null check  (FORWARD_NULL)
/formats/lttng-live/lttng-live.c: 152 in lttng_live_open_trace_read()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: iterator unused pointer value
Mathieu Desnoyers [Sat, 14 Dec 2013 15:55:04 +0000 (10:55 -0500)] 
Cleanup: iterator unused pointer value

Found by Coverity:

** CID 1136757:  Unused pointer value  (UNUSED_VALUE)
/lib/iterator.c: 831 in bt_iter_next()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: lttng-live: resource leak
Mathieu Desnoyers [Sat, 14 Dec 2013 15:51:37 +0000 (10:51 -0500)] 
Fix: lttng-live: resource leak

Found by Coverity:

** CID 1136987:  Resource leak  (RESOURCE_LEAK)
/formats/lttng-live/lttng-live-functions.c: 372 in lttng_live_attach_session()
/formats/lttng-live/lttng-live-functions.c: 386 in lttng_live_attach_session()
/formats/lttng-live/lttng-live-functions.c: 383 in lttng_live_attach_session()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: lttng-live uninitialized scalar variable
Mathieu Desnoyers [Sat, 14 Dec 2013 15:47:00 +0000 (10:47 -0500)] 
Fix: lttng-live uninitialized scalar variable

Found by coverity:

** CID 1136985:  Uninitialized scalar variable  (UNINIT)
/formats/lttng-live/lttng-live-functions.c: 128 in lttng_live_establish_connection()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: lttng-live non NULL-terminated strings
Mathieu Desnoyers [Sat, 14 Dec 2013 15:44:17 +0000 (10:44 -0500)] 
Fix: lttng-live non NULL-terminated strings

Found by coverity.

** CID 1136986:  String not null terminated  (STRING_NULL)
/formats/lttng-live/lttng-live-functions.c: 375 in lttng_live_attach_session()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agolttng-live: fix unchecked mkdir return value
Mathieu Desnoyers [Sat, 14 Dec 2013 15:36:13 +0000 (10:36 -0500)] 
lttng-live: fix unchecked mkdir return value

Found by coverity:
** CID 1136989:  Unchecked return value from library  (CHECKED_RETURN)
/formats/lttng-live/lttng-live-functions.c: 374 in lttng_live_attach_session()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agolttng-live input plugin
Julien Desfossez [Thu, 12 Dec 2013 20:32:35 +0000 (15:32 -0500)] 
lttng-live input plugin

This new input format allows Babeltrace to connect a lttng-relayd and
attach to a running live session.

In order to use it, you need to create a live session (refer to LTTng
documentation for that) and then :
babeltrace -i lttng-live net://hostname

Where hostname is the hostname or IP address of the lttng-relayd
receiving the live trace.

When you do this command, it will list the active sessions on the relay.
To attach to a particular session, redo the same command, but add after
the hostname the session ID of the session you want to read.
For example, to attach to the session 42 :
babeltrace -i lttng-live net://hostname/42

If you want to know what is going on in the background, you can add the
-v for a verbose output.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoLive: let read API detect inactive streams, allow streams without fd
Julien Desfossez [Thu, 12 Dec 2013 20:32:34 +0000 (15:32 -0500)] 
Live: let read API detect inactive streams, allow streams without fd

In live streaming, there are cases where a stream will be inactive from
beginning to end and so will never call bt_iter_next. For those cases,
we have to detect when we are reading an inactive stream which happens
when all other active streams have been closed.

We don't want to have the same checks in two places, so this fix removes
the return of EAGAIN in bt_iter_next and instead returns a NULL event
with the new BT_ITER_FLAG_RETRY flag set.

Also, handle cases where streams and traces have no associated file
descriptors.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoAdd Jérémie Galarneau as co-maintainer
Mathieu Desnoyers [Wed, 11 Dec 2013 20:22:36 +0000 (15:22 -0500)] 
Add Jérémie Galarneau as co-maintainer

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: disallow re-using same event ID in same stream
Mathieu Desnoyers [Tue, 10 Dec 2013 21:45:08 +0000 (16:45 -0500)] 
Fix: disallow re-using same event ID in same stream

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: check for unknown enum/variant fields
Mathieu Desnoyers [Mon, 9 Dec 2013 12:31:11 +0000 (07:31 -0500)] 
Fix: check for unknown enum/variant fields

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: libbabeltrace lib build dependencies
Mathieu Desnoyers [Mon, 9 Dec 2013 12:28:51 +0000 (07:28 -0500)] 
Fix: libbabeltrace lib build dependencies

The "no-as-needed" is only needed for plugins, not for libraries we
depend upon, so it is not really needed here. Using LIBADD instead
ensures that libbabeltrace gets rebuilt whenever the content of
libbabeltrace_types (statically linked) is modified.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFixes in babeltrace core to support non-CTF traces
Julien Desfossez [Tue, 3 Dec 2013 22:34:57 +0000 (17:34 -0500)] 
Fixes in babeltrace core to support non-CTF traces

Since we will have an effort soon to cleanup the Babeltrace plugin
mechanism, this patch adds just the bits required in Babeltrace to not
crash if a non-ctf is opened. We also add the support of net:// URIs.
That way, an input plugin can just implement the open_trace callback
and process its own input trace without requiring a CTF iterator.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoAdd a private pointer to the ctf_stream_pos
Julien Desfossez [Tue, 3 Dec 2013 22:34:56 +0000 (17:34 -0500)] 
Add a private pointer to the ctf_stream_pos

This allows a custom packet_seek function to fetch private information
about the current stream.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoBe more widely accepting for missing variant/enum fields
Mathieu Desnoyers [Wed, 4 Dec 2013 16:09:16 +0000 (17:09 +0100)] 
Be more widely accepting for missing variant/enum fields

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: remove index_read (unused var)
Mathieu Desnoyers [Tue, 3 Dec 2013 16:41:16 +0000 (17:41 +0100)] 
Cleanup: remove index_read (unused var)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoRefuse 0 integer size
Mathieu Desnoyers [Tue, 3 Dec 2013 16:13:12 +0000 (17:13 +0100)] 
Refuse 0 integer size

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix ctf-writer: possible use after free
Jérémie Galarneau [Fri, 29 Nov 2013 18:26:42 +0000 (13:26 -0500)] 
Fix ctf-writer: possible use after free

ctf_stream_pos' base_mma member must be copied from stream->pos before
updating the final packet and content sizes. The original base_mma
structure will be reallocated if the packet is resized.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix data_offset when importing the indexes
Julien Desfossez [Fri, 29 Nov 2013 22:43:39 +0000 (17:43 -0500)] 
Fix data_offset when importing the indexes

When importing an index, we don't have the data_offset and we want to
mmap the tracefile only when needed, so we introduce a new function to
only compute this information when we are going to use a new packet.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoMerge branch 'master' into bindings/python
Mathieu Desnoyers [Fri, 29 Nov 2013 06:19:33 +0000 (07:19 +0100)] 
Merge branch 'master' into bindings/python

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoPython-bindings fix: Out of tree build fails to find babeltrace.i
Jérémie Galarneau [Thu, 28 Nov 2013 18:19:10 +0000 (13:19 -0500)] 
Python-bindings fix: Out of tree build fails to find babeltrace.i

This fixes the out of tree builds by using the appropriate top_srcdir
and top_builddir variables in the bindings' Makefile.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoTest: Validate that enumeration mapping strings are properly escaped
Jérémie Galarneau [Thu, 28 Nov 2013 20:46:41 +0000 (15:46 -0500)] 
Test: Validate that enumeration mapping strings are properly escaped

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix ctf-writer: Quote strings provided as enumeration mappings
Jérémie Galarneau [Thu, 28 Nov 2013 20:46:40 +0000 (15:46 -0500)] 
Fix ctf-writer: Quote strings provided as enumeration mappings

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: read/write mode check
Mathieu Desnoyers [Thu, 28 Nov 2013 00:00:49 +0000 (19:00 -0500)] 
Fix: read/write mode check

It's on the "prot" field, not flags. Moreover, it needs to be done with
a == / != comparison, not a mask.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: do not duplicate code in float fix
Mathieu Desnoyers [Wed, 27 Nov 2013 19:38:53 +0000 (14:38 -0500)] 
Cleanup: do not duplicate code in float fix

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: floats should set content size in tmp definition
Mathieu Desnoyers [Wed, 27 Nov 2013 19:37:52 +0000 (14:37 -0500)] 
Fix: floats should set content size in tmp definition

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoHandle empty streams on iterator init
Julien Desfossez [Wed, 27 Nov 2013 16:40:12 +0000 (11:40 -0500)] 
Handle empty streams on iterator init

In live trace streaming, we can create an iterator with inactive
streams. This patch allows inactive streams to be considered as valid.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoHandle packets containing only a header
Julien Desfossez [Wed, 27 Nov 2013 16:40:11 +0000 (11:40 -0500)] 
Handle packets containing only a header

In live streaming with LTTng, if we do a stop and then a destroy, we
receive a packet that contains only a header. With this patch, we will
ask for a new packet when we see this case.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoHandle the inactive streams
Julien Desfossez [Wed, 27 Nov 2013 16:40:10 +0000 (11:40 -0500)] 
Handle the inactive streams

When content_size == 0, just set the timestamp_end of the packet and
reinsert the stream in the heap.
This is required to handle the beacons of inactivity generated in
LTTng live trace streaming.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: test content size vs headers len
Mathieu Desnoyers [Wed, 27 Nov 2013 09:50:54 +0000 (04:50 -0500)] 
Fix: test content size vs headers len

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: check packet index len
Mathieu Desnoyers [Wed, 27 Nov 2013 09:26:53 +0000 (04:26 -0500)] 
Fix: check packet index len

Found by coverity:

** CID 1132646:  Untrusted value as argument  (TAINTED_SCALAR)
/formats/ctf/ctf.c: 1715 in import_stream_packet_inde)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: uncheck null pointer
Mathieu Desnoyers [Wed, 27 Nov 2013 09:22:54 +0000 (04:22 -0500)] 
Fix: uncheck null pointer

Found by coverity:

** CID 1132647:  Dereference null return value  (NULL_RETURNS)
/formats/ctf/ctf.c: 1852 in ctf_open_file_stream_read()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: test for less than 1 byte packets
Mathieu Desnoyers [Wed, 27 Nov 2013 09:07:08 +0000 (04:07 -0500)] 
Fix: test for less than 1 byte packets

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: reversed logic in packet vs content size
Mathieu Desnoyers [Wed, 27 Nov 2013 08:38:23 +0000 (03:38 -0500)] 
Fix: reversed logic in packet vs content size

As described in CTF section 5.2

"If the packet size field is missing, the whole stream only contains a
single packet. If the content size field is missing, the packet is
filled (no padding). The content and packet sizes include all headers."

Here is the correct semantic:

* Content size and packet size are available:

  Packet is filled with data up to content size, and then with padding
  up to packet size.

* Content size available, no packet size field:

  The stream has a single packet. It is filled up to content size, and
  the rest is padding.

* Packet size available, no content size field:

  Packet filled completely, no padding.

Fixes #683

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: clarify end of packet error
Mathieu Desnoyers [Wed, 27 Nov 2013 08:32:06 +0000 (03:32 -0500)] 
Fix: clarify end of packet error

Fixes #686

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: string packet boundary handling, bits vs bytes
Mathieu Desnoyers [Wed, 27 Nov 2013 08:28:45 +0000 (03:28 -0500)] 
Fix: string packet boundary handling, bits vs bytes

Fixes #684

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: add stricter checks on packet boundaries
Mathieu Desnoyers [Wed, 27 Nov 2013 08:19:31 +0000 (03:19 -0500)] 
Fix: add stricter checks on packet boundaries

Fixes #699

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoParse CTF indexes
Julien Desfossez [Tue, 26 Nov 2013 17:08:06 +0000 (12:08 -0500)] 
Parse CTF indexes

If a trace file has an associated index (same filename and .idx suffix
in the "index" folder), we open it and use it instead of generating
the index at open.
The index folder is not mandatory and can be destroyed without any
problem.

To use with LTTng, make sure you have lttng-tools commit :
50adc26400482c07210afcda8ef1d3322f75871d
Mon Nov 25 15:32:38 2013 -0500
Rename LTTng index in CTF index

Versions between commit 309167d2a6f59d0c8cbf64eb23ba912cdea76a34 and
this commit have a different index format that will never be merged in
Babeltrace, so if you have traces recorded between this period of
time, just remove the index directory.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: fix typo
Mathieu Desnoyers [Tue, 26 Nov 2013 18:11:21 +0000 (13:11 -0500)] 
Cleanup: fix typo

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.041014 seconds and 4 git commands to generate.