Actions
Bug #1273
closedCannot use a #defined TRACEPOINT_PROVIDER name with TRACEPOINT_EVENT_{CLASS,INSTANCE}() macros
Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
06/14/2020
Due date:
% Done:
100%
Estimated time:
Description
It doesn't seem to be possible to use a provider name that was #defined if using the TRACEPOINT_EVENT_{CLASS,INSTANCE}() macros, e.g.:
// + all the boilerplate code
#define TRACEPOINT_PROVIDER my_provider
TRACEPOINT_EVENT_CLASS(
TRACEPOINT_PROVIDER,
my_class,
TP_ARGS(
const void *, some_arg
),
TP_FIELDS(
ctf_integer_hex(const void *, whatever, some_arg)
)
)
TRACEPOINT_EVENT_INSTANCE(
TRACEPOINT_PROVIDER,
my_class,
my_tracepoint_does_not_work,
TP_ARGS(
const void *, some_arg
)
)
In my case, I had:
- a shared lib providing the tracepoints
- an application linking against the above lib
When compiling, it fails on the app and not the lib.
It expected this to work because it works when using the simpler TRACEPOINT_EVENT() macro. However, if I use my_provider directly instead of TRACEPOINT_PROVIDER, it works.
I've reproduced this on master.
Here's a MWE: https://github.com/christophebedard/lttng-tracepoint-provider-name-define-mwe
Updated by Christophe Bedard over 4 years ago
Fix attempt: https://review.lttng.org/c/lttng-ust/+/3640
Updated by Christophe Bedard over 4 years ago
Compilation error:
gcc -I/home/chris/lttng-tracepoint-provider-name-define-mwe/app/../lib -c myapp.c gcc -o myapp myapp.o -L/home/chris/lttng-tracepoint-provider-name-define-mwe/app/../lib -Wl,-rpath=/home/chris/lttng-tracepoint-provider-name-define-mwe/app/../lib -lmytps -ldl /usr/bin/ld: /home/chris/lttng-tracepoint-provider-name-define-mwe/app/../lib/libmytps.so: undefined reference to `__tracepoint_provider_mismatch_TRACEPOINT_PROVIDER' collect2: error: ld returned 1 exit status make: *** [Makefile:9: myapp] Error 1
Updated by Christophe Bedard almost 4 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset lttng-ust|f8021d088ed27ede5af620702468a8cf4647b7fc.
Actions