qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-event


From: Stefan Hajnoczi
Subject: [Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-events format strings
Date: Tue, 22 May 2012 17:03:02 +0100

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 <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]