From fb1a66bc01b6f7376b452a313538a472451a0ba4 Mon Sep 17 00:00:00 2001 From: Jon Emil Jahren Date: Mon, 29 Jan 2018 05:16:47 +0100 Subject: 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 Message-id: 20180129041648.30884-2-jonemilj@gmail.com Signed-off-by: Stefan Hajnoczi --- scripts/tracetool/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts/tracetool') diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index 1a9733d..3646c2b 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -261,8 +261,9 @@ class Event(object): self.name, self.args, 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): """List conversion specifiers in the argument print format string.""" -- cgit v1.1 From 61b01bbc6c27f06f4732aedcb6554e135f41b760 Mon Sep 17 00:00:00 2001 From: Jon Emil Jahren Date: Mon, 29 Jan 2018 05:16:48 +0100 Subject: tracetool: For ust trace bool type as ctf_integer Previously functions having arguments of type bool was not traced properly. The bool arguments were missing from the trace. Signed-off-by: Jon Emil Jahren Message-id: 20180129041648.30884-3-jonemilj@gmail.com Signed-off-by: Stefan Hajnoczi --- scripts/tracetool/format/ust_events_h.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts/tracetool') diff --git a/scripts/tracetool/format/ust_events_h.py b/scripts/tracetool/format/ust_events_h.py index 514294c..4e95e9b 100644 --- a/scripts/tracetool/format/ust_events_h.py +++ b/scripts/tracetool/format/ust_events_h.py @@ -79,7 +79,8 @@ def generate(events, backend, group): out(' ctf_integer_hex('+ t + ', ' + n + ', ' + n + ')') elif ("ptr" in t) or ("*" in t): out(' ctf_integer_hex('+ t + ', ' + n + ', ' + n + ')') - elif ('int' in t) or ('long' in t) or ('unsigned' in t) or ('size_t' in t): + elif ('int' in t) or ('long' in t) or ('unsigned' in t) \ + or ('size_t' in t) or ('bool' in t): out(' ctf_integer(' + t + ', ' + n + ', ' + n + ')') elif ('double' in t) or ('float' in t): out(' ctf_float(' + t + ', ' + n + ', ' + n + ')') -- cgit v1.1