Philippe Proulx [Fri, 31 May 2019 11:07:04 +0000 (07:07 -0400)]
bindings/python/bt2/setup.py.in: put native module in `bt2` package
In SWIG 3, the native module (`_native_bt.*.so`, which they call the
"C/C++ module") can be found in two locations by the Python module
(`native_bt.py`). From
http://www.swig.org/Doc3.0/SWIGDocumentation.html#Python_package_search:
> The pure Python module needs to load the C/C++ module in order to link
> to the wrapped C/C++ methods. To do this it must make some assumptions
> about what package the C/C++ module may be located in. The approach
> the pure Python module uses to find the C/C++ module is as follows:
>
> 1. The pure Python module, foo.py, tries to load the C/C++ module,
> _foo, from the same package foo.py is located in. The package name
> is determined from the __name__ attribute given to foo.py by the
> Python loader that imported foo.py. If foo.py is not in a package
> then _foo is loaded as a global module.
>
> 2. If the above import of _foo results in an ImportError being thrown,
> then foo.py makes a final attempt to load _foo as a global module.
In other words, `native_bt.py` tries:
from . import _native_bt
If this fails:
import _native_bt
Currently, we're using the second location (global module).
In SWIG 4.0.0, released 27 april 2019, things changed. From
http://www.swig.org/Doc4.0/SWIGDocumentation.html#Python_package_search:
> The pure Python module needs to load the C/C++ module in order to call
> the wrapped C/C++ methods. To do this it must make some assumptions
> about the location of the C/C++ module. There are two configurations
> that are supported by default.
>
> 1. Both modules in the same package
>
> 2. Both modules are global
and:
> Compatibility Note: Versions of SWIG prior to SWIG-4.0.0 supported
> split modules without the above customization. However, this had to be
> removed as the default import code often led to confusion due to
> obfuscation of genuine Python ImportError problems. Using one of the
> two default configurations is the recommended approach now.
In other words, `native_bt.py` does not try
import _native_bt
because `native_bt.py` is part of a package; it only tries:
from . import _native_bt
The result is that, when the bindings are generated by SWIG 4,
`native_bt.py` cannot find `_native_bt`, which makes the bindings not
work at all.
The common method for SWIG 3 and 4 is importing from the same package.
For this to work, `setup.py` needs to install the built extension into
the `bt2` package. This patch changes `bindings/python/bt2/setup.py.in`
to do so.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Icf3622953280466e8d458caee79a28ed4a01fa2b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1356
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins
Michael Jeanson [Mon, 27 May 2019 19:21:42 +0000 (15:21 -0400)]
flt.lttng-utils.debug-info: Replace hardcoded '/' in paths
Replace hardcoded '/' directory separators with glib functions that will
automatically select the proper separator per platform.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I53195657f6514930998979612c6b04de5e3c1dd8
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1336
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Mathieu Desnoyers [Wed, 29 May 2019 19:06:59 +0000 (15:06 -0400)]
Fix: test_bitfield: extend coverage by removing off-by-one in bound check
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4fbf927d4b2ff1c8b68b05c7843298c64b68f5a4
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1342
Tested-by: jenkins
Mathieu Desnoyers [Wed, 29 May 2019 19:36:25 +0000 (15:36 -0400)]
Fix: test_bitfield: extend coverage: 0-len signed write/read
By convention, a 0-len bitfield write is a no-op, and a 0-len read
sets the value of the output to 0.
So we can "encode" the value 0 over a length of 0 bit. Cover this
in the test-cases for signed types. It is already covered for the
unsigned test-cases.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib6038b98167ef2cfa8c504d7ac29498e71827b38
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1341
Tested-by: jenkins
Francis Deslauriers [Tue, 28 May 2019 21:40:53 +0000 (17:40 -0400)]
Fix: flt.lttng-utils.debug-info: build id comparison
Issue
=====
Commit
af54bd1801 fixed a endianness bug by coincidence.
The real bug is the following line:
name_sz = (uint32_t) *buf;
The `buf` variable is a `uint8_t *` that points at a 32bits word storing
the name size field.
On that line we dereference `buf` and cast the result to a uint32_t.
Dereferencing `buf` gives a `uint8_t` containing the first byte of the
32bits word which is then cast to 32bits and stored in `name_sz`.
However, the intent was to read the full 32bits word in `name_sz`.
It was working properly on little-endian architectures because the first
byte of the 32bit word was probably always enough to contain the size of
the name so casting the `uint8_t` to a `uint32_t` did not lead to
truncating.
But on big-endian architectures, that same first byte of 32bits word
containing the name size is probably always zero which lead to a failure
to recognize the note as a build id note.
Wrong Solution
==============
Commit
af54bd1801 assumed that the `elf_getdata()` returned the note
section in the file byte order and used `gelf_xlatetom()` to swap the by
to the machine byte order. This assumption is false, the `elf_getdata()`
man page says:
The returned data descriptor will be setup to contain translated
data[...]
So no need to translate from the file byte order to the machine byte
order after the extracting the data using `elf_getdata()`.
The mis-guided use of `gelf_xlatetom()` made the testcase pass on
PowerPC because it swapped the bytes of the 32bits word making the cast
described above work. But running that same test on a PowerPC on a
PowerPC binary would not swap the byte order (as machine and file byte
order are the same) and would trigger the casting bug described above.
Right Solution
==============
The right solution is to cast the `buf` pointer to a `uint32_t *` before
dereferencing it. Such as:
name_sz = (uint32_t) *(uint32_t *)buf;
But, during this investigation, we discovered that the libelf library
offers the `gelf_getnote()` function that does all the work to extract
the note fields. Using this function makes it clearer and safer.
This commit uses this approach as well as reverting all the changes
added by commit
af54bd1801.
Drawbacks
=========
None.
Reported-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I952aad69d225c202b3aa9c41724b6645550a2d68
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1340
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Wed, 15 May 2019 19:43:44 +0000 (15:43 -0400)]
Fix: src.ctf.lttng-live: possible memory leak on error path
Free `struct lttng_live_component` if the graph is found to be already
canceled and return the appropriate _END status.
Reported-by: scan-build - Potential leak of memory.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I975e458ed4ce5dc3e50c9bf330a2f6953e5be535
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1308
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Sat, 25 May 2019 21:28:08 +0000 (17:28 -0400)]
Fix: lib-logging: possible buffer not null terminated
Issue
=====
While fixing Coverity warnings, commit
879e14e8 introduced other
warnings. Indeed, the destination string after the `strncpy()` call
would be left not null terminated if the size of the source buffer is
equal or larger than the `TMP_PREFIX_LEN`. Also, the `strncat()` does
not consider the characters added by the previous `strncpy()` call when
supplying the size of the destination buffer. This could result in
buffer overflows.
Solution
========
Use `snprintf()` to concatenate the two strings and set the last
character to `\0`. It's worth it to make the code easier to understand
even though the `snprintf()` is probably more work because of the format
string.
Drawbacks
=========
None.
Notes
=====
List of coverity defect reports:
CID
1401510 (#5 of 5): Buffer not null terminated
(BUFFER_SIZE_WARNING) 19. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401511 (#2 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING) 4. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401513 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING) 19. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401517 (#5 of 5): Buffer not null terminated
(BUFFER_SIZE_WARNING) 9. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
ID
1401519 (#4 of 4): Buffer not null terminated
(BUFFER_SIZE_WARNING) 15. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401523 (#3 of 3): Buffer not null terminated
(BUFFER_SIZE_WARNING) 16. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401525 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING) 10. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401526 (#2 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING) 11. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401528 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING) 15. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401532 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING) 5. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401533 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING) 6. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401534 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING) 12. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401535 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING) 13. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401537 (#2 of 2): Buffer not null terminated
(BUFFER_SIZE_WARNING) 23. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401539 (#10 of 10): Buffer not null terminated
(BUFFER_SIZE_WARNING) 10. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401540 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING) 28. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
CID
1401541 (#1 of 1): Buffer not null terminated
(BUFFER_SIZE_WARNING) 9. buffer_size_warning: Calling strncpy
with a maximum size argument of 64 bytes on destination array
tmp_prefix of size 64 bytes might leave the destination string
unterminated.
Reported-by: Coverity - Buffer not null terminated
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ie10d4d6c8b1a0caff2fe70bbb1046673bbb1a999
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1333
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Tue, 28 May 2019 16:29:55 +0000 (12:29 -0400)]
Update renamed file in gitignore
In
f651e9843f0c6131ace24c33ef9cedc6926d7c51, test-utils-muxer-complete
was renamed to test_utils_muxer_complete without updating the gitignore.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Ieae29bf2f02172a0f99e91d3d12d01ff6cd73699
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1338
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 28 May 2019 00:45:06 +0000 (20:45 -0400)]
Fix: flt.lttng-utils.debug-info: cannot find addr past the first CU
Issue
=====
The `bin_info_lookup_source_location()` function doesn't look past the
first Compile Unit(CU) in the Dwarf information to find the filename and
line number of an address. This function iterates over all CUs of the
binary (or shared object) and tries to translate the address with each
of them. It ends up calling two other functions:
`bin_info_lookup_cu_src_loc_no_inl()`and `bin_info_lookup_cu_src_loc_inl()`
in a loop to cover all the CUs.
The `bin_info_lookup_cu_src_loc_no_inl()` function returns an error
(returning -1) if it can't find the line of the give address making the
calling function exit the loop, and thus abort the resolving.
The information that the resolving was unsuccessful is transmit back to
the caller by omitting to set the `src_loc` output parameter. The return
value of this function is used to notify the caller of an error. Not
resolving the source line should not make the function return -1.
This has the effect that if an address is contained in a CU after the
first one this function will not be able to resolve it.
Solution
========
Return 0 if the line is not found so that the search continues with
other CUs.
Drawbacks
=========
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I4d85bc75d32a9a25a7044f3686c6d5940311fa68
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1337
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 21 May 2019 19:06:25 +0000 (15:06 -0400)]
Fix: flt.lttng-utils.debug-info: note name memcmp() overflow
Issue
=====
If the note section that we are currently parsing has a name longer
than the "GNU" string, the `memcmp()` call will read garbage after the
"GNU" string.
I witnessed this when the component was parsing a note section named
"stapsdt".
Solution
========
Make the section name length comparison explicit.
Drawbacks
=========
None.
Reported-by: Address Sanitizer - Global buffer overflow
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I515f8c883ddbc1884045e86aecef700ee2111959
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1322
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Wed, 15 May 2019 20:01:39 +0000 (16:01 -0400)]
Cleanup: src.ctf.lttng-live: rename _is_canceled function
Rename the `lttng_live_is_canceled()` function to
`lttng_live_graph_is_canceled()` to make it clear it's the graph that
may be canceled and not the lttng_live component.
No behaviour change intended.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I918c5262e4b833eb8ed302eab42df19ceac0cbbc
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1309
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Wed, 22 May 2019 19:33:33 +0000 (15:33 -0400)]
Fix: flt.utils.trimmer: no error when upstream can not seek
Issue
=====
According to commit
7de0e49, every upstream message iterators of a
`flt.utils.trimmer` must support seeking. If it's not the case, the
graph should fail gracefully.
I encountered a situation where this invariant is not held. I can
reproduce this issue by commenting out the `_SEEK_BEGINNING_METHOD()`
and `_CAN_SEEK_BEGINNING_METHOD()` of the `flt.utils.muxer` and ran the
following graph:
babeltrace run \
--component=src:src.ctf.fs \
--params='paths=["/home/frdeso/lttng-traces/auto-
20181210-133612"]' \
--component=mux:filter.utils.muxer \
--component=trim:filter.utils.trimmer \
--params='begin="13:36:12.
871289834",end="13:36:12.
871303475"' \
--component=sink:sink.text.pretty \
\
--connect=src.*:mux.* \
--connect=mux.*:trim.* \
--connect=trim.*:sink.*
Note: The `begin` and `end` parameters are event timestamps from the trace.
When the trimmer component sees that seeking is not supported, it simply
skip the seeking and continue. This triggers a `BT_ASSERT()` later on.
See commit message
7474e7d3f0d005280c6614be5c818735e65d8b3b for more details on
seeking.
See commit message
7de0e49a7c4bb3c04075703e6767d15b7beb277f for more details on
trimmer.
Solution
========
Error out if seeking is disabled on upstream message iterators.
Drawbacks
=========
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I35cdec3b8eac54f2f596d0f50661608b624d3e2e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1325
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 23 May 2019 15:30:29 +0000 (11:30 -0400)]
Add .gitignore entry for .theia
This directory is used for project-specific settings for the Theia IDE.
Since I use that, I would like if the directory was ignored. Even
though it doesn't apply to everybody, it shouldn't bother anybody to
have this entry. Also, I wouldn't mind if we added similar entries for
other IDEs, if it helped other people.
Change-Id: Ic6f42b9d3f1d855e3d6e9e0dee1492aa484010ac
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1327
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Thu, 23 May 2019 16:08:30 +0000 (12:08 -0400)]
Fix: logging: possible buffer overflows
Issue
=====
Multiple possible buffer overflows on string operations using the
`SET_TMP_PREFIX()` macro that uses `strcpy()` on parameter char array.
Solution
========
Use a #define to set the length of the destination array and use it as
the size parameter of the `strncpy()` and `strncat()` calls.
Drawbacks
=========
None.
Notes
=====
Coverity reported defects:
CID
1401179 (#5 of 5): Copy into fixed size buffer (STRING_OVERFLOW) 9.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401181 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW) 5.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length
CID
1401186 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW) 15.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401192 (#2 of 2): Copy into fixed size buffer (STRING_OVERFLOW) 4.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401197 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW) 6.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401198 (#4 of 4): Copy into fixed size buffer (STRING_OVERFLOW) 15.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401203 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW) 28.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401212 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW) 12.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401215 (#4 of 4): Copy into fixed size buffer (STRING_OVERFLOW) 16.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401221 (#2 of 2): Copy into fixed size buffer (STRING_OVERFLOW) 19.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401227 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW) 13.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401230 (#3 of 3): Copy into fixed size buffer (STRING_OVERFLOW) 10.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401232 (#3 of 3): Copy into fixed size buffer (STRING_OVERFLOW) 23.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401234 (#5 of 5): Copy into fixed size buffer (STRING_OVERFLOW) 19.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401254 (#10 of 10): Copy into fixed size buffer (STRING_OVERFLOW) 10.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401257 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW) 9.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
CID
1401261 (#2 of 2): Copy into fixed size buffer (STRING_OVERFLOW) 11.
fixed_size_dest: You might overrun the 64-character fixed-size string
tmp_prefix by copying prefix without checking the length.
Reported-by: Coverity - Copy into fixed size buffer (STRING_OVERFLOW)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I922f1fb82a95e06b0c42627a2e57ba94debe1c5a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1329
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins
Michael Jeanson [Thu, 23 May 2019 18:20:56 +0000 (14:20 -0400)]
Add vim .swp files to gitignore
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Ibfe600455d80a8542a8f7ebcda44f3682b4b0534
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1330
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 23 May 2019 19:02:38 +0000 (15:02 -0400)]
Replace g_build_path with g_build_filename for portability
g_build_filename will use the correct separator depending on the
platform.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Iaeeb1a4c30aaea7690ba479ba05108c6fc57dd4e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1331
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Sat, 18 May 2019 20:25:23 +0000 (16:25 -0400)]
Fix: test_bitfield: buffer overrun accesses
This issue is due to a type mismatch between union member vs type passed
as parameter to the macros as found by Coverity:
** CID
1401409: Memory - corruptions (OVERRUN)
/tests/lib/test_bitfield.c: 450 in run_test_signed_write()
Issue introduced by commit
0675eb8c07 "Extend test_bitfield coverage"
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I14c9d69011b369e5dc8be4305ac8bf32cc86d3dd
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1321
CI-Build: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Tue, 21 May 2019 14:44:08 +0000 (10:44 -0400)]
Cleanup: tests: use underscores in filename
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I02a8b61e7c4a234aa017a941f4609f4276f387ee
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1320
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Wed, 15 May 2019 22:08:18 +0000 (18:08 -0400)]
Cleanup: flt.utils.muxer: avoid returning a pointer needlessly
Reshuffle `muxer_msg_iter_add_upstream_msg_iter()` function to return an
int rather than a pointer.
Returning a pointer in this case has no value since the newly allocated
structure is stored in a GQueue directly. Returning an int to express
success or error seems more appropriate and less error-prone.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I111cd06e1f667c98aa3bf650375c6e49fcd4c5dd
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1313
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Wed, 15 May 2019 21:55:31 +0000 (17:55 -0400)]
Fix: flt.utils.muxer: Potential memory leak
scan-build reports a potential memory leak of the
muxer_upstream_msg_iter pointer allocated in the
`muxer_msg_iter_add_upstream_msg_iter()` function if the `g_queue_new()`
fails.
So, free the muxer_upstream_msg_iter on the error path.
Reported-by: scan-build - Potential leak of memory
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia37a1be9525b357d063d5c5bd5623ddccbd4e29d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1312
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Mathieu Desnoyers [Thu, 16 May 2019 20:58:47 +0000 (16:58 -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>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1318
Tested-by: jenkins
Mathieu Desnoyers [Thu, 16 May 2019 20:58:46 +0000 (16:58 -0400)]
Silence compiler "always false comparison" warning
Compiling the bitfield test with gcc -Wextra generates those warnings:
../../include/babeltrace/bitfield-internal.h:38:45: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
#define _bt_is_signed_type(type) ((type) -1 < (type) 0)
This is the intent of the macro. Disable compiler warnings around use of
that macro.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2dd980e11ebd6cd37ae71b013925a6fca5d7b483
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1307
Tested-by: jenkins
Mathieu Desnoyers [Thu, 16 May 2019 20:58:48 +0000 (16:58 -0400)]
Extend test_bitfield coverage
test_bitfield was mainly testing various write unit size. Add
variations of read unit size as well.
Previously, the test was only covering input from a 32-bit integer.
Additionally test source and destination of 64-bit.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic2b7849140e04fe7cca3de576e31bfef8f0a03ae
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1305
Tested-by: jenkins
Mathieu Desnoyers [Thu, 16 May 2019 20:58:45 +0000 (16:58 -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>
Change-Id: I47d2655cfe671baf0fc18813883adf7ce11dfd6a
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1311
Tested-by: jenkins
Francis Deslauriers [Thu, 16 May 2019 00:14:42 +0000 (20:14 -0400)]
Fix: flt.utils.trimmer: bt_message_put_ref() on freed message
Issue
=====
In this function, we convert a timestamp in second to a clock value in
order to create a stream activity beginning message. We create a new
message and proceed to call `clock_raw_value_from_ns_from_origin()` to
convert the timestamp to a clock value.
If this call fails, we put the reference on this message using
`bt_message_put_ref()`. This frees the message as the refcount was at 1
because it was just created.
The problem here is that we don't reset the `msg` pointer and return it
to the call via the output parameter. This pointer points to freed data.
The caller then figures that the function failed by looking at the
return value and proceed to call `bt_message_put_ref()` again resulting
and assertion failure.
This can be easily triggered by passing a `begin` parameter of value 0
to a trimmer component.
Solution
========
Use a local variable to keep the pointer to the newly created message
and move that reference to the output parameter only on success.
Drawbacks
=========
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Id589f25d9ec6f555abd44ccb71e72af8e1684272
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1314
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Wed, 15 May 2019 21:32:22 +0000 (17:32 -0400)]
Fix: flt.utils.muxer: Undefined or garbage value returned
Reported-by: scan-build - Undefined or garbage value returned to caller
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I46c6e431ae4dcb68367dea84971779af017ecded
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1310
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 15 May 2019 18:49:14 +0000 (14:49 -0400)]
fix: Add PROT_READ to ctfser mmap flags
On Linux PROT_WRITE implies PROT_READ but on other Unices like Solaris,
it's not the case. This resulted in a segfault when reading from the
mapping.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: If11bbcf32e33bf5e682afaade2d3769a141c6583
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1302
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins
Francis Deslauriers [Wed, 15 May 2019 19:21:34 +0000 (15:21 -0400)]
Fix: src.ctf.fs: possible use-after-free in the error path
Reported-by: scan-build - Use of memory after it is freed
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I5c19a45b0ddd11eed3872295efeb7b5201967419
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1303
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 13 May 2019 17:43:40 +0000 (13:43 -0400)]
Fix type-limits warnings, uint can't be < 0
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I14ba4492bd2ea9803daf8985dd8fe21107942df6
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1295
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 13 May 2019 15:22:15 +0000 (11:22 -0400)]
Fix old-style-declaration warnings
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I997662eaaabc217b22a0010dccd292e4e946933f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1294
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Mon, 13 May 2019 15:16:35 +0000 (11:16 -0400)]
Annotate implicit fall-through
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I21c5641869afca1fcac301f612d02d2cb10583db
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1293
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Fri, 10 May 2019 18:34:00 +0000 (14:34 -0400)]
Cleanup: src.ctf.fs: index no longer used in loop
This removal should have been done in an earlier commit modifying this
loop:
Author: Francis Deslauriers <francis.deslauriers@efficios.com>
Date: Tue Apr 30 19:01:17 2019 -0400
src.ctf.fs: compute stream range using entire file info group
Given that index entries are sorted within their file info structure and
that file info structures are sorted by time within the file info group,
we can simply compute the range of the stream by using the absolute
first index entry and the absolute last index entry of the entire file
info group.
Add `BT_ASSERT()` to enforce invariants in developer mode.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I4e0b53cbb808835886b97b6d6001ecd7bcc2abb4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1288
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Thu, 9 May 2019 14:51:36 +0000 (10:51 -0400)]
Fix: sink.ctf.fs: Dereference before null check
No need to check if `trace->metadata_path` is null at the point because
it has been used by `fopen()` already and `abort()` is called if
`fopen()` fails.
CID
1401238 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking trace->metadata_path suggests that it
may be null, but it has already been dereferenced on all paths leading
to the check.
Reported-by: Coverity (1401238) Dereference before null check
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I90590323764810da8a6b4cfb37445a588befd242
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1284
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins
Francis Deslauriers [Thu, 9 May 2019 16:02:57 +0000 (12:02 -0400)]
Fix: sink.ctf.fs: possible uses after free because of unchecked return values
Uses after free are possible because we ignore the return value of the
`bt_ctfser_write_*()` function calls. To avoid this, check the return
values and log an error message.
CID
1401217 (#4 of 4): Use after free (USE_AFTER_FREE)
11. deref_arg: Calling bt_ctfser_write_byte_aligned_unsigned_int
dereferences freed pointer stream->ctfser.base_mma
CID
1401193 (#2 of 2): Unchecked return value (CHECKED_RETURN)
8. check_return: Calling bt_ctfser_write_byte_aligned_unsigned_int
without checking return value (as is done elsewhere 8 out of 10
times).
Reported-by: Coverity (1401217) Use after free
Reported-by: Coverity (1401193) Unchecked return value
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I7581c0e549d7bf916f42afe306976baa9822897a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1286
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Fri, 10 May 2019 14:57:58 +0000 (10:57 -0400)]
Cleanup: common/assert.c: remove useless calls
CID
1401190 (#1 of 1): Useless call (USELESS_CALL)
side_effect_free: Calling bt_common_color_bold() is only useful for
its return value, which is ignored.
side_effect_free: Calling bt_common_color_fg_red() is only useful for
its return value, which is ignored.
Reported-by: Coverity (1401190) Useless call
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia25823f44c24997782ccc209c48d5b28a45a98f4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1287
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Fri, 10 May 2019 21:21:25 +0000 (17:21 -0400)]
Cleanup: src.ctf.fs: erroneous comment
The `len` field is already increased by the `g_ptr_array_add()` call.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I6c261aa20ca79b368c668d0e77879611e56b0bc6
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1289
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Wed, 8 May 2019 17:50:51 +0000 (13:50 -0400)]
Add -Werror=implicit-function-declaration to AM_CFLAGS
Implicit declaration of function is most likely always a bad thing.
Implicit declaration of function is particularly problematic with
Babeltrace 2 because of its plugin system. Currently, when building a
plugin shared object, the compiler issues a warning when it encounters
an implicit declaration but will create the .so just fine but with the
implicit function marked as undefined, as expected by the standard prior
to C99.
When trying to load a Babeltrace plugin with an undefined symbol, glib's
`g_module_open()` fails and Babeltrace then considers that this .so is
not a valid Babeltrace plugin.
A failure to load a plugin is not a error because we want Babeltrace to
be able to list/use every plugins in a given directory by looking at
every .so file. So we can't simply return an error in those cases.
Since Babeltrace marks plugins with undefined symbols as invalid they
can't be used in a graph.
This problem is caused when a typo in a function name finds its way into
the code and a warning message is ignored. It can also happen when the
code uses a function of more recent library than what is currently
installed on the system.
So, to ensure this never happens, we promote the
`-Wimplicit-function-declaration` warning to the rank of compilation
error.
This is diagnostic has been supported by GCC since v4.8 and Clang since
v4 at least so we believe it's safe to enable it by default.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia43b4f8c85b6a6cb7557f084a2bed07e7ec043dc
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1278
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Thu, 9 May 2019 15:10:30 +0000 (11:10 -0400)]
Add missing gitignore for test_ctf_plugin
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I903f6c119ec51e5c96b555f762bcd0d43e11446f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1285
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 8 May 2019 15:33:06 +0000 (11:33 -0400)]
Harmonize pprint macro across projects
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I9d02bf7e3c438162c29ed58b1ca2050b76d15363
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1274
CI-Build: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Wed, 8 May 2019 15:32:24 +0000 (11:32 -0400)]
Update macros from the autoconf archive
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I6d496de7d988c47ebeaf314e9639281853116829
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1273
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Wed, 8 May 2019 15:43:02 +0000 (11:43 -0400)]
flt.lttng-utils.debug-info: fd-cache: log to `debug` severity on stat() error
Issue
=====
A `debug-info` component tries to open multiple files in its search to
find the debugging information necessary to resolve the addresses
contained in the trace.
Early in the `bt_fd_cache_get_handle()` function, a `stat()`
is done on the path to get the inode number and device number. This
`stat()` returns an error if the file is absent. Currently, in those
cases, an message is logged at the `error` severity level (BT_LOGE_*)
resulting in the printing of an error message. Since multiple files are
tired until the right one is found (if any), the user can see multiple
error messages even if the right file may be found later.
This is undesirable because it mislead the user into thinking that an
error occurred when in fact it's completely normal.
Solution
========
Log the failure of this `stat()` call to the `debug` severity level.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: If81f4333374e6ee95b4dea07924c3d37f0e3b652
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1276
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 18:21:55 +0000 (14:21 -0400)]
Fix: src.ctf.fs: Using uninitialized value
`iter_status` may be used uninitialized if the break statement in the
do-while is reached.
Fixes Coverity #
1401236:
CID
1401236 (#1 of 1): Uninitialized scalar variable (UNINIT)
9. uninit_use: Using uninitialized value iter_status.
Reported-by: Coverity (1401236) Uninitialized scalar variable
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I96e4608011144cb3c1ae26018d57e98f0358a779
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1261
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Tue, 7 May 2019 19:39:41 +0000 (15:39 -0400)]
Fix: sink.ctf.fs: writing 64bit real number as 32bit
Both 32bit and 64bit Trace IR real numbers are written as 32bit CTF
floats with the `bt_ctfser_write_float32()`. This is most probably a
copy-paste error.
To fix this, use the `bt_ctfser_write_float64()` in the else branch instead.
Coverity report:
CID
1401207 (#1 of 1): Identical code for different branches (IDENTICAL_BRANCHES)
identical_branches: The same code is executed regardless of whether
fc->base.size == 32U is true, because the 'then' and 'else' branches
are identical. Should one of the branches be modified, or the entire
'if' statement replaced?
Reported-by: Coverity (1401207) Identical code for different branches
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I462fd47e968e39f5878431d5ac6cbcbbf1d2ffcf
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1268
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Tue, 7 May 2019 21:32:29 +0000 (17:32 -0400)]
Fix: flt.lttng-utils.debug-info: `ip` field is 32bit on 32bit cpus
Issue
=====
The debug-info component enforces that the `ip` field used to resolve
addresses is a 64bit integer, but the LTTng UST `ip` context field is
32bit on a 32bit cpu. A debug-info component thus fail to recognize that
the trace has all the necessary information to resolve the addresses.
Here is the metadata representing the context on a 32bit system:
event.context := struct {
integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _vpid;
integer { size = 32; align = 8; signed = 0; encoding = none; base = 16; } _ip;
};
Here is the metadata representing the context on a 64bit system:
event.context := struct {
integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _vpid;
integer { size = 64; align = 8; signed = 0; encoding = none; base = 16; } _ip;
};
Solution
========
Remove the integer size check in the
`is_event_common_ctx_dbg_info_compatible()` function.
Drawback
========
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I3938a5f71a2406876573a5aa381f7d3dd4d632d6
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1270
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Simon Marchi [Wed, 8 May 2019 17:12:22 +0000 (13:12 -0400)]
tests: Run test_bitfield
I noticed that the test_bitfield executable was not run as part of make
check. Add it to TESTS_LIB.
Change-Id: Id1c40a7916b6326f7655a49e033d5570e40b42e6
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1277
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Michael Jeanson [Tue, 7 May 2019 16:25:05 +0000 (12:25 -0400)]
Fix: duplicate symbol with clang linker
On MacOs with the clang linker, the build fails with:
duplicate symbol _bt_ctf_value_null in:
trace-ir/.libs/libtrace-ir.a(trace.o)
trace-ir/.libs/libtrace-ir.a(trace-class.o)
Make the pointers extern.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I679dc5b647de235a19a958331f7f975c0cb0a08f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1267
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 18:14:39 +0000 (14:14 -0400)]
Fix: fd-cache: fd leak on error path
Fixes coverity #
1401248
CID
1401248 (#1 of 1): Resource leak (RESOURCE_LEAK)
10. leaked_handle: Handle variable fd going out of scope leaks the handle.
Reported-by: Coverity (1401248) Resource leak
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I41662edaa4ff13046e003aec20ac27ff242e338f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1260
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 18:50:50 +0000 (14:50 -0400)]
Fix: lib/graph: Dereference before null checks
CID
1401244 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.source_output_port_added suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.
CID
1401260 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.filter_output_port_added suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.k
CID
1401243 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.filter_input_port_added suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.
CID
1401185 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking graph->listeners.sink_input_port_added
suggests that it may be null, but it has already been dereferenced on
all paths leading to the check.
CID
1401262 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.source_filter_ports_connected suggests that it may be
null, but it has already been dereferenced on all paths leading to the
check.
CID
1401200 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.filter_filter_ports_connected suggests that it may be
null, but it has already been dereferenced on all paths leading to the
check.
CID
1401252 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.source_sink_ports_connected suggests that it may be
null, but it has already been dereferenced on all paths leading to the
check.
CID
1401264 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking
graph->listeners.filter_sink_ports_connected suggests that it may be
null, but it has already been dereferenced on all paths leading to the
check.
Reported-by: Coverity (various ids) Dereference before null check
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I88c8172e006e4bae2c7b5e29b501e1a36f19ae5c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1262
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 20:45:32 +0000 (16:45 -0400)]
Fix: cli: value stored is never read
Found with scan-build:
line 1434, column 4
Value stored to 'ret' is never read
line 1281, column 4
Value stored to 'ret' is never read
line 1345, column 2
Value stored to 'ret' is never read
line 1423, column 3
Value stored to 'ret' is never read
line 1396, column 3
Value stored to 'ret' is never read
Reported-by: scan-build
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I95f06132c34bbf9c4ffbb81423e42cf1834880bd
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1266
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 19:39:05 +0000 (15:39 -0400)]
Fix: flt.lttng-utils.debug-info: omitting copy_field_class_content() return value
ID
1401259 (#1 of 2): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement: goto error;.
CID
1401259 (#2 of 2): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement: goto error;.
Reported-by: Coverity (various ids) Logically dead code
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I1b3bb7cba9aec34e6a90386178f99cc505d4da66
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1264
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 20:22:03 +0000 (16:22 -0400)]
Fix: flt.lttng-utils.debug-info: memory leak
The gelf_getshdr() function return a pointer to the second parameter on
success and NULL on error. This means that on we overwrite the
`curr_section_hdr` variable and leak memory.
To fix it, we simply change the variable from a heap allocated variable
to a stack allocated variable this has the effect of making code simpler.
Found using scan-build:
line 334, column 7
Potential leak of memory pointed to by 'curr_section_hdr'
Report-by: scan-build (ad8e62)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I5cc4049075e4ca1d64d98e17662f935e6562bb6e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1265
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 19:04:05 +0000 (15:04 -0400)]
Fix: sink.text.pretty: Unsigned compared against 0
CID
1401251 (#1 of 1): Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This less-than-zero comparison of an unsigned value is
never true. nr_fields < 0UL.
Reported-by: Coverity (1401251) Unsigned compared against 0
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8aa8a03a6b03ca1640570d70a51729d001af3b66
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1263
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Mon, 6 May 2019 16:20:09 +0000 (12:20 -0400)]
Fix: src.ctf.fs: init_index_entry() may return uninitialized value
Found with scan-build.
Warning reported: Undefined or garbage value returned to caller
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ifaccdd9f7c8a762fd4eb9f26a5fce4cd092c44df
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1259
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins
Philippe Proulx [Sun, 5 May 2019 11:53:50 +0000 (07:53 -0400)]
cli/babeltrace.c: update known log level environment variable names
Eventually we could find another way to synchronize the environment
variable names we use throughout the project with the CLI. We want to
decouple the plugins from the CLI (plugins do not know CLI, but CLI
knows plugins) so I don't want the plugins to support an environment
variable defined by the CLI for example.
For the moment, I'm using this:
rg --pcre2 -N --iglob='*.c' --iglob='*.h' --no-filename -o \
'BABELTRACE_\w+(?<!CLI)_LOG_LEVEL\b' --color=never | sort | uniq
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I148c5c859570d0b1a654c829b31066155e8ecf5e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1258
Tested-by: jenkins
Philippe Proulx [Fri, 3 May 2019 19:14:18 +0000 (15:14 -0400)]
lib: add unsigned and signed integer value API
This patch replaces the integer value API with the more specific
unsigned and signed integer value API. This opens the whole unsigned
64-bit set for component initialization parameters, query parameters,
queyr results, and, eventually, custom metadata attributes. This is also
more in line with the field API, which has both the unsigned and signed
versions.
Library
=======
The API is simply split in two, where an unsigned integer value contains
a `uint64_t` raw value and a signed integer value is the equivalent of
the previous integer value (`int64_t` raw value).
The types are `BT_VALUE_TYPE_UNSIGNED_INTEGER` and
`BT_VALUE_TYPE_SIGNED_INTEGER`.
There's no interaction between unsigned and signed integer values, in
that, for example, you cannot compare an unsigned integer value with a
signed integer value with bt_value_compare().
Behind the scenes, I kept a single `struct bt_value_integer` for
simplicity. It contains a union of `uint64_t` and `int64_t`. Most
functions call a generic unsigned version, casting to `uint64_t` when
necessary. For example, there's a common bt_value_integer_compare()
which compares the `uint64_t` values.
CLI
===
Before this patch, the `--params` option's format makes any integer
constant a signed integer value object. With this patch, you can create
an unsigned integer value by prepending the constant with `+`. For
example:
hello=+293, meow=+0x388ab88fd, uint-zero=+0
I wanted to use the `U` suffix, like in C/C++, but the GLib lexical
scanner won't allow a constant to be followed by an identifier without a
whitespace.
The documentation about the format of `--params` is updated for the
CLI's `--help` option and in the man pages.
Plugins
=======
It's up to each plugin to accept, for a given parameter, an unsigned
integer value, a signed integer value, or both. A plugin can be very
strict and it's not a bad thing: there are situations where an unsigned
integer is conceptually required.
The individual changes are:
`src.ctf.fs`:
In the `trace-info` query result, create unsigned integer values for
the `id` (stream ID) and `class-id` (stream class ID) entries. A CTF
metadata ID is never negative.
`src.ctf.lttng-live`:
In the `sessions` query result, the `timer-us`, `stream-count`, and
`client-count` entries are still signed integer values. They could
probably be unsigned, but I want to confirm this with developers
more involved with this component class before doing the change. For
the moment, the query operation is unchanged.
`sink.utils.counter`:
The `step` initialization parameter is now expected to be an
unsigned integer value. This is never negative.
I also made the initialization refuse parameters when they don't
have the expected type. There are new `logging.c` and `logging.h`
files for this component class because I used logging to communicate
said errors.
Library tests
=============
The integer value tests now test the signed value API.
I added equivalent unsigned value object tests.
Python bindings
===============
`_IntegerValue` is now the base class of `UnsignedIntegerValue` and
`SignedIntegerValue`. `_IntegerValue` contains the whole public
interface, using template methods with specialized parts defined in
subclasses.
`_IntegerValue` is imported in the `bt2` package for this use case:
if isinstance(val, bt2._IntegerValue):
do_something_with(val)
because `int(val)` is always valid.
The bt2.create_value() function still creates a `SignedIntegerValue`
object with an `int` value. This is the safest, as there's no way to
know that this value will be changed to a negative value in the future,
before the value object is frozen. For example, this would not be
possible with a conversion to an `UnsignedIntegerValue`:
val = bt2.create_value(47)
val.value = -23
whereas it is possible with a `SignedIntegerValue`. You can still
explicitly create an unsigned integer value:
counter_comp = my_graph.add_component(counter_cls, 'counter', {
'step': bt2.UnsignedIntegerValue(29)
});
Python bindings tests
=====================
`test_value.py` is updated to also test the `UnsignedIntegerValue`
class. _inject_numeric_testing_methods() now accepts an optional
`has_neg` parameter which, if false, does not inject tests which involve
negative integer values.
There is a common `_TestIntegerValue` class which
`SignedIntegerValueTestCase` and `UnsignedIntegerValueTestCase` inherit.
The tests are almost the same, but `SignedIntegerValueTestCase` adds a
few tests related to negative values. Both specific test cases set the
`_CLS` class attribute to the value object class to test, either
`UnsignedIntegerValue` or `SignedIntegerValue`.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ic96ef9e1e16883cb5c59844c6ba5a060936efdb0
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1257
Tested-by: jenkins
Philippe Proulx [Fri, 3 May 2019 15:37:37 +0000 (11:37 -0400)]
lib: value.c: remove BT_VALUE_FROM_CONCRETE() macro
We can just cast to `void *` directly like we do everywhere else in the
library.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: If09f1be2e7f8f9cf3bf964a7d4ada5b3307ef7f4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1256
CI-Build: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins
Philippe Proulx [Fri, 3 May 2019 15:24:23 +0000 (11:24 -0400)]
lib: move `bt_value` structures to `value-internal.h`
It's unusual to have internal structures in the C file. To remain
consistent with the rest of the library, put them in the internal
header.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I5a946004a172560acecab1b182214293f61f02fd
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1255
CI-Build: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tested-by: jenkins
Simon Marchi [Fri, 3 May 2019 21:25:14 +0000 (17:25 -0400)]
bt2: Make test_query_executor pass
This patch fixes and enables test_query_executor.py.
The only important change is in the query method: it is necessary to
check for `is_canceled` prior to calling the API function, since it
asserts that the executor is not cancelled.
I have removed the __eq__ method and tests, since it's quite unlikely to
be useful for the QueryExecutor class.
Change-Id: If88c2552627358b06f7d6068126034a20ebf88e8
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1252
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 3 May 2019 19:58:04 +0000 (15:58 -0400)]
bt2: Fix Makefile dependency tracking when building out of tree
The problem, from the point of view of the developer:
1. Build out of tree, python bindings enabled.
2. Modify a bindings source file (e.g. trace_class.py,
native_bt_trace.i).
3. Type "make" in the builddir.
4. The bindings are not rebuilt from the new source files.
5. Sad.
When we build out of tree, it's done in two steps (assume $builddir is
$top_builddir/bindings/python):
1. Copy all the static files (those checked in the repo, not generated
at runtime) from $srcdir/bt2 to $builddir/bt2. Those files are placed
next to other files that are generated (__init__.py, setup.py).
Together, they form the complete source of the bt2 package.
2. Run setup.py, which runs SWIG and outputs the built package in
$builddir/build_lib.
The problem described above happens because of how the dependencies are
stated for step #1:
STATIC_BINDINGS_DEPS = ... bt2/native_bt_trace.i ...
copy-static-deps.stamp: $(STATIC_BINDINGS_DEPS)
When nothing exists yet in the build directory, bt2/native_bt_trace.i is
resolved to the version in the srcdir (because of make's VPATH, I
believe), so it works fine. But once the copied files exist, and you
try to change the source files and "make" again, the dependency
bt2/native_bt_trace.i will be resolved to the version in the build dir.
Since that version is not newer than copy-static-deps.stamp, nothing is
done.
The fix it, we can force the dependency to be the one in the source
directory, by prepending $(srcdir) to each file.
Change-Id: Ic09d430e53b59e5afa9ebb19d98ba219dff16537
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1250
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Fri, 3 May 2019 19:06:45 +0000 (15:06 -0400)]
fix: g_hash_table_insert prior to glib 2.40 returns void
Even the post glib 2.40 version will only return false if the value is
already present in the hashtable but will not fail to add it. The old
value will be handled according to the configuration of the hashtable
which should not be an error.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I5512c921ce220bf8a956c61f594d6a27e6ceb41e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1247
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Fri, 3 May 2019 23:51:11 +0000 (19:51 -0400)]
tests/plugins/ctf/Makefile.am: do not set `TESTS` in this file
We want the project's `make check` to continue even if specific tests
fail, so we can't define `TESTS` in a subdirectory's `Makefile.am`,
because if the test fails, `make` fails, and subsequent tests are not
executed.
There are ways to circumvent this, for example using `make`'s
`--always-make` option, but it was decided previously that we want
`make check` to run all tests as is, without any option.
Therefore we set `TESTS` to all tests in `tests/Makefile.am`.
To execute tests specific to a subdirectory, we have the following
targets:
* `check-bindings`
* `check-cli`
* `check-lib`
* `check-plugins`
* `check-python-plugin-provider`
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I1f198ff3ff2b44947042aee7fa5f01759874941f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1254
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Jérémie Galarneau [Fri, 3 May 2019 23:12:13 +0000 (19:12 -0400)]
Update version to v2.0.0-pre5
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2565d6378c5506a2512a5c6e7c092247e2224e17
Francis Deslauriers [Fri, 3 May 2019 16:39:59 +0000 (12:39 -0400)]
Fix: flt.lttng-utils.debug-info: build id note section non-native byte order
Issue
=====
The build id comparison code does not take into account that the target
binary file could be compiled for another architecture and thus could be
of a different byte order. This makes the build_id testcase fail on
PowerPC. The artefacts used for this testcase are compiled on x86 and
are thus in little endian as opposed to PowerPC's big endianness.
Solution
========
Parse the Elf file to extract the endianness of the binary and use that
information to change the byte order of the note section if necessary.
Drawbacks
=========
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Id5d761832f9463b38ea0452da36053e885929aa9
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1246
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Francis Deslauriers [Fri, 3 May 2019 19:11:00 +0000 (15:11 -0400)]
common: add bt_common_read() function
This function wraps the `read()` function to handle EINTR and partial
reads.
It returns the `count` value on success, or a smaller value than `count`
on error.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ib0385855447200d97a58da704dcf68423e857033
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1248
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Francis Deslauriers [Fri, 3 May 2019 22:26:57 +0000 (18:26 -0400)]
Fix: common: va_list type is implementation dependant
Issue
=====
BT_ASSERT(*args) happens to work on some library implementations because
the va_list type happens to be a pointer but this is not true with all
libraries. For example, compiling on arm64 results in the following
error:
In file included from common.c:34:0:
common.c: In function ‘bt_common_custom_vsnprintf’:
../include/babeltrace/assert-internal.h:42:7: error: wrong type
argument to unary exclamation mark
if (!(_cond)) { \
^
common.c:1524:2: note: in expansion of macro ‘BT_ASSERT’
BT_ASSERT(*args);
^~~~~~~~~
Solution
========
Remove that BT_ASSERT() call as its intent is unclear anyway.
Drawback
========
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Iada5189ef4580e48caefed12835bfab7c23eaf73
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1253
CI-Build: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Jérémie Galarneau [Fri, 3 May 2019 20:23:16 +0000 (16:23 -0400)]
Fix: uninitialized variant fc in set_field_refs()
GCC 8.3.0 emits the following warning:
translate-trace-ir-to-ctf-ir.c:935:16: warning: ‘var_fc’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
named_fc =
fs_sink_ctf_field_class_variant_borrow_option_by_index(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var_fc, i);
I don't think this "condition" is reachable, but it is, in principle
possible. Initializing var_fc to NULL silences this warning.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1fd8951778e8b3705974324e1cd5d87892c2e418
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1251
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Simon Marchi [Thu, 2 May 2019 16:21:20 +0000 (12:21 -0400)]
src.ctf.fs: make trace-info query accept clock-class-offset-{s,ns} parameters
The src.ctf.fs components accept clock-class-offset-s and
clock-class-offset-ns parameters, allowing to add an offset to the
clock.
The trace-info query currently doesn't accept the same parameters. In
general, I think we'll want the components and trace-info to accept
pretty much the same set of parameters, so that the information reported
by trace-info accurately represents how an eventual component reading
the same traces will work.
This patch splits the parameter handling of the component in a
standalone function re-used by the query. The advantage of sharing a
function like this is that if we add a parameter to the component, we'll
be forced to think about what happens to the trace-info query.
One behavior change is that trace_info_query now returns
BT_QUERY_STATUS_INVALID_PARAMS if the passed parameters are invalid.
A test is added to test the new functionality.
Change-Id: I3d917b8713fce4ce56a79a6e7c7bdc3e32d9ec0c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1244
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 2 May 2019 20:53:30 +0000 (16:53 -0400)]
ctf: Use g_time_val_from_iso8601 instead of g_date_time_new_from_iso8601
g_date_time_new_from_iso8601 was introduced in glib 2.56, which is quite
recent. To support build with older glibs, change the code to use
g_time_val_from_iso8601 instead, introduced in glib 2.12.
The code in question only uses this function to validate that the passed
string is ISO8601-compliant, it doesn't use the resulting time value.
The problem of g_time_val_from_iso8601 is that its result is not year
2038-safe on 32-bit systems. We can expect that by then, that function
will have been removed from glib, forcing us to update our code.
Change-Id: I2f4fdfce9020ecefcfb5d653a3885d343e49bd76
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1245
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 2 May 2019 18:18:07 +0000 (14:18 -0400)]
tests: update EXTRA_DIST of Python bindings
This list is out of date, causing "make dist" to fail.
Sync the list of distributed files with the actual files.
Change-Id: Iedef7411c691689eb6a0505b4ea29d0f319f6860
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1242
Tested-by: jenkins
Reviewed-by: Jonathan Rajotte Julien <jonathan.rajotte-julien@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 2 May 2019 18:29:10 +0000 (14:29 -0400)]
tests: remove non-existent files from EXTRA_DIST
These files were removed in commit
e8bacbe2bd42 ("Remove stale trace-ir test files")
... so they should be removed from EXTRA_DIST as well. Currently, it
causes a "make dist" failure:
make[4]: *** No rule to make target 'test_trace.py', needed by 'distdir'. Stop.
The tests/lib/trace-ir directory is currently not very useful, as it
contains no tests at all, so we could remove it in theory. But I
presume we'll add something in there in not too long, so I think we can
leave it there.
Change-Id: Iec44efd7c52e84b35a5a55206055b5d63635fbe1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1241
Tested-by: jenkins
Reviewed-by: Jonathan Rajotte Julien <jonathan.rajotte-julien@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Thu, 2 May 2019 18:36:57 +0000 (14:36 -0400)]
include: add missing files to dist tarball
When making a tarball (make dist) and trying to build from it, it fails
because of missing header files. This patch adds all the necessary
headers to the dist tarball to make "./configure && make" from the
tarball succeed.
Change-Id: I89051cb060e911eac154ef1726034e905b49b085
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1243
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Jonathan Rajotte Julien <jonathan.rajotte-julien@efficios.com>
Simon Marchi [Wed, 1 May 2019 22:00:50 +0000 (18:00 -0400)]
bt2: Add wrapper for bt_plugin_get_version
There is a subtle bug with our use of the "char **OUT" typemap for the
bt_plugin_get_version function.
THe SWIG wrapper does this:
char *temp_value5;
arg5 = &temp_value5;
The initial content of temp_value5 is unknown, assume that it points to
unreadable memory. If the call to bt_plugin_get_version returns
PROPERTY_AVAILABILITY_NOT_AVAILABLE, the value of temp_value5 is
unchanged (but really, it could be anything, again we should assume it
points to unreadable memory). However, the epilogue of the typemap will
still try to transform the C string to a Python str object. Doing so
will cause a crash when trying to read the C string.
The fix is to make our own wrapper to bt_plugin_get_version, which
guarantees that if it returns PROPERTY_AVAILABILITY_NOT_AVAILABLE, it
will force the value of the output parameter to be NULL (which is
handled by the epilogue and transformed to None).
Setting the temporary variable to an invalid but non-zero pointer value
((void *) 1) makes this bug consistently reproducible and not rely on
random memory contents. I suggest we keep it there, in order to quickly
find other instances of this bug in the future.
Change-Id: Idd12ca4c4d4d732b841c1e12420e46e6a5a25874
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1221
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Michael Jeanson [Tue, 30 Apr 2019 15:10:10 +0000 (11:10 -0400)]
Add git-review config
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: Iece6807efd73611d1a2767c3284fbe6f9f72256c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1023
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Wed, 1 May 2019 22:44:44 +0000 (18:44 -0400)]
Fix: bt2: enum-conversion warning in native_bt_component_class.i
clang warns about the following enumeration conversion.
bt2/native_bt_wrap.c:3896:12: warning: implicit conversion from
enumeration type 'enum bt_message_iterator_status' to different
enumeration type 'enum bt_self_message_iterator_status'
[-Wenum-conversion]
status = BT_MESSAGE_ITERATOR_STATUS_END;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bt2/native_bt_wrap.c:3898:12: warning: implicit conversion from
enumeration type 'enum bt_message_iterator_status' to different
enumeration type 'enum bt_self_message_iterator_status'
[-Wenum-conversion]
status = BT_MESSAGE_ITERATOR_STATUS_AGAIN;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bt2/native_bt_wrap.c:3901:12: warning: implicit conversion from
enumeration type 'enum bt_message_iterator_status' to different
enumeration type 'enum bt_self_message_iterator_status'
[-Wenum-conversion]
status = BT_MESSAGE_ITERATOR_STATUS_ERROR;
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bt2/native_bt_wrap.c:4513:43: warning: implicit conversion from
enumeration type 'enum bt_message_iterator_status' to different
enumeration type 'bt_self_message_iterator_status' (aka 'enum
bt_self_message_iterator_status') [-Wenum-conversion]
bt_self_message_iterator_status status = BT_MESSAGE_ITERATOR_STATUS_OK;
~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bt2/native_bt_wrap.c:4678:43: warning: implicit conversion from
enumeration type 'enum bt_message_iterator_status' to different
enumeration type 'bt_self_message_iterator_status' (aka 'enum
bt_self_message_iterator_status') [-Wenum-conversion]
bt_self_message_iterator_status status = BT_MESSAGE_ITERATOR_STATUS_OK;
~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Icb3bc0141cdd9f35a5a42420bb48167c12e70df0
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1183
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Francis Deslauriers [Wed, 1 May 2019 18:19:05 +0000 (14:19 -0400)]
Fix: bt2: int-to-pointer-cast warnings in SWIG utils functions
bt2/native_bt_wrap.c: In function ‘bt_py3_component_class_query’:
bt2/native_bt_wrap.c:4453:12: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
*result = (void *) PyLong_AsUnsignedLongLong(py_results_addr);
^
bt2/native_bt_wrap.c: In function ‘bt_py3_component_class_message_iterator_next’:
bt2/native_bt_wrap.c:4697:3: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
(const bt_message *) PyLong_AsUnsignedLongLong(
^
python-plugin-provider.c: In function ‘bt_plugin_from_python_plugin_info’:
python-plugin-provider.c:341:18: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
comp_class = (bt_component_class *)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I44d15e5d072d993776539eddae5f3e37c6161cac
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1162
CI-Build: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Philippe Proulx [Wed, 1 May 2019 20:58:09 +0000 (16:58 -0400)]
sink.ctf.fs: set_field_refs(): make `fc` `const` as `fc_type` depends on it
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I9b0a0eb3fc41d9181205cb4f3f33334b90a3b712
Philippe Proulx [Wed, 1 May 2019 20:56:03 +0000 (16:56 -0400)]
Fix: sink.ctf.fs: do not keep different `tgt_fc_type` as `tgt_fc` changes
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ie79306f50018d7f5ca0971e6c9a2410378a4ccc7
Philippe Proulx [Wed, 1 May 2019 20:40:05 +0000 (16:40 -0400)]
lib: bt_graph_{consume,run}(): add unlikely() to unlikely condition
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I37badc4c15fbde16940150854cae1e31305953f1
Francis Deslauriers [Tue, 30 Apr 2019 23:01:17 +0000 (19:01 -0400)]
src.ctf.fs: compute stream range using entire file info group
Given that index entries are sorted within their file info structure and
that file info structures are sorted by time within the file info group,
we can simply compute the range of the stream by using the absolute
first index entry and the absolute last index entry of the entire file
info group.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I5b13451d72a4b1aeb9f31140ebfb025e2d712d7e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1128
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 30 Apr 2019 20:30:32 +0000 (16:30 -0400)]
bt2: update bindings to make test_plugins pass
This patch updates the necessary stuff in the bindings to make
test_plugins pass.
One new test is added, test_find_file, which tests passing the path to a
plugin shared object to bt2.find_plugins.
Change-Id: Ie2ac6e830fb18d8839d2879567509cd2f6abbd81
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1087
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins
Simon Marchi [Wed, 1 May 2019 18:09:13 +0000 (14:09 -0400)]
bt2: update bindings to make test_component pass
This patch updates component.py such that the test_component test
passes.
With the API, it is no longer possible to obtain the graph from a
component, so things related to this are removed from both files.
Change-Id: I3ab0e6aaaa8ec1ad7378abb78072e6e130e1c2a4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1085
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 1 May 2019 15:30:28 +0000 (11:30 -0400)]
bt2: update bindings to make test_component_class pass
This patch updates the binding with the goal of making
test_component_class pass.
Besides the obviously needed changes to the component class code, there
are a bunch of changes to things around it (component, graph), just
enough to make the test run.
One notable change is the _SharedObject._release method, used to make the
Python object stop manage the reference it currently owns.
Another functional change is how the component classes _query method
reports that it's not implemented. Currently, it default to return the
NotImplemented object. Instead, I made it raise a NotImplementedError.
Returning NotImplemented is useful if the caller has an alternative to
try when the method is not implemented. In our case, there is nothing
to do if the specific class doesn't implement _query. The exception is
caught in bt_py3_component_class_query, where other types of exceptions
need to be handled anyway.
Some changes are required to the library, to be able to get a specific
component class type from a specific component (e.g. a
bt_component_class_source from a bt_component_source).
Change-Id: I895817bc996c21b6a9c6d57605cc64f9ff61dfcc
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1083
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Wed, 1 May 2019 14:17:33 +0000 (10:17 -0400)]
lib: Add functions to borrow specialized component classes from specialized components
The API currently contains a function to obtain a 'bt_component_class *'
from a 'bt_component *'. This patch adds functions to obtain a
specialized component class from a specialized component. For example,
a 'bt_component_class_source *' from a 'bt_component_source *'.
Change-Id: Ide192c7759f630adbc884def2e5c462ce2b8f973
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1161
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Fri, 26 Apr 2019 19:41:24 +0000 (15:41 -0400)]
bt2: update value.py, make test_value pass
This patch updates value.py to match the current API.
The only known thing missing (to be done later) is to split classes in
their const and non-const variants (e.g. BoolValue and BoolValueConst),
where the methods that can modify values are only present on the
non-const versions.
The test is largely unchanged, except for the removal of things related
to frozen values.
Change-Id: I6424b0e6208ffe2cbe5e60fdd08579326abff29a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1022
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 29 Apr 2019 16:12:36 +0000 (12:12 -0400)]
bt2: update object model
This patch updates the Babeltrace Python object model (what all
Babeltrace Python objects inherit from) to match the current status of
the API.
We have both Shared and Unique objects. Both types have a _ptr
member, a SWIG Python object wrapping a typed pointer (e.g. pointer to
struct bt_value).
A Shared object type is defined by inheriting from _SharedObject. It
wraps and owns a reference to a Babeltrace object that is reference
counted. The reference count is dropped when the Python object gets
deleted. The _SharedObject base class defines two class methods,
_get_ref and _put_ref, which must be implemented by subclasses. These
implementations must respectively get and put a reference of the
specialized pointer (_ptr) they wrap.
A Unique object type is defined by inheriting from _UniqueObject. It is
not refcounted. Rather, it is wholly owned by another object (the
owner) that is itself refcounted. A Unique object, in the Babeltrace
API, is destroyed when its parent is destroyed. There is therefore a
risk that someone would keep a (Python) reference to a unique object
that got destroyed, because its parent got destroyed, resulting in some
use-after-free bug. To avoid this, we make it so that when a Python
object representing a Babeltrace Unique object is created, that Python
object obtains a reference on the owner Shared object. When the Unique
Python object is destroyed, the reference on the Shared parent is
dropped.
The concepts of Freezable and Private objects don't exist anymore, so
they are removed. I have also removed the _PrivateConnection class,
since it won't be needed in the end and inherited from _PrivateObject.
For other classes representing Babeltrace concepts, I have made them
inherit the object type they'll need to inherit in the end (when all the
Python bindings will be fixed), even though none of these classes is
functional at the moment.
Change-Id: I9ab743dd7a28407913945648c1d74c467550df14
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1021
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Wed, 1 May 2019 15:40:16 +0000 (11:40 -0400)]
Fix: string format warnings on 32 bits
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I49fdb170642bfd0c7326719f42973863af41c8e7
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1141
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:36:43 +0000 (11:36 -0400)]
Fix: unused-function warnings in lib/graph/iterator.c
clang warnings:
iterator.c:87:6: error: unused function '_set_self_comp_port_input_msg_iterator_state' [-Werror,-Wunused-function]
void _set_self_comp_port_input_msg_iterator_state(
^
iterator.c:885:6: error: unused function '_set_iterator_state_after_seeking' [-Werror,-Wunused-function]
void _set_iterator_state_after_seeking(
^
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia409f1dd696cdfed58de23aad926c4effdc26307
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1034
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:30:44 +0000 (11:30 -0400)]
Fix: may-uninitialized warning in trace-ir-metadata-field-class-copy.c
GCC warning:
In file included from ../../../include/babeltrace/common-internal.h:30:0,
from trace-ir-metadata-field-class-copy.c:31:
trace-ir-metadata-field-class-copy.c: In function ‘copy_field_class_content_internal’:
../../../include/babeltrace/trace-ir/field-class-const.h:196:3: error:
‘out_tag_field_class’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
bt_field_class_put_ref(_var); \
^~~~~~~~~~~~~~~~~~~~~~
trace-ir-metadata-field-class-copy.c:421:18: note: ‘out_tag_field_class’ was declared here
bt_field_class *out_tag_field_class;
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I73c6057f9795b153f95c1287f3f3f8e529328fbf
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1033
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:28:48 +0000 (11:28 -0400)]
Fix: maybe-uninitialized warnings in translate-trace-ir-to-ctf-ir.c
GCC warning example:
translate-trace-ir-to-ctf-ir.c:929:14: error: ‘struct_fc’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
named_fc = fs_sink_ctf_field_class_struct_borrow_member_by_index(
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct_fc, i);
~~~~~~~~~~~~~
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I24ba8095f26cec640e0a24473b4fee05d1c404af
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1032
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:24:11 +0000 (11:24 -0400)]
Fix: maybe-uninitialized warning in create_relative_field_ref()
translate-trace-ir-to-ctf-ir.c: In function ‘resolve_field_class’:
translate-trace-ir-to-ctf-ir.c:302:6: error: ‘tgt_fc_name’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
g_string_assign(tgt_field_ref,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tgt_fc_name);
~~~~~~~~~~~~
translate-trace-ir-to-ctf-ir.c:177:14: note: ‘tgt_fc_name’ was declared here
const char *tgt_fc_name;
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8d3398a852bf3ca412bb479eae72a81a3959d220
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1031
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:21:06 +0000 (11:21 -0400)]
Fix: unused-variable warnings in lib/graph/iterator.c
GCC warnings:
make[3]: Entering directory '/home/frdeso/projets/babeltrace/optimalize/lib/graph'
CC iterator.lo
iterator.c: In function ‘_set_iterator_state_after_seeking’:
iterator.c:889:59: error: variable ‘new_state’ set but not used [-Werror=unused-but-set-variable]
enum bt_self_component_port_input_message_iterator_state new_state = 0;
^~~~~~~~~
iterator.c: In function ‘find_message_ge_ns_from_origin’:
iterator.c:1159:59: error: unused variable ‘init_state’ [-Werror=unused-variable]
enum bt_self_component_port_input_message_iterator_state init_state =
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia14a89f330198e4109af14f755aeed3378912256
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1030
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:15:27 +0000 (11:15 -0400)]
Fix: maybe-uninitialized warning in bt_ctf_stream_flush()
GCC warning:
In file included from ../../include/babeltrace/ctf-writer/fields-internal.h:41:0,
from ../../include/babeltrace/ctf-writer/field-wrapper-internal.h:26,
from ../../include/babeltrace/ctf-writer/event-internal.h:37,
from stream.c:32:
stream.c: In function ‘bt_ctf_stream_flush’:
../../include/babeltrace/ctfser-internal.h:568:36: error:
‘packet_context_offset_bits’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
ctfser->offset_in_cur_packet_bits = offset_bits;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
stream.c:1608:11: note: ‘packet_context_offset_bits’ was declared here
uint64_t packet_context_offset_bits;
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia7457b1a444290ba1a71459bfaf707812227899c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1029
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 15:13:35 +0000 (11:13 -0400)]
Fix: unused-variable warnings in bt_X_freeze() when not in DEV_MODE
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Idf9e91b2abd9b2720343917c2d3ffdf207f82735
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1028
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Tue, 30 Apr 2019 17:51:03 +0000 (13:51 -0400)]
Fix: src.ctf.fs: metadata-info: sanitize `path` param
Issue
=====
Omitting to pass the mandatory `path` parameter to the `metadata-info`
query results in a BT_ASSERT() failure when calling
bt_value_get_string(), or a NULL pointer dereference in non-DEV_MODE.
Similarly, setting the `path` to a non-string value would also result in
a BT_ASSERT() failure, or a invalid memory access in non-DEV_MODE
Solution
========
Confirm that the `path` parameter is present and is of the string type and
print error messages accordingly it's not.
Known drawbacks
===============
None.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8182de2797c375262d77a4a8961bedb4c5ef9578
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1081
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Francis Deslauriers [Wed, 1 May 2019 02:07:38 +0000 (22:07 -0400)]
Fix: flt.lttng-utils.debug-info: extra colon in `bin` member
There is an extra ':' character in the `bin` member of the `debug-info`
field.
Example of the issue from the tests:
debug_info = { bin = "libhello_so:+0x15a6", func = "bar+0xa9", src =
"libhello.c:13" }
The "libhello_so:+0x15a6" will now be printed "libhello_so+0x15a6".
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ie7c4ea54e534eeb8a1bdd503760b791a01aa9594
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1129
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 30 Apr 2019 22:29:01 +0000 (18:29 -0400)]
debug info: Skip test that depends on Python bindings
This test depends on the Python bindings, which don't work right now.
Skip it, so that it doesn't cause a "make check" failure while we are
repairing the bindings.
Change-Id: I8e9b1092e2794875b249b060581f4305be640a88
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1126
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 30 Apr 2019 22:00:43 +0000 (18:00 -0400)]
babeltrace: Remove leftovers
It seems like these files should have been removed when removing the
babeltrace Python bindings in commit
1c81bd8895c0 ("Remove babeltrace 1 Python bindings and tests")
Right now, the test causes a "make check" failure, because it tries to
import the babeltrace Python package, which no longer exists.
Change-Id: Ied4871ec23444776fca601b6f78b583ef8137c81
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1125
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Tue, 30 Apr 2019 21:52:12 +0000 (17:52 -0400)]
doc: Make python bindings doc build
Babeltrace 1 Python bindings (the babeltrace package) were removed in
commit
1c81bd8895c0 ("Remove babeltrace 1 Python bindings and tests")
However, the Python doc still references it. It tries to import it to
get the version, and therefore fails to build. Update it to import the
bt2 package instead.
Change-Id: I656a89ad83069f6794abf4c775a14fb9be2ecba0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1124
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 8 Apr 2019 16:53:56 +0000 (12:53 -0400)]
python-plugin-provider: Make it build
This patch fixes building with --enable-python-plugins.
One problem is that the python plugin provider uses some
functions coming from the internal headers of the lib, which use some
logging functions that are internal to the lib, but not included by
those internal headers. Trying to add the relevant include file
(lib-logging-internal.h) conflicts with python-plugin-provider's own
logger.
python-plugin-provider doesn't really need to have its own logger. Even
though it is built as a separate shared object (so that we can package
it separately), it can be considered as internal to the library (and
that's why it includes some internal lib headers). Therefore, the
easiest way to fix this is to get rid of its logger and make the lib
header files that use lib logging include the required header file
(lib-logging-internal.h).
This requires the python-plugin-provider shared object to access a few
additional symbols not currently exposed by libbabeltrace, which
requires the removal of a few BT_HIDDEN.
I have also included fixes to the python-plugin-provider which I have
on hand. However, it won't work until the Python bindings are up and
running, so I have marked it as skipped.
Change-Id: I9b46d91fc635d670fef2e4d3c8b32203ec34443f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1101
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Simon Marchi [Mon, 29 Apr 2019 21:03:44 +0000 (17:03 -0400)]
Remove clock_class_priority_map.py
This concept no longer exists in the BT api, and therefore this file
won't be needed anymore.
Change-Id: Ib298f5463ee701be3a0a5b3d4b37b6e7ecf8d5b3
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452469
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.055526 seconds and 4 git commands to generate.