All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-5.1] tracetool: carefully define SDT_USE_VARIADIC
@ 2020-07-29 15:39 Stefan Hajnoczi
  2020-07-30 15:02 ` Stefan Hajnoczi
  2020-07-30 16:16 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2020-07-29 15:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi

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: 27e08bab94f7c6ebe0b75938c98c394c969e3fd8 ("tracetool: work around ust <sys/sdt.h> include conflict")
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 scripts/tracetool/backend/dtrace.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
index b7fe4c1b50..fc0c8fc52f 100644
--- a/scripts/tracetool/backend/dtrace.py
+++ b/scripts/tracetool/backend/dtrace.py
@@ -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:
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH for-5.1] tracetool: carefully define SDT_USE_VARIADIC
  2020-07-29 15:39 [PATCH for-5.1] tracetool: carefully define SDT_USE_VARIADIC Stefan Hajnoczi
@ 2020-07-30 15:02 ` Stefan Hajnoczi
  2020-07-30 16:16 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2020-07-30 15:02 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

On Wed, Jul 29, 2020 at 04:39:26PM +0100, Stefan Hajnoczi wrote:
> 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: 27e08bab94f7c6ebe0b75938c98c394c969e3fd8 ("tracetool: work around ust <sys/sdt.h> include conflict")
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH for-5.1] tracetool: carefully define SDT_USE_VARIADIC
  2020-07-29 15:39 [PATCH for-5.1] tracetool: carefully define SDT_USE_VARIADIC Stefan Hajnoczi
  2020-07-30 15:02 ` Stefan Hajnoczi
@ 2020-07-30 16:16 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-30 16:16 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel

On 7/29/20 5:39 PM, Stefan Hajnoczi wrote:
> 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: 27e08bab94f7c6ebe0b75938c98c394c969e3fd8 ("tracetool: work around ust <sys/sdt.h> include conflict")
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  scripts/tracetool/backend/dtrace.py | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/scripts/tracetool/backend/dtrace.py b/scripts/tracetool/backend/dtrace.py
> index b7fe4c1b50..fc0c8fc52f 100644
> --- a/scripts/tracetool/backend/dtrace.py
> +++ b/scripts/tracetool/backend/dtrace.py
> @@ -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:
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-30 16:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 15:39 [PATCH for-5.1] tracetool: carefully define SDT_USE_VARIADIC Stefan Hajnoczi
2020-07-30 15:02 ` Stefan Hajnoczi
2020-07-30 16:16 ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.