aboutsummaryrefslogtreecommitdiff
path: root/scripts/simpletrace.py
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2018-03-06 15:46:50 +0000
committerStefan Hajnoczi <stefanha@redhat.com>2018-03-12 11:10:20 +0000
commit86b5aacfb972ffe0fa5fac6028e9f0bc61050dda (patch)
tree613506fc5e8fce59946c9fb010125151eb48dd37 /scripts/simpletrace.py
parente42860ae836dc6f768eff2d51223c47103d2dc3b (diff)
trace: include filename when printing parser error messages
Improves error messages from: ValueError: Error on line 72: need more than 1 value to unpack To ValueError: Error at /home/berrange/src/virt/qemu/trace-events:72: need more than 1 value to unpack Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20180306154650.24075-1-berrange@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'scripts/simpletrace.py')
-rwxr-xr-xscripts/simpletrace.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
index be3d1affaf..9d45c6ba4e 100755
--- a/scripts/simpletrace.py
+++ b/scripts/simpletrace.py
@@ -168,7 +168,7 @@ class Analyzer(object):
def process(events, log, analyzer, read_header=True):
"""Invoke an analyzer on each event in a log."""
if isinstance(events, str):
- events = read_events(open(events, 'r'))
+ events = read_events(open(events, 'r'), events)
if isinstance(log, str):
log = open(log, 'rb')
@@ -233,7 +233,7 @@ def run(analyzer):
'<trace-file>\n' % sys.argv[0])
sys.exit(1)
- events = read_events(open(sys.argv[1], 'r'))
+ events = read_events(open(sys.argv[1], 'r'), sys.argv[1])
process(events, sys.argv[2], analyzer, read_header=read_header)
if __name__ == '__main__':