Commits

Victor Stinner committed 9fa95da

Rename strace.py option --socketcall to --socket, and fix this option for
FreeBSD and Linux/64 bits

Set also version to 0.6.3

Comments (0)

Files changed (8)

 Changelog
 =========
 
+python-ptrace 0.6.3
+-------------------
+
+ * Rename strace.py option --socketcall to --socket, and fix this option for
+   FreeBSD and Linux/64 bits
+
 python-ptrace 0.6.2 (2009-11-09)
 --------------------------------
 

ptrace/syscall/__init__.py

-from ptrace.syscall.names import SYSCALL_NAMES
+from ptrace.syscall.names import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES
 from ptrace.syscall.prototypes import SYSCALL_PROTOTYPES, FILENAME_ARGUMENTS
 from ptrace.syscall.syscall_argument import SyscallArgument
 from ptrace.syscall.ptrace_syscall import PtraceSyscall

ptrace/syscall/freebsd_syscall.py

     481: "thr_kill2",
 }
 
+SOCKET_SYSCALL_NAMES = set((
+    "socket", "socketpair", "connect",
+    "sendto", "recvfrom", "sendmsg", "recvmsg",
+    "bind", "listen", "accept",
+    "getpeername", "getsockname", "getsockopt", "setsockopt",
+    "shutdown",
+))

ptrace/syscall/linux_syscall32.py

     319: "epoll_pwait",
 }
 
+SOCKET_SYSCALL_NAMES = set(("socketcall",))
+

ptrace/syscall/linux_syscall64.py

    285: "fallocate",
 }
 
+SOCKET_SYSCALL_NAMES = set((
+    "socket", "socketpair", "connect",
+    "sendto", "recvfrom", "sendmsg", "recvmsg",
+    "bind", "listen", "accept",
+    "getsockname", "getpeername", "getsockopt", "setsockopt",
+    "shutdown",
+))
+

ptrace/syscall/names.py

 from ptrace.os_tools import RUNNING_LINUX, RUNNING_FREEBSD
 if RUNNING_LINUX:
     if CPU_64BITS:
-        from ptrace.syscall.linux_syscall64 import SYSCALL_NAMES
+        from ptrace.syscall.linux_syscall64 import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES
     else:
-        from ptrace.syscall.linux_syscall32 import SYSCALL_NAMES
+        from ptrace.syscall.linux_syscall32 import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES
 elif RUNNING_FREEBSD:
-    from ptrace.syscall.freebsd_syscall import SYSCALL_NAMES
+    from ptrace.syscall.freebsd_syscall import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES
 else:
     SYSCALL_NAMES = {}
+    SOCKET_SYSCALL_NAMES = set()
 

ptrace/version.py

 PACKAGE = "python-ptrace"
-VERSION = "0.6.2"
+VERSION = "0.6.3"
 WEBSITE = "http://bitbucket.org/haypo/python-ptrace/wiki/Home"
 LICENSE = "GNU GPL v2"
 from ptrace import PtraceError
 from ptrace.debugger import (PtraceDebugger, Application,
     ProcessExit, ProcessSignal, NewProcessEvent, ProcessExecution)
-from ptrace.syscall import SYSCALL_NAMES, SYSCALL_PROTOTYPES, FILENAME_ARGUMENTS
+from ptrace.syscall import (SYSCALL_NAMES, SYSCALL_PROTOTYPES,
+    FILENAME_ARGUMENTS, SOCKET_SYSCALL_NAMES)
 from ptrace.func_call import FunctionCallOptions
 from sys import stderr, exit
 from optparse import OptionParser
             action="store_true", default=False)
         parser.add_option("--syscalls", '-e', help="Comma separated list of shown system calls (other will be skipped)",
             type="str", default=None)
-        parser.add_option("--socketcall", help="Show only socketcall (network) functions",
+        parser.add_option("--socket", help="Show only socket functions",
             action="store_true", default=False)
         parser.add_option("--filename", help="Show only syscall using filename",
             action="store_true", default=False)
                 restype, arguments = format
                 if any(argname in FILENAME_ARGUMENTS for argtype, argname in arguments):
                     only.add(syscall)
-        if self.options.socketcall:
-            self.options.raw_socketcall = False
-            for syscall, prototype in SOCKETCALL.itervalues():
-                only.add(syscall)
+        if self.options.socket:
+            only |= SOCKET_SYSCALL_NAMES
         self.only = only
         if self.options.ignore_regex:
             try: