浏览代码

tracetool: Update argument format regex to non-greedy star

Using the greedy star matching, arguments like "...%"PRIx64 caused issues
for functions with multiple PRI formats.

The issue was only seen with the ust backend, as it is the only one
using the format regex.

The result for many functions was that the arguments coming after the
greedy star end was left out of the tracepoint, and in some cases some
of the arguments that was traced had the wrong format.

Signed-off-by: Jon Emil Jahren <jonemilj@gmail.com>
Message-id: 20180129041648.30884-2-jonemilj@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Jon Emil Jahren 7 年之前
父节点
当前提交
fb1a66bc01
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      scripts/tracetool/__init__.py

+ 3 - 2
scripts/tracetool/__init__.py

@@ -261,8 +261,9 @@ def __repr__(self):
                                           self.name,
                                           self.name,
                                           self.args,
                                           self.args,
                                           fmt)
                                           fmt)
-
-    _FMT = re.compile("(%[\d\.]*\w+|%.*PRI\S+)")
+    # Star matching on PRI is dangerous as one might have multiple
+    # arguments with that format, hence the non-greedy version of it.
+    _FMT = re.compile("(%[\d\.]*\w+|%.*?PRI\S+)")
 
 
     def formats(self):
     def formats(self):
         """List conversion specifiers in the argument print format string."""
         """List conversion specifiers in the argument print format string."""