提交 f9bbba95 编写于 作者: S Stefan Hajnoczi

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: NEric Auger <eric.auger@linaro.org>
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
Message-id: 1411468626-20450-1-git-send-email-stefanha@redhat.com
上级 44e7ebb8
...@@ -139,8 +139,8 @@ class Event(object): ...@@ -139,8 +139,8 @@ class Event(object):
""" """
_CRE = re.compile("((?P<props>.*)\s+)?" _CRE = re.compile("((?P<props>[\w\s]+)\s+)?"
"(?P<name>[^(\s]+)" "(?P<name>\w+)"
"\((?P<args>[^)]*)\)" "\((?P<args>[^)]*)\)"
"\s*" "\s*"
"(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?" "(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册