Wind River Support Network

HomeDefectsLIN9-5838
Fixed

LIN9-5838 : LTTNG TRACELOG_LOGLEVEL doesn't work when compiling for C++

Created: Nov 23, 2017    Updated: Dec 3, 2018
Resolved Date: Nov 29, 2017
Previous ID: LIN8-8233
Found In Version: 9.0.0.12
Fix Version: 9.0.0.13
Severity: Standard
Applicable for: Wind River Linux 9
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:
#setup.sh --machine=qemux86-64 --all-layers --dl-layers
#echo 'IMAGE_INSTALL_append = " git gdb gdbserver gcc lttng-tools-dev lttng-ust-dev" ' >> conf/local.conf
#bitbake wrlinux-image-glibc-std
#runqemu qemux86-64
 
2. add the files here https://github.com/lttng/lttng-ust/tree/master/doc/examples/easy-ust  on the rootfs (target)
 
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