tracetool: Fix ust tracepoint issues
cover tracetool: Fix ust tracepoint issues
There are some issues with the argument parsing for ust.
The first issue is that the regex pattern matching arguments with PRI types matched too much. This was fixed by using a non-greedy star, instead of a greedy.
The second issue is that bool type is not recognized. This was fixed by adding the bool type to be traced as an integer.
Both issues causes missing information in the trace.
The following patches fix the issues mentioned.
Jon Emil Jahren (2):
tracetool: Update argument format regex to non-greedy star
tracetool: For ust trace bool type as ctf_integer
scripts/tracetool/__init__.py | 5 +++-- scripts/tracetool/format/ust_events_h.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.14.3
PATCH 1/2 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.
--- scripts/tracetool/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
scripts/tracetool/__init__.py +3 -2
@@ -259,8 +259,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 of argument print formats."""
Signature · 1 line
2.14.3
PATCH 2/2 tracetool: For ust trace bool type as ctf_integer
In reply to Jon Emil JahrenPreviously functions having arguments of type bool was not traced properly. The bool arguments were missing from the trace.
--- scripts/tracetool/format/ust_events_h.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/tracetool/format/ust_events_h.py +2 -1
@@ -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 + ')')
Signature · 1 line
2.14.3
Stefan Hajnoczi
AppliedQuoted 10 lines · Jon Emil Jahren
There are some issues with the argument parsing for ust.
The first issue is that the regex pattern matching arguments with PRI types matched too much. This was fixed by using a non-greedy star, instead of a greedy.
The second issue is that bool type is not recognized. This was fixed by adding the bool type to be traced as an integer.
Both issues causes missing information in the trace.The following patches fix the issues mentioned.
Quoted 7 lines
Jon Emil Jahren (2):
tracetool: Update argument format regex to non-greedy star
tracetool: For ust trace bool type asctf_integerscripts/tracetool/__init__.py | 5 +++-- scripts/tracetool/format/ust_events_h.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-)
Excellent work, thanks for the patches!
Thanks, applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing
Stefan