aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2014-09-23 11:37:06 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2014-09-26 09:34:38 +0100
commitf9bbba95691a2b4c14079e32c652b950bd474a33 (patch)
treec92b6a8e5a8b1faa3d186d290eb74022dac5a7e5
parent44e7ebb8bba5fd391b96c5011c17ae28e0a9c6ea (diff)
trace: tighten up trace-events regex to fix bad parse
Use \w for properties and trace event names since they are both drawn from [a-zA-Z0-9_] character sets. The .* for matching properties was too aggressive and caused the following failure with foo(int rc) "(this is a test)": Traceback (most recent call last): File "scripts/tracetool.py", line 139, in <module> main(sys.argv) File "scripts/tracetool.py", line 134, in main binary=binary, probe_prefix=probe_prefix) File "scripts/tracetool/__init__.py", line 334, in generate events = _read_events(fevents) File "scripts/tracetool/__init__.py", line 262, in _read_events res.append(Event.build(line)) File "scripts/tracetool/__init__.py", line 225, in build return Event(name, props, fmt, args, arg_fmts) File "scripts/tracetool/__init__.py", line 185, in __init__ % ", ".join(unknown_props)) ValueError: Unknown properties: foo(int, rc) Cc: LluĂ­s Vilanova <vilanova@ac.upc.edu> Reported-by: Eric Auger <eric.auger@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1411468626-20450-1-git-send-email-stefanha@redhat.com
-rw-r--r--scripts/tracetool/__init__.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 854fb9e0dd..b9a08443fc 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -139,8 +139,8 @@ class Event(object):
"""
- _CRE = re.compile("((?P<props>.*)\s+)?"
- "(?P<name>[^(\s]+)"
+ _CRE = re.compile("((?P<props>[\w\s]+)\s+)?"
+ "(?P<name>\w+)"
"\((?P<args>[^)]*)\)"
"\s*"
"(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?"