Victor Stinner avatar Victor Stinner committed 7406075

Fix Process.readStruct() and Process.readArray() on x86_64

Comments (0)

Files changed (2)

  * Experimental support of Python 3.3 in the same code base
  * Drop support of Python 2.5
  * Remove the ptrace.compatibility module
+ * Fix Process.readStruct() and Process.readArray() on x86_64
 
 python-ptrace 0.6.6 (2013-12-16)
 --------------------------------

ptrace/debugger/process.py

     from ptrace.binding import ptrace_peekuser, ptrace_registers_t
 from ptrace.os_tools import HAS_PROC, RUNNING_BSD, RUNNING_PYTHON3
 from ptrace.tools import dumpRegs
-from ptrace.cpu_info import CPU_WORD_SIZE, CPU_64BITS
+from ptrace.cpu_info import CPU_WORD_SIZE
 from ptrace.ctypes_tools import bytes2word, word2bytes, bytes2type, bytes2array
 from signal import SIGTRAP, SIGSTOP, SIGKILL
 from ptrace.ctypes_tools import formatAddress, formatWordHex
             words = []
             nb_words = sizeof(ptrace_registers_t) // CPU_WORD_SIZE
             for offset in range(nb_words):
-                word = ptrace_peekuser(self.pid, offset*CPU_WORD_SIZE)
+                word = ptrace_peekuser(self.pid, offset * CPU_WORD_SIZE)
                 bytes = word2bytes(word)
                 words.append(bytes)
             bytes = ''.join(words)
 
     def readStruct(self, address, struct):
         bytes = self.readBytes(address, sizeof(struct))
-        if not CPU_64BITS:
-            bytes = c_char_p(bytes)
+        bytes = c_char_p(bytes)
         return bytes2type(bytes, struct)
 
     def readArray(self, address, basetype, count):
         bytes = self.readBytes(address, sizeof(basetype)*count)
-        if not CPU_64BITS:
-            bytes = c_char_p(bytes)
+        bytes = c_char_p(bytes)
         return bytes2array(bytes, basetype, count)
 
     def readCString(self, address, max_size, chunk_length=256):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.