summary refs log tree commit diff stats
path: root/scripts/replay-dump.py
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-06-12 11:56:20 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-06-12 11:56:21 +0100
commit5eca450b2ec219c4256062bfb5498c726c1ed0a4 (patch)
tree63bbbeb6fe3e21017c07eced27ee5ba34dc2d550 /scripts/replay-dump.py
parent6e3bd769916e643d371882da1bda5fbd453d3c3b (diff)
parentc7883412440905b41dde7e70f4af782932e80e90 (diff)
downloadfocaccia-qemu-5eca450b2ec219c4256062bfb5498c726c1ed0a4.tar.gz
focaccia-qemu-5eca450b2ec219c4256062bfb5498c726c1ed0a4.zip
Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging
Python queue, 2018-06-11

* Make code compatible with Python 3 using 'futurize --stage1'
* Require Python >= 2.7 and remove Python 2.6 compatibility
  modules

# gpg: Signature made Mon 11 Jun 2018 18:41:26 BST
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/python-next-pull-request:
  python: Remove scripts/ordereddict.py
  python: Remove scripts/argparse.py
  configure: Require Python 2.7 or newer
  python: futurize -f lib2to3.fixes.fix_numliterals
  python: futurize -f lib2to3.fixes.fix_except
  python: futurize -f lib2to3.fixes.fix_renames
  python: futurize -f lib2to3.fixes.fix_tuple_params
  python: futurize -f lib2to3.fixes.fix_reduce
  python: futurize -f lib2to3.fixes.fix_standarderror
  python: futurize -f lib2to3.fixes.fix_has_key
  python: futurize -f libfuturize.fixes.fix_next_call
  python: futurize -f libfuturize.fixes.fix_absolute_import
  python: futurize -f libfuturize.fixes.fix_print_with_import

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/replay-dump.py')
-rwxr-xr-xscripts/replay-dump.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py
index e274086277..5ae77c8a92 100755
--- a/scripts/replay-dump.py
+++ b/scripts/replay-dump.py
@@ -18,6 +18,7 @@
 # You should have received a copy of the GNU Lesser General Public
 # License along with this library; if not, see <http://www.gnu.org/licenses/>.
 
+from __future__ import print_function
 import argparse
 import struct
 from collections import namedtuple
@@ -89,9 +90,9 @@ def call_decode(table, index, dumpfile):
     "Search decode table for next step"
     decoder = next((d for d in table if d.eid == index), None)
     if not decoder:
-        print "Could not decode index: %d" % (index)
-        print "Entry is: %s" % (decoder)
-        print "Decode Table is:\n%s" % (table)
+        print("Could not decode index: %d" % (index))
+        print("Entry is: %s" % (decoder))
+        print("Decode Table is:\n%s" % (table))
         return False
     else:
         return decoder.fn(decoder.eid, decoder.name, dumpfile)
@@ -103,23 +104,23 @@ def print_event(eid, name, string=None, event_count=None):
         event_count = replay_state.event_count
 
     if string:
-        print "%d:%s(%d) %s" % (event_count, name, eid, string)
+        print("%d:%s(%d) %s" % (event_count, name, eid, string))
     else:
-        print "%d:%s(%d)" % (event_count, name, eid)
+        print("%d:%s(%d)" % (event_count, name, eid))
 
 
 # Decoders for each event type
 
 def decode_unimp(eid, name, _unused_dumpfile):
     "Unimplimented decoder, will trigger exit"
-    print "%s not handled - will now stop" % (name)
+    print("%s not handled - will now stop" % (name))
     return False
 
 # Checkpoint decoder
 def swallow_async_qword(eid, name, dumpfile):
     "Swallow a qword of data without looking at it"
     step_id = read_qword(dumpfile)
-    print "  %s(%d) @ %d" % (name, eid, step_id)
+    print("  %s(%d) @ %d" % (name, eid, step_id))
     return True
 
 async_decode_table = [ Decoder(0, "REPLAY_ASYNC_EVENT_BH", swallow_async_qword),
@@ -139,8 +140,8 @@ def decode_async(eid, name, dumpfile):
     async_event_checkpoint = read_byte(dumpfile)
 
     if async_event_checkpoint != replay_state.current_checkpoint:
-        print "  mismatch between checkpoint %d and async data %d" % (
-            replay_state.current_checkpoint, async_event_checkpoint)
+        print("  mismatch between checkpoint %d and async data %d" % (
+            replay_state.current_checkpoint, async_event_checkpoint))
         return True
 
     return call_decode(async_decode_table, async_event_kind, dumpfile)
@@ -283,7 +284,7 @@ def decode_file(filename):
     version = read_dword(dumpfile)
     junk = read_qword(dumpfile)
 
-    print "HEADER: version 0x%x" % (version)
+    print("HEADER: version 0x%x" % (version))
 
     if version == 0xe02007:
         event_decode_table = v7_event_table