tracetool: carefully define SDT_USE_VARIADIC
PATCH 1/1 tracetool: carefully define SDT_USE_VARIADIC
The dtrace backend defines SDT_USE_VARIADIC as a workaround for a conflict with a LTTng UST header file, which requires SDT_USE_VARIADIC to be defined.
LTTng UST <lttng/tracepoint.h> breaks if included after generated dtrace headers because SDT_USE_VARIADIC will already be defined:
#ifdef LTTNG_UST_HAVE_SDT_INTEGRATION #define SDT_USE_VARIADIC <-- error, it's already defined #include <sys/sdt.h>
Be more careful when defining SDT_USE_VARIADIC. This fixes the build when both the dtrace and ust tracers are enabled at the same time.
--- scripts/tracetool/backend/dtrace.py | 4 ++++ 1 file changed, 4 insertions(+)
scripts/tracetool/backend/dtrace.py +4 -0
@@ -44,11 +44,15 @@ def generate_h_begin(events, group): # require SDT_USE_VARIADIC to be defined. If dtrace includes <sys/sdt.h> # first without defining SDT_USE_VARIADIC then ust breaks because the # STAP_PROBEV() macro is not defined. + out('#ifndef SDT_USE_VARIADIC') out('#define SDT_USE_VARIADIC 1') + out('#endif') out('#include "%s"' % header, '') + out('#undef SDT_USE_VARIADIC') + # SystemTap defines <provider>_<name>_ENABLED() but other DTrace # implementations might not. for e in events:
Signature · 1 line
2.26.2
Stefan Hajnoczi
AppliedQuoted 11 lines · Stefan Hajnoczi
The dtrace backend defines
SDT_USE_VARIADICas a workaround for a conflict with a LTTng UST header file, which requiresSDT_USE_VARIADICto be defined.LTTng UST <
lttng/tracepoint.h> breaks if included after generated dtrace headers becauseSDT_USE_VARIADICwill already be defined:#ifdef LTTNG_UST_HAVE_SDT_INTEGRATION #define SDT_USE_VARIADIC <-- error, it's already defined #include <sys/sdt.h>
Quoted 8 lines
Be more careful when defining
SDT_USE_VARIADIC. This fixes the build when both the dtrace and ust tracers are enabled at the same time.Fixes 27e08bab94f7c6ebe0b75938c98c394c969e3fd8 ("tracetool: work around ust <sys/sdt.h> include conflict")Signed-off-by Stefan Hajnoczi <[email protected]>--- scripts/tracetool/backend/dtrace.py | 4 ++++ 1 file changed, 4 insertions(+)
Thanks, applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing
Stefan
Quoted 31 lines · Stefan Hajnoczi
The dtrace backend defines
SDT_USE_VARIADICas a workaround for a conflict with a LTTng UST header file, which requiresSDT_USE_VARIADICto be defined.LTTng UST <
lttng/tracepoint.h> breaks if included after generated dtrace headers becauseSDT_USE_VARIADICwill already be defined:#ifdef LTTNG_UST_HAVE_SDT_INTEGRATION #define SDT_USE_VARIADIC <-- error, it's already defined #include <sys/sdt.h>Be more careful when defining
SDT_USE_VARIADIC. This fixes the build when both the dtrace and ust tracers are enabled at the same time.Fixes 27e08bab94f7c6ebe0b75938c98c394c969e3fd8 ("tracetool: work around ust <sys/sdt.h> include conflict")Signed-off-by Stefan Hajnoczi <[email protected]>--- scripts/tracetool/backend/dtrace.py | 4 ++++ 1 file changed, 4 insertions(+)scripts/tracetool/backend/dtrace.py +1
-0@@ -44,11 +44,15 @@ def generate_h_begin(events, group): # require SDT_USE_VARIADIC to be defined. If dtrace includes <sys/sdt.h> # first without defining SDT_USE_VARIADIC then ust breaks because the # STAP_PROBEV() macro is not defined. + out('#ifndef SDT_USE_VARIADIC') out('#define SDT_USE_VARIADIC 1')
scripts/tracetool/backend/dtrace.py def generate_h_begin(events, group): · line 58
Quoted 10 lines
scripts/tracetool/backend/dtrace.py +3
-0+ out('#endif') out('#include "%s"' % header, '') + out('#undef SDT_USE_VARIADIC') + # SystemTap defines <provider>_<name>_ENABLED() but other DTrace # implementations might not. for e in events: