Wind River Support Network

HomeDefectsLIN8-8232
Fixed

LIN8-8232 : LTTNG TRACELOG_LOGLEVEL doesn't work when compiling for C++

Created: Nov 22, 2017    Updated: Dec 3, 2018
Resolved Date: Nov 30, 2017
Found In Version: 8.0.0.22
Fix Version: 8.0.0.24
Severity: Standard
Applicable for: Wind River Linux 8
Component/s: Userspace

Description

The TRACELOG_LOGLEVEL doesn't work when compiling for C++ using the gcc toolchain. The events all end up as TRACE_DEBUG_LINE.

A possible fix would be to integrate these 2 patches from upstream. 
https://bugs.lttng.org/projects/lttng-ust/repository/revisions/4ea4f80e8c57628907b035bd1a0372f7b8faec51/diff
https://bugs.lttng.org/projects/lttng-ust/repository/revisions/082802f9e5efe64195520826743ea9c23e4ea1b7/diff

Steps to Reproduce

1. Configure and build a project with:
configure --enable-reconfig --with-board=qemux86-64 --enable-kernel=standard --enable-rootfs=glibc-small+gdb+gdbserver+lttng+target-toolchain --with-package=lttng-tools-dev,lttng-ust-dev --enable-build=production 
 
2. add the files here https://github.com/lttng/lttng-ust/tree/master/doc/examples/easy-ust  on the rootfs
 
3. compile and collect an lttng trace with gcc
$cd doc/examples/easy-ust/ 
$ gcc -DTRACEPOINT_PROBE_DYNAMIC_LINKAGE -I. -c -o sample.o sample.c
$ gcc -fPIC -I. -c -o tp.o tp.c
$ gcc -I. -shared -o libtp.so tp.o
$ gcc -o sample sample.o -ldl -llttng-ust -L. -ltp
$ cp libtp.so /lib64/ 
$ lttng create
$ lttng enable-event -u -a
$ lttng start
$ ./sample
$ lttng stop
$ lttng view -e "babeltrace -n none --clock-date --clock-gmt --no-delta -f loglevel" | head -n 30

This will show multiple lines similar to: 
[2017-11-22 07:31:29.780935673] TRACE_WARNING (4) sample_component:message: { 0 }, { "Hello World" }
 
4. Repeat the process above with g++ instead of gcc
$cd doc/examples/easy-ust/
$ g++ -DTRACEPOINT_PROBE_DYNAMIC_LINKAGE -I. -c -o sample.o sample.c
$ g++ -fPIC -I. -c -o tp.o tp.c
$ g++ -I. -shared -o libtp.so tp.o
$ g++ -o sample sample.o -ldl -llttng-ust -L. -ltp
$ cp libtp.so /lib64/ 
$ lttng create
$ lttng enable-event -u -a
$ lttng start
$ ./sample
$ lttng stop
$ lttng view -e "babeltrace -n none --clock-date --clock-gmt --no-delta -f loglevel" | head -n 30

This will show multiple lines similar to: 
[2017-11-22 08:56:19.012379654] TRACE_DEBUG_LINE (13) sample_component:message: { 0 }, { "Hello World" }

Other Downloads


Live chat
Online