From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: "Lluís Vilanova" <vilanova@ac.upc.edu>,
"Stefan Hajnoczi" <stefanha@linux.vnet.ibm.com>
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 [thread overview]
Message-ID: <1337702582-26368-3-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
In-Reply-To: <1337702582-26368-1-git-send-email-stefanha@linux.vnet.ibm.com>
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
next prev parent reply other threads:[~2012-05-22 16:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2012-05-22 18:06 ` [Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-events format strings Lluís Vilanova
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337702582-26368-3-git-send-email-stefanha@linux.vnet.ibm.com \
--to=stefanha@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=vilanova@ac.upc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).