[lttng-dev] Unable to use libbabeltrace for trace reading in C program

Alexis Martin alexis.martin at inria.fr
Tue Feb 23 18:14:33 EST 2016


Hi,

I’m trying to use the babeltrace library to be able to load and read a CTF trace in a C program.

From the doc:

> In order to use libbabeltrace to read a trace, the first step is to create a
> context structure and to add a trace to it. This is done using the
> bt_context_create() and bt_context_add_trace() functions. As long as this
> context structure is allocated and the trace is valid, the trace can be
> manipulated by the library.


But for a simple program like this:

> #include <stdio.h>
> #include <babeltrace/context.h>
> 
> int main(void){
> 
>     struct bt_context *ctx = bt_context_create();
>     
>     int ret = bt_context_add_trace(ctx, "/home/alex/trace/ffmpeg/kernel/", "ctf", NULL, NULL, NULL);
> 
>     return ret;
> 
> }


I got the following error message:

> [error] [Context] Format "ctf" unknown.


and ret = -1.

The trace is a valide CTF trace that I can read using the babeltrace program.

I’m running a Debian with linux kernel 4.3
I compiled babeltrace from the git (branch master) earlier today, the babeltrace binary reports a version number : 2.0.0-pre
This behavior is the same if I use the Debian packages of the 1.3.1 version.

How can I solve this ?
Thanks,

—
Alexis Martin
PhD. Student
INRIA / LIG POLARIS-Team

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20160224/b8be9115/attachment.html>


More information about the lttng-dev mailing list