diff mbox series

[2/2] trace: avoid SystemTap dtrace(1) warnings on empty files

Message ID 20190321170831.6539-3-stefanha@redhat.com (mailing list archive)
State New, archived
Headers show
Series trace: fix compilation issues for QEMU 4.0.0 | expand

Commit Message

Stefan Hajnoczi March 21, 2019, 5:08 p.m. UTC
target/hppa/trace-events only contains disabled events, resulting in a
trace-dtrace.dtrace file that says "provider qemu {}".  SystemTap's
dtrace(1) tool prints a warning when processing this input file.

This patch avoids the error by emitting an empty file instead of
"provider qemu {}" when there are no enabled trace events.

Fixes: 23c3d569f44284066714ff7c46bc4f19e630583f ("target/hppa: add TLB trace events")
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 scripts/tracetool/format/d.py | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Markus Armbruster March 21, 2019, 6:30 p.m. UTC | #1
Stefan Hajnoczi <stefanha@redhat.com> writes:

> target/hppa/trace-events only contains disabled events, resulting in a
> trace-dtrace.dtrace file that says "provider qemu {}".  SystemTap's
> dtrace(1) tool prints a warning when processing this input file.
>
> This patch avoids the error by emitting an empty file instead of
> "provider qemu {}" when there are no enabled trace events.
>
> Fixes: 23c3d569f44284066714ff7c46bc4f19e630583f ("target/hppa: add TLB trace events")
> Reported-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  scripts/tracetool/format/d.py | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py
> index 78397c24d2..c7cb2a93a6 100644
> --- a/scripts/tracetool/format/d.py
> +++ b/scripts/tracetool/format/d.py
> @@ -33,6 +33,11 @@ def generate(events, backend, group):
>      events = [e for e in events
>                if "disable" not in e.properties]
>  
> +    # SystemTap's dtrace(1) warns about empty "provider qemu {}" but is happy
> +    # with an empty file.  Avoid the warning.
> +    if not events:
> +        return
> +
>      out('/* This file is autogenerated by tracetool, do not edit. */'
>          '',
>          'provider qemu {')

Results in an empty file.  I'm fine with that.  I'd also be fine with a
file that just has the comment.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Liam Merwick March 21, 2019, 6:36 p.m. UTC | #2
On 21/03/2019 17:08, Stefan Hajnoczi wrote:
> target/hppa/trace-events only contains disabled events, resulting in a
> trace-dtrace.dtrace file that says "provider qemu {}".  SystemTap's
> dtrace(1) tool prints a warning when processing this input file.
>
> This patch avoids the error by emitting an empty file instead of
> "provider qemu {}" when there are no enabled trace events.
>
> Fixes: 23c3d569f44284066714ff7c46bc4f19e630583f ("target/hppa: add TLB trace events")
> Reported-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


Reviewed-by: Liam Merwick <liam.merwick@oracle.com>


> ---
>   scripts/tracetool/format/d.py | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py
> index 78397c24d2..c7cb2a93a6 100644
> --- a/scripts/tracetool/format/d.py
> +++ b/scripts/tracetool/format/d.py
> @@ -33,6 +33,11 @@ def generate(events, backend, group):
>       events = [e for e in events
>                 if "disable" not in e.properties]
>   
> +    # SystemTap's dtrace(1) warns about empty "provider qemu {}" but is happy
> +    # with an empty file.  Avoid the warning.
> +    if not events:
> +        return
> +
>       out('/* This file is autogenerated by tracetool, do not edit. */'
>           '',
>           'provider qemu {')
diff mbox series

Patch

diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py
index 78397c24d2..c7cb2a93a6 100644
--- a/scripts/tracetool/format/d.py
+++ b/scripts/tracetool/format/d.py
@@ -33,6 +33,11 @@  def generate(events, backend, group):
     events = [e for e in events
               if "disable" not in e.properties]
 
+    # SystemTap's dtrace(1) warns about empty "provider qemu {}" but is happy
+    # with an empty file.  Avoid the warning.
+    if not events:
+        return
+
     out('/* This file is autogenerated by tracetool, do not edit. */'
         '',
         'provider qemu {')