[lttng-dev] [RFC PATCH lttng-ust] Fix: don't generate 0-len array in tracepoint probes

Sebastien Boisvert sboisvert at gydle.com
Mon May 30 18:08:22 UTC 2016


Greetings,

This is a response to the message https://lists.lttng.org/pipermail/lttng-dev/2016-May/026066.html

The builds below were generated with:

lttng-ust ba5b4491f94109eaca10b2c285f8d1f116a38e5c
gcc 4.9.3-8ubuntu2~14.04

First, I compiled lttng-ust with the "-pedantic" option of gcc to verify that this causes an array
of compilation errors.

sboisvert at Z1:~/lttng-ust$ ./bootstrap
sboisvert at Z1:~/lttng-ust$ ./configure --prefix=$HOME/lttng-ust.build
sboisvert at Z1:~/lttng-ust$ make CFLAGS="-pedantic" &> log
sboisvert at Z1:~/lttng-ust$ grep error log
 //#error UST_COMPONENT is undefined
../include/lttng/ust-tracepoint-event.h:291:40: error: zero or negative size array '__event_fields___lttng_ust_statedump___start'
../include/lttng/ust-tracepoint-event.h:291:40: error: zero or negative size array '__event_fields___lttng_ust_statedump___end'


I applied the patch that Mathieu provided, and built the project and ran the tests.

sboisvert at Z1:~/lttng-ust$ patch -p1 < ~/lttng-ust-empty-array.patch 
patching file include/lttng/ust-tracepoint-event.h

sboisvert at Z1:~/lttng-ust$ make CFLAGS="-pedantic" &> log
sboisvert at Z1:~/lttng-ust$ cd tests

============================================================================
Testsuite summary for lttng-ust 2.9.0-pre
============================================================================
# TOTAL: 51
# PASS:  51
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================


So, this patch improves the user experience when one is using advanced linting flags as well as
tracepoint event probes with no arguments, and it does not break the envelope of known behaviour.


+1


More information about the lttng-dev mailing list