[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-e
From: |
Lluís Vilanova |
Subject: |
Re: [Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-events format strings |
Date: |
Tue, 22 May 2012 20:06:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) |
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 <address@hidden>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Lluís Vilanova <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
--
"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