Skip to content

Commit

Permalink
tracetool: carefully define SDT_USE_VARIADIC
Browse files Browse the repository at this point in the history
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.

Fixes: 27e08ba ("tracetool: work around ust <sys/sdt.h> include conflict")
Signed-off-by: Stefan Hajnoczi <[email protected]>
Message-id: [email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
  • Loading branch information
stefanhaRH committed Jul 30, 2020
1 parent 1b7157b commit 0008224
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/tracetool/backend/dtrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0008224

Please sign in to comment.