Skip to content

Commit 27e08ba

Browse files
committed
tracetool: work around ust <sys/sdt.h> include conflict
Both the dtrace and ust backends may include <sys/sdt.h> but LTTng Userspace Tracer 2.11 and later requires SDT_USE_VARIADIC to be defined before including the header file. This is a classic problem with C header files included from different parts of a program. If the same header is included twice within the same compilation unit then the first inclusion determines the macro environment. Work around this by defining SDT_USE_VARIADIC in the dtrace backend too. It doesn't hurt and fixes a missing STAP_PROBEV() compiler error when the ust backend is enabled together with the dtrace backend. Signed-off-by: Stefan Hajnoczi <[email protected]> Message-id: [email protected] Signed-off-by: Stefan Hajnoczi <[email protected]>
1 parent 7623b5b commit 27e08ba

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/tracetool/backend/dtrace.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ def generate_h_begin(events, group):
4040
else:
4141
header = "trace-dtrace.h"
4242

43+
# Workaround for ust backend, which also includes <sys/sdt.h> and may
44+
# require SDT_USE_VARIADIC to be defined. If dtrace includes <sys/sdt.h>
45+
# first without defining SDT_USE_VARIADIC then ust breaks because the
46+
# STAP_PROBEV() macro is not defined.
47+
out('#define SDT_USE_VARIADIC 1')
48+
4349
out('#include "%s"' % header,
4450
'')
4551

0 commit comments

Comments
 (0)