Author: David Schneider <[email protected]>
Branch: arm-backed-float
Changeset: r44876:7a6c8fbe552b
Date: 2011-06-10 12:59 +0200
http://bitbucket.org/pypy/pypy/changeset/7a6c8fbe552b/

Log:    add decoding of the output as in jit-backend-dump

diff --git a/pypy/jit/backend/arm/tool/objdump.py 
b/pypy/jit/backend/arm/tool/objdump.py
--- a/pypy/jit/backend/arm/tool/objdump.py
+++ b/pypy/jit/backend/arm/tool/objdump.py
@@ -1,5 +1,39 @@
 #!/usr/bin/env python
-import os
-import sys
 
-os.system('objdump -D --architecture=arm --target=binary %s' % sys.argv[1])
+Try:
+    ./viewcode.py file
+"""
+import os, sys, py
+
+def objdump(input):
+    os.system('objdump -D --architecture=arm --target=binary %s' % input)
+
+
+def get_tmp_file():
+    # don't use pypy.tool.udir here to avoid removing old usessions which
+    # might still contain interesting executables
+    udir = py.path.local.make_numbered_dir(prefix='viewcode-', keep=2)
+    tmpfile = str(udir.join('dump.tmp'))
+    return tmpfile
+
+def decode(source):
+    with open(source, 'r') as f:
+        data = f.read().strip()
+        data = data.decode('hex')
+
+    target = get_tmp_file()
+    with open(target, 'wb') as f:
+        f.write(data)
+    return target
+
+
+if __name__ == '__main__':
+    if len(sys.argv) == 2:
+        objdump(sys.argv[1])
+    elif len(sys.argv) == 3:
+        assert sys.argv[1] == '--decode'
+        f = decode(sys.argv[2])
+        objdump(f)
+    else:
+        print >> sys.stderr, __doc__
+        sys.exit(2)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to