Babeltrace python binding

The Babeltrace Python module can be used to directly control
the Babeltrace API inside Python, using 'import babeltrace'.

Therefore, it becomes possible to create a Context, add a
trace to it, iterate on it, read events and so on from
within Python.

SWIG >= 2.0 is used to create the wrapper and its
'warning md variable unused' bug is patched in Makefile.am

In the interface file, struct and enum are directly copied
from the include files. All changes to struct bt_iter_pos
and to enums in ctf/events.h and clock-types.h  must also
be made in the interface file.

Signed-off-by: Danny Serres <danny.serres@efficios.com>
Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Merge branch 'master' into bindings/python
Merge branch 'master' into bindings/python

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: Python bindings build fix. Reflects SEEK_END API change.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Merge branch 'master' into bindings/python
Fix: Mismatching function signatures used by python bindings

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: Python 3 binding compatibility and clean intermediate files.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: Removed Python bindings to static constructor and destructor.

Resolves an undefined symbol on Python module load.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: Double free when calling bt_context_remove_trace()

ctf_close_trace was being called twice when calling
bt_context_remove_trace thus causing free() to be called on an invalid
pointer.

Calling bt_context_remove_trace() would call ctf_close_trace() once via
the close_handle callback registered on the ctf format struct and a
second call would take place from bt_trace_handle_destroy() which is
registered as the value_destroy_func on the trace_handles hash table of
the current context.

bt_trace_handle_destroy() now only deallocates the trace handle and does
not perform the trace closing. This makes the
bt_trace_handle_create/destroy and bt_context_add/remove_trace parts of
the public API symmetric.

The crash is reproducible by invoking the tests-python.py script.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: Unified types expected by the Definition Python interface.

This change makes the Python iterator test case execute successfully.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: Added a null pointer check to bt_ctf_field_name

This function is called indirectly when calling __repr__ (print) in the
python bindings on the definition object returned by the
get_top_level_scope method thus resulting in a segmentation fault when
the name attribute is not set.

Fixes #373

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Added Python 3.0 or better requirement to the README file

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Added Python interpreter version directives and reorganized example scripts

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Remove extra -I for python bindings

Same fix as for lttng-tools commit f7cbc765ad2526667f1f20b3a89c596b3422ac34

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Merge branch 'master' into bindings/python

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Make python bindings compile with trunk

Signed-off-by: Xiaona Han <xiaonahappy13@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add bt_unregister_format function support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Test for presence of bison and flex when building from git

Fixes #74

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Put the libbabeltrace-ctf specific parts of babeltrace.pc into a babeltrace-ctf.pc file

On some distributions libbabeltrace and libbabeltrace-ctf are packaged
into separate packages. This means they should have their own pkg-config
file.

The babeltrace-ctf.pc file requires the babeltrace.pc one.

With this change, to have the ctf support in libbabeltrace a pkg-config
user will need to specify the babeltrace-ctf package. To compile and
link with only the base libbabeltrace, the package babeltrace would be
used.

Fixes #550

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add missing lex/bison generated files to make clean

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>