Author: Armin Rigo <[email protected]>
Branch: stmgc-static-barrier
Changeset: r66126:c37feae39276
Date: 2013-08-13 19:02 +0200
http://bitbucket.org/pypy/pypy/changeset/c37feae39276/

Log:    Yay, finally found out the objdump option "-m i386:x86-64". Solves
        the truncated addresses. (transplanted from
        37b092c3f176633f1d5cc053d351c5f2b0684482)

diff --git a/rpython/jit/backend/tool/viewcode.py 
b/rpython/jit/backend/tool/viewcode.py
--- a/rpython/jit/backend/tool/viewcode.py
+++ b/rpython/jit/backend/tool/viewcode.py
@@ -58,6 +58,9 @@
         'arm': 'arm',
         'arm_32': 'arm',
     }
+    backend_to_machine = {
+        'x86-64': 'i386:x86-64',
+    }
     cmd = find_objdump()
     objdump = ('%(command)s -w -M %(backend)s -b binary -m %(machine)s '
                '--disassembler-options=intel-mnemonics '
@@ -66,12 +69,13 @@
     f = open(tmpfile, 'wb')
     f.write(data)
     f.close()
+    backend = objdump_backend_option[backend_name]
     p = subprocess.Popen(objdump % {
         'command': cmd,
         'file': tmpfile,
         'origin': originaddr,
-        'backend': objdump_backend_option[backend_name],
-        'machine': 'i386' if not backend_name.startswith('arm') else 'arm',
+        'backend': backend,
+        'machine': backend_to_machine.get(backend, backend),
     }, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     stdout, stderr = p.communicate()
     assert not p.returncode, ('Encountered an error running objdump: %s' %
@@ -239,7 +243,7 @@
         self.backend_name = None
         self.executable_name = None
 
-    def parse(self, f, textonly=True, truncate_addr=True):
+    def parse(self, f, textonly=True):
         for line in f:
             line = line[line.find('#') + 1:].strip()
             if line.startswith('BACKEND '):
@@ -251,9 +255,7 @@
                 if len(pieces) == 3:
                     continue     # empty line
                 baseaddr = long(pieces[1][1:], 16)
-                if truncate_addr:
-                    baseaddr &= 0xFFFFFFFFL
-                elif baseaddr < 0:
+                if baseaddr < 0:
                     baseaddr += (2 * sys.maxint + 2)
                 offset = int(pieces[2][1:])
                 addr = baseaddr + offset
@@ -273,9 +275,7 @@
                 assert pieces[1].startswith('@')
                 assert pieces[2].startswith('+')
                 baseaddr = long(pieces[1][1:], 16)
-                if truncate_addr:
-                    baseaddr &= 0xFFFFFFFFL
-                elif baseaddr < 0:
+                if baseaddr < 0:
                     baseaddr += (2 * sys.maxint + 2)
                 offset = int(pieces[2][1:])
                 addr = baseaddr + offset
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to