qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1.1 0/2] tracing: QEMU 1.1-rc3+ fixes
@ 2012-05-22 16:03 Stefan Hajnoczi
  2012-05-22 16:03 ` [Qemu-devel] [PATCH 1.1 1/2] simpletrace: skip disabled trace event numbering Stefan Hajnoczi
  2012-05-22 16:03 ` [Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-events format strings Stefan Hajnoczi
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-05-22 16:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Lluís Vilanova, Stefan Hajnoczi

Two issues have been reported with the new tracetool Python rewrite:

1. Using parenthesis in ./trace-events format strings produces an exception
   from tracetool.py.

2. The 'simple' trace backend event numbering is wrong when the ./trace-events
   file contains disabled events (this is the case by default).

These patches fix these issues.

Stefan Hajnoczi (2):
  simpletrace: skip disabled trace event numbering
  tracetool: allow parenthesis in trace-events format strings

 scripts/simpletrace.py        |    5 +++--
 scripts/tracetool/__init__.py |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

-- 
1.7.10

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

* [Qemu-devel] [PATCH 1.1 1/2] simpletrace: skip disabled trace event numbering
  2012-05-22 16:03 [Qemu-devel] [PATCH 1.1 0/2] tracing: QEMU 1.1-rc3+ fixes Stefan Hajnoczi
@ 2012-05-22 16:03 ` Stefan Hajnoczi
  2012-05-22 16:03 ` [Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-events format strings Stefan Hajnoczi
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-05-22 16:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Lluís Vilanova, Stefan Hajnoczi

The simple trace code generator has been rewritten for QEMU 1.1 and now
assigns event numbers only to enabled events.  This means we must skip
disabled events when pretty-printing traces in simpletrace.py.

Note this means old binary traces may be pretty printed incorrectly
since they use a different event numbering when the "disable" keyword is
present in ./trace-events.  It's unfortunate but not easy to avoid at
this stage.  Always use the simpletrace.py that came with the QEMU
binary to ensure correctly pretty-printing.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 scripts/simpletrace.py |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
index f55e5e6..db39b02 100755
--- a/scripts/simpletrace.py
+++ b/scripts/simpletrace.py
@@ -37,8 +37,9 @@ def parse_events(fobj):
             continue
 
         disable, name, args = m.groups()
-        events[event_num] = (name,) + get_argnames(args)
-        event_num += 1
+        if not disable:
+            events[event_num] = (name,) + get_argnames(args)
+            event_num += 1
     return events
 
 def read_record(fobj):
-- 
1.7.10

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

* [Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-events format strings
  2012-05-22 16:03 [Qemu-devel] [PATCH 1.1 0/2] tracing: QEMU 1.1-rc3+ fixes Stefan Hajnoczi
  2012-05-22 16:03 ` [Qemu-devel] [PATCH 1.1 1/2] simpletrace: skip disabled trace event numbering Stefan Hajnoczi
@ 2012-05-22 16:03 ` Stefan Hajnoczi
  2012-05-22 18:06   ` Lluís Vilanova
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-05-22 16:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Lluís Vilanova, Stefan Hajnoczi

The regular expression used to parse ./trace-events fails on the
following input:

  test_paren(int n) "(%d)"

The problem is that the regular expression uses greedy matching and '"'
becomes the name of the event while 'test_paren(int n) ' becomes the
properties of the event.

Prevent greedy matching from going too far by explicitly saying the name
cannot have a '"'.  This forces the regular expression engine to
backtrack to the desired match.

Reported-by: Bob Breuer <breuerr@mc.net>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 scripts/tracetool/__init__.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 175df08..148f553 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -120,7 +120,7 @@ class Event(object):
         The event arguments.
     """
 
-    _CRE = re.compile("((?P<props>.*)\s+)?(?P<name>[^(\s]+)\((?P<args>[^)]*)\)\s*(?P<fmt>\".*)?")
+    _CRE = re.compile("((?P<props>.*)\s+)?(?P<name>[^\"(\s]+)\((?P<args>[^)]*)\)\s*(?P<fmt>\".*)?")
 
     _VALID_PROPS = set(["disable"])
 
-- 
1.7.10

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

* Re: [Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-events format strings
  2012-05-22 16:03 ` [Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-events format strings Stefan Hajnoczi
@ 2012-05-22 18:06   ` Lluís Vilanova
  0 siblings, 0 replies; 4+ messages in thread
From: Lluís Vilanova @ 2012-05-22 18:06 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

Stefan Hajnoczi writes:

> The regular expression used to parse ./trace-events fails on the
> following input:

>   test_paren(int n) "(%d)"

> The problem is that the regular expression uses greedy matching and '"'
> becomes the name of the event while 'test_paren(int n) ' becomes the
> properties of the event.

> Prevent greedy matching from going too far by explicitly saying the name
> cannot have a '"'.  This forces the regular expression engine to
> backtrack to the desired match.

> Reported-by: Bob Breuer <breuerr@mc.net>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

Reviewed-by: Lluís Vilanova <vilanova@ac.upc.edu>


> ---
>  scripts/tracetool/__init__.py |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
> index 175df08..148f553 100644
> --- a/scripts/tracetool/__init__.py
> +++ b/scripts/tracetool/__init__.py
> @@ -120,7 +120,7 @@ class Event(object):
>          The event arguments.
>      """
 
> -    _CRE = re.compile("((?P<props>.*)\s+)?(?P<name>[^(\s]+)\((?P<args>[^)]*)\)\s*(?P<fmt>\".*)?")
> +    _CRE = re.compile("((?P<props>.*)\s+)?(?P<name>[^\"(\s]+)\((?P<args>[^)]*)\)\s*(?P<fmt>\".*)?")
 
>      _VALID_PROPS = set(["disable"])
 
> -- 
> 1.7.10


-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth

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

end of thread, other threads:[~2012-05-22 18:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-22 16:03 [Qemu-devel] [PATCH 1.1 0/2] tracing: QEMU 1.1-rc3+ fixes Stefan Hajnoczi
2012-05-22 16:03 ` [Qemu-devel] [PATCH 1.1 1/2] simpletrace: skip disabled trace event numbering Stefan Hajnoczi
2012-05-22 16:03 ` [Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-events format strings Stefan Hajnoczi
2012-05-22 18:06   ` Lluís Vilanova

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).