Package: python-ptrace Version: 0.9.3-2.2 Severity: normal Tags: patch pending
Dear maintainer, I've prepared an NMU for python-ptrace (versioned as 0.9.7-0.1) and uploaded it to DELAYED/10. Please feel free to tell me if I should delay it longer. Regards, Stephen
diff -Nru python-ptrace-0.9.3/debian/changelog python-ptrace-0.9.7/debian/changelog --- python-ptrace-0.9.3/debian/changelog 2019-12-20 20:03:21.000000000 +0100 +++ python-ptrace-0.9.7/debian/changelog 2021-01-04 18:19:12.000000000 +0100 @@ -1,3 +1,16 @@ +python-ptrace (0.9.7-0.1) unstable; urgency=medium + + * Non-maintainer upload. + * New upstream release, adding ppc64 support, and merging + 20-fix-egginfo-sources.patch. This will help with #976468; arm64 + support will be included in the next upstream release. + * Build-depend on python3 instead of python3-dev since this package + isn’t an extension. + * Clean up whitespace. + * Switch to debhelper compatibility level 13. + + -- Stephen Kitt <sk...@debian.org> Mon, 04 Jan 2021 18:19:12 +0100 + python-ptrace (0.9.3-2.2) unstable; urgency=medium * Non-maintainer upload. @@ -110,4 +123,3 @@ * Initial release (Closes: #491060) -- Pierre Chifflier <pol...@debian.org> Wed, 16 Jul 2008 10:31:47 +0200 - diff -Nru python-ptrace-0.9.3/debian/compat python-ptrace-0.9.7/debian/compat --- python-ptrace-0.9.3/debian/compat 2015-03-25 18:04:02.000000000 +0100 +++ python-ptrace-0.9.7/debian/compat 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -9 diff -Nru python-ptrace-0.9.3/debian/control python-ptrace-0.9.7/debian/control --- python-ptrace-0.9.3/debian/control 2019-12-20 20:03:21.000000000 +0100 +++ python-ptrace-0.9.7/debian/control 2021-01-04 18:18:38.000000000 +0100 @@ -2,9 +2,9 @@ Section: python Priority: optional Maintainer: Pierre Chifflier <pol...@debian.org> -Build-Depends: debhelper (>= 9), +Build-Depends: debhelper-compat (= 13), dh-python, - python3-dev + python3 Standards-Version: 4.1.4 Homepage: https://github.com/vstinner/python-ptrace Rules-Requires-Root: no diff -Nru python-ptrace-0.9.3/debian/patches/20-fix-egginfo-sources.patch python-ptrace-0.9.7/debian/patches/20-fix-egginfo-sources.patch --- python-ptrace-0.9.3/debian/patches/20-fix-egginfo-sources.patch 2018-04-29 14:11:01.000000000 +0200 +++ python-ptrace-0.9.7/debian/patches/20-fix-egginfo-sources.patch 1970-01-01 01:00:00.000000000 +0100 @@ -1,19 +0,0 @@ -Index: python-ptrace/python_ptrace.egg-info/SOURCES.txt -=================================================================== ---- python-ptrace.orig/python_ptrace.egg-info/SOURCES.txt -+++ python-ptrace/python_ptrace.egg-info/SOURCES.txt -@@ -4,6 +4,7 @@ README.rst - gdb.py - pyflakes.sh - runtests.py -+setup.cfg - setup.py - setup_cptrace.py - strace.py -@@ -101,4 +102,4 @@ tests/crash/invalid_read.c - tests/crash/invalid_write.c - tests/crash/pthread.c - tests/crash/socket_ipv4_tcp.c --tests/crash/stack_overflow.c -\ No newline at end of file -+tests/crash/stack_overflow.c diff -Nru python-ptrace-0.9.3/debian/patches/series python-ptrace-0.9.7/debian/patches/series --- python-ptrace-0.9.3/debian/patches/series 2018-04-29 14:09:27.000000000 +0200 +++ python-ptrace-0.9.7/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -20-fix-egginfo-sources.patch diff -Nru python-ptrace-0.9.3/debian/rules python-ptrace-0.9.7/debian/rules --- python-ptrace-0.9.3/debian/rules 2019-12-20 20:03:01.000000000 +0100 +++ python-ptrace-0.9.7/debian/rules 2021-01-04 18:18:38.000000000 +0100 @@ -11,4 +11,3 @@ %: dh $@ --with=python3 --buildsystem=pybuild - diff -Nru python-ptrace-0.9.3/doc/changelog.rst python-ptrace-0.9.7/doc/changelog.rst --- python-ptrace-0.9.3/doc/changelog.rst 2017-09-19 11:00:40.000000000 +0200 +++ python-ptrace-0.9.7/doc/changelog.rst 2020-08-10 23:18:14.000000000 +0200 @@ -3,6 +3,38 @@ Changelog ========= +python-ptrace 0.9.7 (2020-08-10) +-------------------------------- + +* Add missing module to install directives +* Update README.rst +* Project back in beta and maintenance + +python-ptrace 0.9.6 (2020-08-10) +-------------------------------- + +* Remove RUNNING_WINDOWS constant: python-ptrace doesn't not support Windows. +* Drop Python 2.7 support. six dependency is no longer needed. +* Add close_fds and pass_fds to createChild() function. + Patch by Jean-Baptiste Skutnik. +* Enhance strace.py output for open flags and open optional parameters. + Patch by Jean-Baptiste Skutnik. +* Add support for PowerPC 64-bit (ppc64). + Patch by Jean-Baptiste Skutnik. + +python-ptrace 0.9.5 (2020-04-13) +-------------------------------- + +* Fix readProcessMappings() for device id on 3 digits. Patch by Cat Stevens. +* Drop Python 2 support. + +python-ptrace 0.9.4 (2019-07-30) +-------------------------------- + +* Issue #36: Fix detaching from process object created without is_attached=True +* The project now requires the six module. +* Project moved to: https://github.com/vstinner/python-ptrace + python-ptrace 0.9.3 (2017-09-19) -------------------------------- @@ -110,7 +142,7 @@ * Create follow, showfollow, resetfollow, xray commands in gdb.py. Patch written by Dimitris Glynos -* Project website moved to http://bitbucket.org/haypo/python-ptrace/ +* Project website moved to: ``http://bitbucket.org/haypo/python-ptrace/`` * Replace types (u)intXX_t by c_(u)intXX * Create MemoryMapping.search() method and MemoryMapping now keeps a weak reference to the process diff -Nru python-ptrace-0.9.3/doc/conf.py python-ptrace-0.9.7/doc/conf.py --- python-ptrace-0.9.3/doc/conf.py 2017-02-12 19:08:46.000000000 +0100 +++ python-ptrace-0.9.7/doc/conf.py 2020-08-10 22:45:22.000000000 +0200 @@ -11,13 +11,6 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) - # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. @@ -48,7 +41,7 @@ # built documents. # # The short X.Y version. -version = release = '0.9.3' +version = release = '0.9.7' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -Nru python-ptrace-0.9.3/doc/gdb.rst python-ptrace-0.9.7/doc/gdb.rst --- python-ptrace-0.9.3/doc/gdb.rst 2017-02-10 12:22:40.000000000 +0100 +++ python-ptrace-0.9.7/doc/gdb.rst 2020-07-26 20:51:25.000000000 +0200 @@ -86,7 +86,7 @@ Process ID: 16182 Process command line: [['/bin/ls'] Process|environment: ['TERM=xterm', 'SHELL=/bin/bash', (...)]] - Process working directory: /home/haypo/prog/fusil/ptrace/trunk + Process working directory: /home/vstinner/prog/fusil/ptrace/trunk (gdb) stack STACK: 0xbfc58000..0xbfc6e000 STACK -8: 0x00000000 diff -Nru python-ptrace-0.9.3/doc/index.rst python-ptrace-0.9.7/doc/index.rst --- python-ptrace-0.9.3/doc/index.rst 2017-02-10 12:22:40.000000000 +0100 +++ python-ptrace-0.9.7/doc/index.rst 2020-07-26 20:51:25.000000000 +0200 @@ -2,18 +2,24 @@ python-ptrace ============= +.. image:: http://unmaintained.tech/badge.svg + :target: http://unmaintained.tech/ + :alt: No Maintenance Intended + +**This project is no longer maintained and is looking for a new maintainer.** + python-ptrace is a debugger using ptrace (Linux, BSD and Darwin system call to trace processes) written in Python. * `python-ptrace documentation <http://python-ptrace.readthedocs.io/>`_ * `python-ptrace at GitHub - <https://github.com/haypo/python-ptrace>`_ + <https://github.com/vstinner/python-ptrace>`_ * `python-ptrace at the Python Cheeseshop (PyPI) <https://pypi.python.org/pypi/python-ptrace>`_ python-ptrace is an opensource project written in Python under GNU GPLv2 -license. +license. It supports Python 3.6 and newer. Features diff -Nru python-ptrace-0.9.3/doc/install.rst python-ptrace-0.9.7/doc/install.rst --- python-ptrace-0.9.3/doc/install.rst 2017-02-10 12:22:40.000000000 +0100 +++ python-ptrace-0.9.7/doc/install.rst 2020-07-26 20:51:25.000000000 +0200 @@ -2,6 +2,8 @@ Install python-ptrace +++++++++++++++++++++ +python-ptrace supports Python 3.6 and newer. + Linux packages ============== @@ -27,31 +29,30 @@ Download the development version using Git:: - git clone https://github.com/haypo/python-ptrace.git + git clone https://github.com/vstinner/python-ptrace.git `Browse python-ptrace source code -<https://github.com/haypo/python-ptrace>`_. +<https://github.com/vstinner/python-ptrace>`_. -python-ptrace dependencies --------------------------- +Option dependency +----------------- -* Python 2.6+/3.3+: - http://python.org/ * distorm disassembler (optional) http://www.ragestorm.net/distorm/ - Installation ------------ +Note: pip is strongly recommanded. + Type as root:: - python setup.py install + python3 setup.py install Or using sudo program:: - sudo python setup.py install + sudo python3 setup.py install cptrace @@ -60,7 +61,7 @@ For faster debug and to avoid ctypes, you can also install cptrace: Python binding of the ptrace() function written in C:: - python setup_cptrace.py install + python3 setup_cptrace.py install Run tests @@ -69,22 +70,12 @@ Run tests with tox ------------------ -The `tox project <https://testrun.org/tox/latest/>`_ can be used to build a -virtual environment run tests against different Python versions (Python 2 and -Python 3). - -To run all tests on Python 2 and Python 3, just type:: +To run all tests, just type:: tox -To only run tests on Python 2.7, type:: - - tox -e py2 - -Available environments: - -* ``py2``: Python 2 -* ``py3``: Python 3 +The `tox project <https://testrun.org/tox/latest/>`_ creates a clean virtual +environment to run tests. Run tests manually @@ -92,9 +83,9 @@ Type:: - python runtests.py - python test_doc.py + python3 runtests.py + python3 test_doc.py It's also possible to run a specific test:: - PYTHONPATH=$PWD python tests/test_strace.py + PYTHONPATH=$PWD python3 tests/test_strace.py diff -Nru python-ptrace-0.9.3/gdb.py python-ptrace-0.9.7/gdb.py --- python-ptrace-0.9.3/gdb.py 2017-02-10 12:41:08.000000000 +0100 +++ python-ptrace-0.9.7/gdb.py 2020-08-10 22:45:22.000000000 +0200 @@ -1,5 +1,4 @@ #!/usr/bin/env python -from __future__ import print_function from ptrace import PtraceError from ptrace.debugger import (PtraceDebugger, Application, ProcessExit, NewProcessEvent, ProcessSignal, @@ -8,7 +7,7 @@ from os import getpid from sys import stdout, stderr, exit from logging import getLogger, info, warning, error -from ptrace.version import VERSION, WEBSITE +from ptrace.version import __version__ as VERSION, WEBSITE from ptrace.error import PTRACE_ERRORS, writeError from ptrace.binding import HAS_PTRACE_SINGLESTEP from ptrace.disasm import HAS_DISASSEMBLER @@ -18,7 +17,6 @@ from ptrace.tools import inverseDict from ptrace.func_call import FunctionCallOptions from ptrace.signames import signalName, SIGNAMES -from ptrace.six import PY3, binary_type from signal import SIGTRAP, SIGINT from ptrace.terminal import enableEchoMode, terminalWidth from errno import ESRCH @@ -265,10 +263,9 @@ # FIXME: Validate input # if not BYTES_REGEX.match(text): # raise ValueError('Follow text must be enclosed in quotes!') - if PY3: - text = 'b' + text.lstrip() + text = 'b' + text.lstrip() value = eval(text) - if not isinstance(value, binary_type): + if not isinstance(value, bytes): raise TypeError("Input is not a bytes string!") return value @@ -534,7 +531,7 @@ if not key.startswith("$"): return 'Register name (%s) have to start with "$"' % key key = key[1:] - except ValueError as err: + except ValueError: return "Invalid command: %r" % command try: value = self.parseInteger(value) @@ -594,7 +591,7 @@ self.process.waitSignals(SIGTRAP) if breakpoint: breakpoint.desinstall(set_ip=True) - except: + except: # noqa: E722 if breakpoint: breakpoint.desinstall() raise diff -Nru python-ptrace-0.9.3/MANIFEST.in python-ptrace-0.9.7/MANIFEST.in --- python-ptrace-0.9.3/MANIFEST.in 2017-02-10 12:22:40.000000000 +0100 +++ python-ptrace-0.9.7/MANIFEST.in 2020-07-26 20:51:25.000000000 +0200 @@ -6,6 +6,8 @@ include README.cptrace include TODO include tox.ini +include SYSCALL_PROTOTYPES.codegen.py + include cptrace/Makefile include cptrace/cptrace.c include cptrace/version.py diff -Nru python-ptrace-0.9.3/PKG-INFO python-ptrace-0.9.7/PKG-INFO --- python-ptrace-0.9.3/PKG-INFO 2017-09-19 11:03:19.000000000 +0200 +++ python-ptrace-0.9.7/PKG-INFO 2020-08-10 23:30:05.305909400 +0200 @@ -1,13 +1,12 @@ Metadata-Version: 1.1 Name: python-ptrace -Version: 0.9.3 +Version: 0.9.7 Summary: python binding of ptrace Home-page: http://python-ptrace.readthedocs.io/ Author: Victor Stinner Author-email: UNKNOWN License: GNU GPL v2 Download-URL: http://python-ptrace.readthedocs.io/ -Description-Content-Type: UNKNOWN Description: ============= python-ptrace ============= @@ -16,9 +15,9 @@ :alt: Latest release on the Python Cheeseshop (PyPI) :target: https://pypi.python.org/pypi/python-ptrace - .. image:: https://travis-ci.org/haypo/python-ptrace.svg?branch=master + .. image:: https://travis-ci.com/vstinner/python-ptrace.svg?branch=master :alt: Build status of python-ptrace on Travis CI - :target: https://travis-ci.org/haypo/python-ptrace + :target: https://travis-ci.com/github/vstinner/python-ptrace python-ptrace is a debugger using ptrace (Linux, BSD and Darwin system call to trace processes) written in Python. @@ -26,12 +25,12 @@ * `python-ptrace documentation <http://python-ptrace.readthedocs.io/>`_ * `python-ptrace at GitHub - <https://github.com/haypo/python-ptrace>`_ + <https://github.com/vstinner/python-ptrace>`_ * `python-ptrace at the Python Cheeseshop (PyPI) <https://pypi.python.org/pypi/python-ptrace>`_ python-ptrace is an opensource project written in Python under GNU GPLv2 - license. + license. It supports Python 3.6 and newer. Platform: UNKNOWN Classifier: Intended Audience :: Developers diff -Nru python-ptrace-0.9.3/ptrace/binding/linux_struct.py python-ptrace-0.9.7/ptrace/binding/linux_struct.py --- python-ptrace-0.9.3/ptrace/binding/linux_struct.py 2017-02-10 12:41:08.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/binding/linux_struct.py 2020-08-10 22:45:22.000000000 +0200 @@ -1,13 +1,15 @@ from ctypes import (Structure, Union, sizeof, c_char, c_ushort, c_int, c_uint, c_ulong, c_void_p, c_uint16, c_uint32, c_uint64) -from ptrace.cpu_info import CPU_64BITS, CPU_PPC32, CPU_ARM +from ptrace.cpu_info import CPU_64BITS, CPU_PPC32, CPU_PPC64, CPU_ARM pid_t = c_int uid_t = c_ushort clock_t = c_uint # From /usr/include/asm-i386/user.h +# Also more reliably in the kernel sources: +# arch/$ARCH/include/uapi/asm/ptrace.h class user_regs_struct(Structure): @@ -56,6 +58,53 @@ ("trap", c_ulong), ("dar", c_ulong), ("dsisr", c_ulong), + ("result", c_ulong), + ) + elif CPU_PPC64: + _fields_ = ( + ("gpr0", c_ulong), + ("gpr1", c_ulong), + ("gpr2", c_ulong), + ("gpr3", c_ulong), + ("gpr4", c_ulong), + ("gpr5", c_ulong), + ("gpr6", c_ulong), + ("gpr7", c_ulong), + ("gpr8", c_ulong), + ("gpr9", c_ulong), + ("gpr10", c_ulong), + ("gpr11", c_ulong), + ("gpr12", c_ulong), + ("gpr13", c_ulong), + ("gpr14", c_ulong), + ("gpr15", c_ulong), + ("gpr16", c_ulong), + ("gpr17", c_ulong), + ("gpr18", c_ulong), + ("gpr19", c_ulong), + ("gpr20", c_ulong), + ("gpr21", c_ulong), + ("gpr22", c_ulong), + ("gpr23", c_ulong), + ("gpr24", c_ulong), + ("gpr25", c_ulong), + ("gpr26", c_ulong), + ("gpr27", c_ulong), + ("gpr28", c_ulong), + ("gpr29", c_ulong), + ("gpr30", c_ulong), + ("gpr31", c_ulong), + ("nip", c_ulong), + ("msr", c_ulong), + ("orig_gpr3", c_ulong), + ("ctr", c_ulong), + ("link", c_ulong), + ("xer", c_ulong), + ("ccr", c_ulong), + ("softe", c_ulong), + ("trap", c_ulong), + ("dar", c_ulong), + ("dsisr", c_ulong), ("result", c_ulong), ) elif CPU_ARM: diff -Nru python-ptrace-0.9.3/ptrace/cpu_info.py python-ptrace-0.9.7/ptrace/cpu_info.py --- python-ptrace-0.9.3/ptrace/cpu_info.py 2017-02-10 12:38:51.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/cpu_info.py 2020-08-10 22:45:22.000000000 +0200 @@ -36,7 +36,7 @@ # guess machine type using uname() _machine = uname()[4] CPU_PPC32 = (_machine == 'ppc') - CPU_PPC64 = (_machine == 'ppc64') + CPU_PPC64 = (_machine in ('ppc64', 'ppc64le')) CPU_I386 = (_machine in ("i386", "i686")) # compatible Intel 32 bits CPU_X86_64 = (_machine in ("x86_64", "amd64")) # compatible Intel 64 bits CPU_ARM = _machine.startswith('arm') diff -Nru python-ptrace-0.9.3/ptrace/debugger/backtrace.py python-ptrace-0.9.7/ptrace/debugger/backtrace.py --- python-ptrace-0.9.3/ptrace/debugger/backtrace.py 2017-02-10 12:38:51.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/debugger/backtrace.py 2020-08-10 22:45:22.000000000 +0200 @@ -1,7 +1,6 @@ from ptrace.ctypes_tools import formatAddress, formatWordHex from ptrace.cpu_info import CPU_WORD_SIZE, CPU_MAX_UINT from ptrace import PtraceError -from ptrace.six.moves import xrange class BacktraceFrame(object): @@ -106,7 +105,7 @@ frame = BacktraceFrame(ip) address = fp + CPU_WORD_SIZE try: - for index in xrange(nargs): + for index in range(nargs): address += CPU_WORD_SIZE word = process.readWord(address) frame.arguments.append(word) diff -Nru python-ptrace-0.9.3/ptrace/debugger/breakpoint.py python-ptrace-0.9.7/ptrace/debugger/breakpoint.py --- python-ptrace-0.9.3/ptrace/debugger/breakpoint.py 2017-02-10 12:38:49.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/debugger/breakpoint.py 2020-08-10 22:45:22.000000000 +0200 @@ -4,7 +4,6 @@ from weakref import ref from ptrace.cpu_info import CPU_POWERPC, CPU_WORD_SIZE from ptrace.ctypes_tools import word2bytes -from ptrace.six import b class Breakpoint(object): @@ -33,7 +32,7 @@ new_bytes = word2bytes(0x0cc00000) else: # Replace instruction with "INT 3" - new_bytes = b("\xCC") * size + new_bytes = b"\xCC" * size process.writeBytes(address, new_bytes) self._installed = True diff -Nru python-ptrace-0.9.3/ptrace/debugger/child.py python-ptrace-0.9.7/ptrace/debugger/child.py --- python-ptrace-0.9.3/ptrace/debugger/child.py 2017-02-10 12:38:51.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/debugger/child.py 2020-08-10 22:45:22.000000000 +0200 @@ -4,10 +4,9 @@ from os import ( fork, execvp, execvpe, waitpid, close, dup2, pipe, - read, write, devnull, sysconf) + read, write, devnull, sysconf, set_inheritable) from sys import exc_info from traceback import format_exception -from ptrace.os_tools import RUNNING_WINDOWS from ptrace.binding import ptrace_traceme from ptrace import PtraceError from sys import exit @@ -17,7 +16,7 @@ try: MAXFD = sysconf("SC_OPEN_MAX") -except: +except Exception: MAXFD = 256 @@ -30,8 +29,6 @@ def _set_cloexec_flag(fd): - if RUNNING_WINDOWS: - return try: cloexec_flag = fcntl.FD_CLOEXEC except AttributeError: @@ -87,24 +84,34 @@ raise child_exception -def _createChild(arguments, no_stdout, env, errpipe_write): +def _createChild(arguments, + no_stdout, + env, + errpipe_write, + close_fds=True, + pass_fds=()): # Child code try: ptrace_traceme() except PtraceError as err: raise ChildError(str(err)) - # Close all files except 0, 1, 2 and errpipe_write - for fd in range(3, MAXFD): - if fd == errpipe_write: - continue - try: - close(fd) - except OSError: - pass + for fd in pass_fds: + set_inheritable(fd, True) + + if close_fds: + # Close all files except 0, 1, 2 and errpipe_write + for fd in range(3, MAXFD): + if fd == errpipe_write or (fd in pass_fds): + continue + try: + close(fd) + except OSError: + pass + try: _execChild(arguments, no_stdout, env) - except: + except: # noqa: E722 exc_type, exc_value, tb = exc_info() # Save the traceback and attach it to the exception object exc_lines = format_exception(exc_type, exc_value, tb) @@ -120,7 +127,7 @@ dup2(null.fileno(), 1) dup2(1, 2) null.close() - except IOError as err: + except IOError: close(2) close(1) try: @@ -132,7 +139,7 @@ raise ChildError(str(err)) -def createChild(arguments, no_stdout, env=None): +def createChild(arguments, no_stdout, env=None, close_fds=True, pass_fds=()): """ Create a child process: - arguments: list of string where (e.g. ['ls', '-la']) @@ -143,6 +150,10 @@ - env={} to start with an empty environment - env=None (default) to copy the environment """ + + if pass_fds and not close_fds: + close_fds = True + errpipe_read, errpipe_write = pipe() _set_cloexec_flag(errpipe_write) @@ -154,4 +165,9 @@ return pid else: close(errpipe_read) - _createChild(arguments, no_stdout, env, errpipe_write) + _createChild(arguments, + no_stdout, + env, + errpipe_write, + close_fds=close_fds, + pass_fds=pass_fds) diff -Nru python-ptrace-0.9.3/ptrace/debugger/debugger.py python-ptrace-0.9.7/ptrace/debugger/debugger.py --- python-ptrace-0.9.3/ptrace/debugger/debugger.py 2017-02-10 12:38:49.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/debugger/debugger.py 2020-07-26 20:51:25.000000000 +0200 @@ -91,7 +91,7 @@ % pid) except ProcessSignal as event: event.display() - except: + except: # noqa: E722 process.is_attached = False process.detach() raise diff -Nru python-ptrace-0.9.3/ptrace/debugger/memory_mapping.py python-ptrace-0.9.7/ptrace/debugger/memory_mapping.py --- python-ptrace-0.9.3/ptrace/debugger/memory_mapping.py 2017-02-10 12:38:49.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/debugger/memory_mapping.py 2020-07-26 20:51:25.000000000 +0200 @@ -15,7 +15,7 @@ # Offset: '0804d000' r'([0-9a-f]+) ' # Device (major:minor): 'fe:01 ' - r'([0-9a-f]{2}):([0-9a-f]{2}) ' + r'([0-9a-f]{2,3}):([0-9a-f]{2}) ' # Inode: '3334030' r'([0-9]+)' # Filename: ' /usr/bin/synergyc' diff -Nru python-ptrace-0.9.3/ptrace/debugger/process.py python-ptrace-0.9.7/ptrace/debugger/process.py --- python-ptrace-0.9.3/ptrace/debugger/process.py 2017-02-21 11:57:46.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/debugger/process.py 2020-08-10 22:45:22.000000000 +0200 @@ -28,7 +28,6 @@ from ptrace.debugger.memory_mapping import readProcessMappings from ptrace.binding.cpu import CPU_INSTR_POINTER, CPU_STACK_POINTER, CPU_FRAME_POINTER, CPU_SUB_REGISTERS from ptrace.debugger.syscall_state import SyscallState -from ptrace.six import b if HAS_PTRACE_SINGLESTEP: from ptrace.binding import ptrace_singlestep @@ -292,12 +291,8 @@ return self.is_attached = False if self.running: - if self.was_attached: - info("Detach %s" % self) - ptrace_detach(self.pid) - elif self.is_stopped: - info("Continue process %s execution" % self.pid) - self.cont() + info("Detach %s" % self) + ptrace_detach(self.pid) self.debugger.deleteProcess(process=self) def _notRunning(self): @@ -520,7 +515,7 @@ size -= subsize address += CPU_WORD_SIZE else: - data = b('') + data = b'' while size: # Read word @@ -659,7 +654,7 @@ while True: done = False data = self.readBytes(address, chunk_length) - pos = data.find(b('\0')) + pos = data.find(b'\0') if pos != -1: done = True data = data[:pos] diff -Nru python-ptrace-0.9.3/ptrace/disasm.py python-ptrace-0.9.7/ptrace/disasm.py --- python-ptrace-0.9.3/ptrace/disasm.py 2017-02-10 12:38:49.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/disasm.py 2020-07-26 20:51:25.000000000 +0200 @@ -15,7 +15,7 @@ else: raise ImportError("CPU not supported") DISTORM3 = True - except ImportError as err: + except ImportError: DISTORM3 = False from ptrace.pydistorm import Decode if CPU_X86_64: @@ -71,6 +71,6 @@ raise PtraceError("Unable to disassemble %r" % code) HAS_DISASSEMBLER = True -except (ImportError, OSError) as err: +except (ImportError, OSError): # OSError if libdistorm64.so doesn't exist HAS_DISASSEMBLER = False diff -Nru python-ptrace-0.9.3/ptrace/error.py python-ptrace-0.9.7/ptrace/error.py --- python-ptrace-0.9.3/ptrace/error.py 2017-02-10 12:38:50.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/error.py 2020-07-26 20:51:25.000000000 +0200 @@ -19,7 +19,7 @@ for line in trace.split("\n"): log_func(line.rstrip()) return - except: + except Exception: pass log_func("Unable to get backtrace") diff -Nru python-ptrace-0.9.3/ptrace/func_call.py python-ptrace-0.9.7/ptrace/func_call.py --- python-ptrace-0.9.3/ptrace/func_call.py 2017-02-10 12:38:50.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/func_call.py 2020-08-10 22:45:22.000000000 +0200 @@ -62,6 +62,11 @@ def format(self): arguments = [arg.format() for arg in self.arguments] + + # Remove empty optionnal arguments + while arguments and not arguments[-1]: + arguments.pop(-1) + arguments = ", ".join(arguments) if self.restype and self.options.write_types: return "%s %s(%s)" % (self.restype, self.name, arguments) diff -Nru python-ptrace-0.9.3/ptrace/__init__.py python-ptrace-0.9.7/ptrace/__init__.py --- python-ptrace-0.9.3/ptrace/__init__.py 2017-02-10 12:38:50.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/__init__.py 2020-07-26 20:51:25.000000000 +0200 @@ -1,2 +1,3 @@ from ptrace.signames import SIGNAMES, signalName # noqa from ptrace.error import PtraceError # noqa +from ptrace.version import VERSION, __version__ # noqa diff -Nru python-ptrace-0.9.3/ptrace/linux_proc.py python-ptrace-0.9.7/ptrace/linux_proc.py --- python-ptrace-0.9.3/ptrace/linux_proc.py 2017-02-10 12:41:08.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/linux_proc.py 2020-08-10 22:45:22.000000000 +0200 @@ -5,7 +5,6 @@ - PAGE_SIZE: size of a memory page """ -from __future__ import with_statement from os import readlink, listdir from resource import getpagesize from ptrace.tools import timestampUNIX diff -Nru python-ptrace-0.9.3/ptrace/os_tools.py python-ptrace-0.9.7/ptrace/os_tools.py --- python-ptrace-0.9.3/ptrace/os_tools.py 2017-02-10 12:38:49.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/os_tools.py 2020-08-10 22:45:22.000000000 +0200 @@ -2,7 +2,6 @@ Constants about the operating system: - RUNNING_PYPY (bool) - - RUNNING_WINDOWS (bool) - RUNNING_LINUX (bool) - RUNNING_FREEBSD (bool) - RUNNING_OPENBSD (bool) @@ -16,7 +15,6 @@ RUNNING_PYTHON3 = version_info[0] == 3 RUNNING_PYPY = ("pypy" in version.lower()) -RUNNING_WINDOWS = (platform == 'win32') RUNNING_LINUX = platform.startswith('linux') RUNNING_FREEBSD = (platform.startswith('freebsd') or platform.startswith('gnukfreebsd')) diff -Nru python-ptrace-0.9.3/ptrace/process_tools.py python-ptrace-0.9.7/ptrace/process_tools.py --- python-ptrace-0.9.3/ptrace/process_tools.py 2017-02-10 12:38:50.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/process_tools.py 2020-08-10 22:45:22.000000000 +0200 @@ -1,14 +1,13 @@ -from ptrace.os_tools import RUNNING_LINUX, RUNNING_WINDOWS +from ptrace.os_tools import RUNNING_LINUX if RUNNING_LINUX: from ptrace.linux_proc import (ProcError, openProc, readProcessProcList, readProcessLink, readProcessStat) from ptrace.signames import signalName # noqa -if not RUNNING_WINDOWS: - from os import ( - WIFSTOPPED, WSTOPSIG, - WIFSIGNALED, WTERMSIG, - WIFEXITED, WEXITSTATUS, - WCOREDUMP) +from os import ( + WIFSTOPPED, WSTOPSIG, + WIFSIGNALED, WTERMSIG, + WIFEXITED, WEXITSTATUS, + WCOREDUMP) def dumpProcessInfo(log, pid, max_length=None): @@ -100,8 +99,6 @@ """ Format a process status (integer) as a string. """ - if RUNNING_WINDOWS: - raise NotImplementedError() if WIFSTOPPED(status): signum = WSTOPSIG(status) text = "%s stopped by signal %s" % (title, signalName(signum)) diff -Nru python-ptrace-0.9.3/ptrace/pydistorm.py python-ptrace-0.9.7/ptrace/pydistorm.py --- python-ptrace-0.9.3/ptrace/pydistorm.py 2017-02-10 12:41:08.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/pydistorm.py 2020-08-10 22:45:22.000000000 +0200 @@ -9,7 +9,6 @@ """ from ctypes import cdll, c_long, c_ulong, c_int, c_uint, c_char, POINTER, Structure, addressof, byref, c_void_p, create_string_buffer, sizeof, cast -from ptrace.six import binary_type # Define (u)int32_t and (u)int64_t types int32_t = c_int @@ -81,11 +80,11 @@ Errors: TypeError, IndexError, MemoryError, ValueError """ # Check arguments - if not isinstance(codeOffset, (int, long)): + if not isinstance(codeOffset, int): raise TypeError("codeOffset have to be an integer") - if not isinstance(code, binary_type): - raise TypeError("code have to be a %s, not %s" - % (binary_type.__name__, type(code).__name__)) + if not isinstance(code, bytes): + raise TypeError("code have to be a bytes, not %s" + % (type(code).__name__,)) if dt not in DECODERS: raise IndexError( "Decoding-type must be either Decode16Bits, Decode32Bits or Decode64Bits.") diff -Nru python-ptrace-0.9.3/ptrace/six.py python-ptrace-0.9.7/ptrace/six.py --- python-ptrace-0.9.3/ptrace/six.py 2017-02-10 12:38:49.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/six.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,602 +0,0 @@ -"""Utilities for writing code that runs on Python 2 and 3""" - -# Copyright (c) 2010-2013 Benjamin Peterson -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -import operator -import sys -import types - -__author__ = "Benjamin Peterson <benja...@python.org>" -__version__ = "1.4.1" - - -# Useful for very coarse version differentiation. -PY2 = sys.version_info[0] == 2 -PY3 = sys.version_info[0] == 3 - -if PY3: - string_types = str, - integer_types = int, - class_types = type, - text_type = str - binary_type = bytes - - MAXSIZE = sys.maxsize -else: - string_types = basestring, - integer_types = (int, long) - class_types = (type, types.ClassType) - text_type = unicode - binary_type = str - - if sys.platform.startswith("java"): - # Jython always uses 32 bits. - MAXSIZE = int((1 << 31) - 1) - else: - # It's possible to have sizeof(long) != sizeof(Py_ssize_t). - class X(object): - - def __len__(self): - return 1 << 31 - try: - len(X()) - except OverflowError: - # 32-bit - MAXSIZE = int((1 << 31) - 1) - else: - # 64-bit - MAXSIZE = int((1 << 63) - 1) - del X - - -def _add_doc(func, doc): - """Add documentation to a function.""" - func.__doc__ = doc - - -def _import_module(name): - """Import module, returning the module after the last dot.""" - __import__(name) - return sys.modules[name] - - -class _LazyDescr(object): - - def __init__(self, name): - self.name = name - - def __get__(self, obj, tp): - result = self._resolve() - setattr(obj, self.name, result) - # This is a bit ugly, but it avoids running this again. - delattr(tp, self.name) - return result - - -class MovedModule(_LazyDescr): - - def __init__(self, name, old, new=None): - super(MovedModule, self).__init__(name) - if PY3: - if new is None: - new = name - self.mod = new - else: - self.mod = old - - def _resolve(self): - return _import_module(self.mod) - - -class MovedAttribute(_LazyDescr): - - def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None): - super(MovedAttribute, self).__init__(name) - if PY3: - if new_mod is None: - new_mod = name - self.mod = new_mod - if new_attr is None: - if old_attr is None: - new_attr = name - else: - new_attr = old_attr - self.attr = new_attr - else: - self.mod = old_mod - if old_attr is None: - old_attr = name - self.attr = old_attr - - def _resolve(self): - module = _import_module(self.mod) - return getattr(module, self.attr) - - -class _MovedItems(types.ModuleType): - """Lazy loading of moved objects""" - - -_moved_attributes = [ - MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), - MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), - MovedAttribute("filterfalse", "itertools", "itertools", - "ifilterfalse", "filterfalse"), - MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), - MovedAttribute("map", "itertools", "builtins", "imap", "map"), - MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"), - MovedAttribute("reload_module", "__builtin__", "imp", "reload"), - MovedAttribute("reduce", "__builtin__", "functools"), - MovedAttribute("StringIO", "StringIO", "io"), - MovedAttribute("UserString", "UserString", "collections"), - MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), - MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), - MovedAttribute("zip_longest", "itertools", "itertools", - "izip_longest", "zip_longest"), - - MovedModule("builtins", "__builtin__"), - MovedModule("configparser", "ConfigParser"), - MovedModule("copyreg", "copy_reg"), - MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), - MovedModule("http_cookies", "Cookie", "http.cookies"), - MovedModule("html_entities", "htmlentitydefs", "html.entities"), - MovedModule("html_parser", "HTMLParser", "html.parser"), - MovedModule("http_client", "httplib", "http.client"), - MovedModule("email_mime_multipart", "email.MIMEMultipart", - "email.mime.multipart"), - MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), - MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), - MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), - MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), - MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), - MovedModule("cPickle", "cPickle", "pickle"), - MovedModule("queue", "Queue"), - MovedModule("reprlib", "repr"), - MovedModule("socketserver", "SocketServer"), - MovedModule("tkinter", "Tkinter"), - MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"), - MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"), - MovedModule("tkinter_scrolledtext", "ScrolledText", - "tkinter.scrolledtext"), - MovedModule("tkinter_simpledialog", "SimpleDialog", - "tkinter.simpledialog"), - MovedModule("tkinter_tix", "Tix", "tkinter.tix"), - MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"), - MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"), - MovedModule("tkinter_colorchooser", "tkColorChooser", - "tkinter.colorchooser"), - MovedModule("tkinter_commondialog", "tkCommonDialog", - "tkinter.commondialog"), - MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"), - MovedModule("tkinter_font", "tkFont", "tkinter.font"), - MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"), - MovedModule("tkinter_tksimpledialog", "tkSimpleDialog", - "tkinter.simpledialog"), - MovedModule("urllib_parse", __name__ + - ".moves.urllib_parse", "urllib.parse"), - MovedModule("urllib_error", __name__ + - ".moves.urllib_error", "urllib.error"), - MovedModule("urllib", __name__ + ".moves.urllib", - __name__ + ".moves.urllib"), - MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), - MovedModule("winreg", "_winreg"), -] -for attr in _moved_attributes: - setattr(_MovedItems, attr.name, attr) -del attr - -moves = sys.modules[__name__ + ".moves"] = _MovedItems(__name__ + ".moves") - - -class Module_six_moves_urllib_parse(types.ModuleType): - """Lazy loading of moved objects in six.moves.urllib_parse""" - - -_urllib_parse_moved_attributes = [ - MovedAttribute("ParseResult", "urlparse", "urllib.parse"), - MovedAttribute("parse_qs", "urlparse", "urllib.parse"), - MovedAttribute("parse_qsl", "urlparse", "urllib.parse"), - MovedAttribute("urldefrag", "urlparse", "urllib.parse"), - MovedAttribute("urljoin", "urlparse", "urllib.parse"), - MovedAttribute("urlparse", "urlparse", "urllib.parse"), - MovedAttribute("urlsplit", "urlparse", "urllib.parse"), - MovedAttribute("urlunparse", "urlparse", "urllib.parse"), - MovedAttribute("urlunsplit", "urlparse", "urllib.parse"), - MovedAttribute("quote", "urllib", "urllib.parse"), - MovedAttribute("quote_plus", "urllib", "urllib.parse"), - MovedAttribute("unquote", "urllib", "urllib.parse"), - MovedAttribute("unquote_plus", "urllib", "urllib.parse"), - MovedAttribute("urlencode", "urllib", "urllib.parse"), -] -for attr in _urllib_parse_moved_attributes: - setattr(Module_six_moves_urllib_parse, attr.name, attr) -del attr - -sys.modules[__name__ + ".moves.urllib_parse"] = Module_six_moves_urllib_parse( - __name__ + ".moves.urllib_parse") -sys.modules[__name__ + ".moves.urllib.parse"] = Module_six_moves_urllib_parse( - __name__ + ".moves.urllib.parse") - - -class Module_six_moves_urllib_error(types.ModuleType): - """Lazy loading of moved objects in six.moves.urllib_error""" - - -_urllib_error_moved_attributes = [ - MovedAttribute("URLError", "urllib2", "urllib.error"), - MovedAttribute("HTTPError", "urllib2", "urllib.error"), - MovedAttribute("ContentTooShortError", "urllib", "urllib.error"), -] -for attr in _urllib_error_moved_attributes: - setattr(Module_six_moves_urllib_error, attr.name, attr) -del attr - -sys.modules[__name__ + ".moves.urllib_error"] = Module_six_moves_urllib_error( - __name__ + ".moves.urllib_error") -sys.modules[__name__ + ".moves.urllib.error"] = Module_six_moves_urllib_error( - __name__ + ".moves.urllib.error") - - -class Module_six_moves_urllib_request(types.ModuleType): - """Lazy loading of moved objects in six.moves.urllib_request""" - - -_urllib_request_moved_attributes = [ - MovedAttribute("urlopen", "urllib2", "urllib.request"), - MovedAttribute("install_opener", "urllib2", "urllib.request"), - MovedAttribute("build_opener", "urllib2", "urllib.request"), - MovedAttribute("pathname2url", "urllib", "urllib.request"), - MovedAttribute("url2pathname", "urllib", "urllib.request"), - MovedAttribute("getproxies", "urllib", "urllib.request"), - MovedAttribute("Request", "urllib2", "urllib.request"), - MovedAttribute("OpenerDirector", "urllib2", "urllib.request"), - MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"), - MovedAttribute("ProxyHandler", "urllib2", "urllib.request"), - MovedAttribute("BaseHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"), - MovedAttribute("HTTPPasswordMgrWithDefaultRealm", - "urllib2", "urllib.request"), - MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"), - MovedAttribute("FileHandler", "urllib2", "urllib.request"), - MovedAttribute("FTPHandler", "urllib2", "urllib.request"), - MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"), - MovedAttribute("UnknownHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"), - MovedAttribute("urlretrieve", "urllib", "urllib.request"), - MovedAttribute("urlcleanup", "urllib", "urllib.request"), - MovedAttribute("URLopener", "urllib", "urllib.request"), - MovedAttribute("FancyURLopener", "urllib", "urllib.request"), -] -for attr in _urllib_request_moved_attributes: - setattr(Module_six_moves_urllib_request, attr.name, attr) -del attr - -sys.modules[__name__ + ".moves.urllib_request"] = Module_six_moves_urllib_request( - __name__ + ".moves.urllib_request") -sys.modules[__name__ + ".moves.urllib.request"] = Module_six_moves_urllib_request( - __name__ + ".moves.urllib.request") - - -class Module_six_moves_urllib_response(types.ModuleType): - """Lazy loading of moved objects in six.moves.urllib_response""" - - -_urllib_response_moved_attributes = [ - MovedAttribute("addbase", "urllib", "urllib.response"), - MovedAttribute("addclosehook", "urllib", "urllib.response"), - MovedAttribute("addinfo", "urllib", "urllib.response"), - MovedAttribute("addinfourl", "urllib", "urllib.response"), -] -for attr in _urllib_response_moved_attributes: - setattr(Module_six_moves_urllib_response, attr.name, attr) -del attr - -sys.modules[__name__ + ".moves.urllib_response"] = Module_six_moves_urllib_response( - __name__ + ".moves.urllib_response") -sys.modules[__name__ + ".moves.urllib.response"] = Module_six_moves_urllib_response( - __name__ + ".moves.urllib.response") - - -class Module_six_moves_urllib_robotparser(types.ModuleType): - """Lazy loading of moved objects in six.moves.urllib_robotparser""" - - -_urllib_robotparser_moved_attributes = [ - MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"), -] -for attr in _urllib_robotparser_moved_attributes: - setattr(Module_six_moves_urllib_robotparser, attr.name, attr) -del attr - -sys.modules[__name__ + ".moves.urllib_robotparser"] = Module_six_moves_urllib_robotparser( - __name__ + ".moves.urllib_robotparser") -sys.modules[__name__ + ".moves.urllib.robotparser"] = Module_six_moves_urllib_robotparser( - __name__ + ".moves.urllib.robotparser") - - -class Module_six_moves_urllib(types.ModuleType): - """Create a six.moves.urllib namespace that resembles the Python 3 namespace""" - parse = sys.modules[__name__ + ".moves.urllib_parse"] - error = sys.modules[__name__ + ".moves.urllib_error"] - request = sys.modules[__name__ + ".moves.urllib_request"] - response = sys.modules[__name__ + ".moves.urllib_response"] - robotparser = sys.modules[__name__ + ".moves.urllib_robotparser"] - - -sys.modules[ - __name__ + ".moves.urllib"] = Module_six_moves_urllib(__name__ + ".moves.urllib") - - -def add_move(move): - """Add an item to six.moves.""" - setattr(_MovedItems, move.name, move) - - -def remove_move(name): - """Remove item from six.moves.""" - try: - delattr(_MovedItems, name) - except AttributeError: - try: - del moves.__dict__[name] - except KeyError: - raise AttributeError("no such move, %r" % (name,)) - - -if PY3: - _meth_func = "__func__" - _meth_self = "__self__" - - _func_closure = "__closure__" - _func_code = "__code__" - _func_defaults = "__defaults__" - _func_globals = "__globals__" - - _iterkeys = "keys" - _itervalues = "values" - _iteritems = "items" - _iterlists = "lists" -else: - _meth_func = "im_func" - _meth_self = "im_self" - - _func_closure = "func_closure" - _func_code = "func_code" - _func_defaults = "func_defaults" - _func_globals = "func_globals" - - _iterkeys = "iterkeys" - _itervalues = "itervalues" - _iteritems = "iteritems" - _iterlists = "iterlists" - - -try: - advance_iterator = next -except NameError: - def advance_iterator(it): - return it.next() -next = advance_iterator - - -try: - callable = callable -except NameError: - def callable(obj): - return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) - - -if PY3: - def get_unbound_function(unbound): - return unbound - - create_bound_method = types.MethodType - - Iterator = object -else: - def get_unbound_function(unbound): - return unbound.im_func - - def create_bound_method(func, obj): - return types.MethodType(func, obj, obj.__class__) - - class Iterator(object): - - def next(self): - return type(self).__next__(self) - - callable = callable -_add_doc(get_unbound_function, - """Get the function out of a possibly unbound function""") - - -get_method_function = operator.attrgetter(_meth_func) -get_method_self = operator.attrgetter(_meth_self) -get_function_closure = operator.attrgetter(_func_closure) -get_function_code = operator.attrgetter(_func_code) -get_function_defaults = operator.attrgetter(_func_defaults) -get_function_globals = operator.attrgetter(_func_globals) - - -def iterkeys(d, **kw): - """Return an iterator over the keys of a dictionary.""" - return iter(getattr(d, _iterkeys)(**kw)) - - -def itervalues(d, **kw): - """Return an iterator over the values of a dictionary.""" - return iter(getattr(d, _itervalues)(**kw)) - - -def iteritems(d, **kw): - """Return an iterator over the (key, value) pairs of a dictionary.""" - return iter(getattr(d, _iteritems)(**kw)) - - -def iterlists(d, **kw): - """Return an iterator over the (key, [values]) pairs of a dictionary.""" - return iter(getattr(d, _iterlists)(**kw)) - - -if PY3: - def b(s): - return s.encode("latin-1") - - def u(s): - return s - unichr = chr - if sys.version_info[1] <= 1: - def int2byte(i): - return bytes((i,)) - else: - # This is about 2x faster than the implementation above on 3.2+ - int2byte = operator.methodcaller("to_bytes", 1, "big") - byte2int = operator.itemgetter(0) - indexbytes = operator.getitem - iterbytes = iter - import io - StringIO = io.StringIO - BytesIO = io.BytesIO -else: - def b(s): - return s - - def u(s): - return unicode(s, "unicode_escape") - unichr = unichr - int2byte = chr - - def byte2int(bs): - return ord(bs[0]) - - def indexbytes(buf, i): - return ord(buf[i]) - - def iterbytes(buf): - return (ord(byte) for byte in buf) - import StringIO - StringIO = BytesIO = StringIO.StringIO -_add_doc(b, """Byte literal""") -_add_doc(u, """Text literal""") - - -if PY3: - import builtins - exec_ = getattr(builtins, "exec") - - def reraise(tp, value, tb=None): - if value.__traceback__ is not tb: - raise value.with_traceback(tb) - raise value - - print_ = getattr(builtins, "print") - del builtins - -else: - def exec_(_code_, _globs_=None, _locs_=None): - """Execute code in a namespace.""" - if _globs_ is None: - frame = sys._getframe(1) - _globs_ = frame.f_globals - if _locs_ is None: - _locs_ = frame.f_locals - del frame - elif _locs_ is None: - _locs_ = _globs_ - exec("""exec _code_ in _globs_, _locs_""") - - exec_("""def reraise(tp, value, tb=None): - raise tp, value, tb -""") - - def print_(*args, **kwargs): - """The new-style print function.""" - fp = kwargs.pop("file", sys.stdout) - if fp is None: - return - - def write(data): - if not isinstance(data, basestring): - data = str(data) - fp.write(data) - want_unicode = False - sep = kwargs.pop("sep", None) - if sep is not None: - if isinstance(sep, unicode): - want_unicode = True - elif not isinstance(sep, str): - raise TypeError("sep must be None or a string") - end = kwargs.pop("end", None) - if end is not None: - if isinstance(end, unicode): - want_unicode = True - elif not isinstance(end, str): - raise TypeError("end must be None or a string") - if kwargs: - raise TypeError("invalid keyword arguments to print()") - if not want_unicode: - for arg in args: - if isinstance(arg, unicode): - want_unicode = True - break - if want_unicode: - newline = unicode("\n") - space = unicode(" ") - else: - newline = "\n" - space = " " - if sep is None: - sep = space - if end is None: - end = newline - for i, arg in enumerate(args): - if i: - write(sep) - write(arg) - write(end) - -_add_doc(reraise, """Reraise an exception.""") - - -def with_metaclass(meta, *bases): - """Create a base class with a metaclass.""" - return meta("NewBase", bases, {}) - - -def add_metaclass(metaclass): - """Class decorator for creating a class with a metaclass.""" - def wrapper(cls): - orig_vars = cls.__dict__.copy() - orig_vars.pop('__dict__', None) - orig_vars.pop('__weakref__', None) - for slots_var in orig_vars.get('__slots__', ()): - orig_vars.pop(slots_var) - return metaclass(cls.__name__, cls.__bases__, orig_vars) - return wrapper diff -Nru python-ptrace-0.9.3/ptrace/syscall/__init__.py python-ptrace-0.9.7/ptrace/syscall/__init__.py --- python-ptrace-0.9.3/ptrace/syscall/__init__.py 2017-02-10 12:38:50.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/__init__.py 2020-08-10 22:45:22.000000000 +0200 @@ -1,4 +1,4 @@ from ptrace.syscall.names import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES # noqa -from ptrace.syscall.prototypes import SYSCALL_PROTOTYPES, FILENAME_ARGUMENTS, DIRFD_ARGUMENTS # noqa +from ptrace.syscall.prototypes import SYSCALL_PROTOTYPES, FILENAME_ARGUMENTS # noqa from ptrace.syscall.syscall_argument import SyscallArgument # noqa from ptrace.syscall.ptrace_syscall import PtraceSyscall, SYSCALL_REGISTER, RETURN_VALUE_REGISTER # noqa diff -Nru python-ptrace-0.9.3/ptrace/syscall/linux/i386.py python-ptrace-0.9.7/ptrace/syscall/linux/i386.py --- python-ptrace-0.9.3/ptrace/syscall/linux/i386.py 1970-01-01 01:00:00.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/linux/i386.py 2020-08-10 22:45:22.000000000 +0200 @@ -0,0 +1,329 @@ +# Linux kernel syscall list from Linux 2.6.21 for i386 +# +# List extracted from Linux kernel source code, see: +# arch/i386/kernel/syscall_table.S +SYSCALL_NAMES = { + 0: "restart_syscall", + 1: "exit", + 2: "fork", + 3: "read", + 4: "write", + 5: "open", + 6: "close", + 7: "waitpid", + 8: "creat", + 9: "link", + 10: "unlink", + 11: "execve", + 12: "chdir", + 13: "time", + 14: "mknod", + 15: "chmod", + 16: "lchown16", + # 17: - + 18: "stat", + 19: "lseek", + 20: "getpid", + 21: "mount", + 22: "oldumount", + 23: "setuid16", + 24: "getuid16", + 25: "stime", + 26: "ptrace", + 27: "alarm", + 28: "fstat", + 29: "pause", + 30: "utime", + # 31: - + # 32: - + 33: "access", + 34: "nice", + # 35: - + 36: "sync", + 37: "kill", + 38: "rename", + 39: "mkdir", + 40: "rmdir", + 41: "dup", + 42: "pipe", + 43: "times", + # 44: - + 45: "brk", + 46: "setgid16", + 47: "getgid16", + 48: "signal", + 49: "geteuid16", + 50: "getegid16", + 51: "acct", + 52: "umount", + # 53: - + 54: "ioctl", + 55: "fcntl", + # 56: - + 57: "setpgid", + # 58: - + 59: "oldolduname", + 60: "umask", + 61: "chroot", + 62: "ustat", + 63: "dup2", + 64: "getppid", + 65: "getpgrp", + 66: "setsid", + 67: "sigaction", + 68: "sgetmask", + 69: "ssetmask", + 70: "setreuid16", + 71: "setregid16", + 72: "sigsuspend", + 73: "sigpending", + 74: "sethostname", + 75: "setrlimit", + 76: "old_getrlimit", + 77: "getrusage", + 78: "gettimeofday", + 79: "settimeofday", + 80: "getgroups16", + 81: "setgroups16", + 82: "old_select", + 83: "symlink", + 84: "lstat", + 85: "readlink", + 86: "uselib", + 87: "swapon", + 88: "reboot", + 89: "old_readdir", + 90: "old_mmap", + 91: "munmap", + 92: "truncate", + 93: "ftruncate", + 94: "fchmod", + 95: "fchown16", + 96: "getpriority", + 97: "setpriority", + # 98: - + 99: "statfs", + 100: "fstatfs", + 101: "ioperm", + 102: "socketcall", + 103: "syslog", + 104: "setitimer", + 105: "getitimer", + 106: "newstat", + 107: "newlstat", + 108: "newfstat", + 109: "olduname", + 110: "iopl", + 111: "vhangup", + # 112: old "idle" + 113: "vm86old", + 114: "wait4", + 115: "swapoff", + 116: "sysinfo", + 117: "ipc", + 118: "fsync", + 119: "sigreturn", + 120: "clone", + 121: "setdomainname", + 122: "uname", + 123: "modify_ldt", + 124: "adjtimex", + 125: "mprotect", + 126: "sigprocmask", + # 127: old "create_module" + 128: "init_module", + 129: "delete_module", + # 130: old "get_kernel_syms" + 131: "quotactl", + 132: "getpgid", + 133: "fchdir", + 134: "bdflush", + 135: "sysfs", + 136: "personality", + # 137: reserved for afs_syscall + 138: "setfsuid16", + 139: "setfsgid16", + 140: "llseek", + 141: "getdents", + 142: "select", + 143: "flock", + 144: "msync", + 145: "readv", + 146: "writev", + 147: "getsid", + 148: "fdatasync", + 149: "sysctl", + 150: "mlock", + 151: "munlock", + 152: "mlockall", + 153: "munlockall", + 154: "sched_setparam", + 155: "sched_getparam", + 156: "sched_setscheduler", + 157: "sched_getscheduler", + 158: "sched_yield", + 159: "sched_get_priority_max", + 160: "sched_get_priority_min", + 161: "sched_rr_get_interval", + 162: "nanosleep", + 163: "mremap", + 164: "setresuid16", + 165: "getresuid16", + 166: "vm86", + # 167: old "query_module" + 168: "poll", + 169: "nfsservctl", + 170: "setresgid16", + 171: "getresgid16", + 172: "prctl", + 173: "rt_sigreturn", + 174: "rt_sigaction", + 175: "rt_sigprocmask", + 176: "rt_sigpending", + 177: "rt_sigtimedwait", + 178: "rt_sigqueueinfo", + 179: "rt_sigsuspend", + 180: "pread64", + 181: "pwrite64", + 182: "chown16", + 183: "getcwd", + 184: "capget", + 185: "capset", + 186: "sigaltstack", + 187: "sendfile", + # 188: (reserved) + # 189: (reserved) + 190: "vfork", + 191: "getrlimit", + 192: "mmap2", + 193: "truncate64", + 194: "ftruncate64", + 195: "stat64", + 196: "lstat64", + 197: "fstat64", + 198: "lchown", + 199: "getuid", + 200: "getgid", + 201: "geteuid", + 202: "getegid", + 203: "setreuid", + 204: "setregid", + 205: "getgroups", + 206: "setgroups", + 207: "fchown", + 208: "setresuid", + 209: "getresuid", + 210: "setresgid", + 211: "getresgid", + 212: "chown", + 213: "setuid", + 214: "setgid", + 215: "setfsuid", + 216: "setfsgid", + # ------------------------------- + 217: "pivot_root", + 218: "mincore", + 219: "madvise", + 220: "getdents64", + 221: "fcntl64", + # 222: - + # 223: - + 224: "gettid", + 225: "readahead", + 226: "setxattr", + 227: "lsetxattr", + 228: "fsetxattr", + 229: "getxattr", + 230: "lgetxattr", + 231: "fgetxattr", + 232: "listxattr", + 233: "llistxattr", + 234: "flistxattr", + 235: "removexattr", + 236: "lremovexattr", + 237: "fremovexattr", + 238: "tkill", + 239: "sendfile64", + 240: "futex", + 241: "sched_setaffinity", + 242: "sched_getaffinity", + 243: "set_thread_area", + 244: "get_thread_area", + 245: "io_setup", + 246: "io_destroy", + 247: "io_getevents", + 248: "io_submit", + 249: "io_cancel", + 250: "fadvise64", + # 251: - + 252: "exit_group", + 253: "lookup_dcookie", + 254: "epoll_create", + 255: "epoll_ctl", + 256: "epoll_wait", + 257: "remap_file_pages", + 258: "set_tid_address", + 259: "timer_create", + 260: "timer_settime", + 261: "timer_gettime", + 262: "timer_getoverrun", + 263: "timer_delete", + 264: "clock_settime", + 265: "clock_gettime", + 266: "clock_getres", + 267: "clock_nanosleep", + 268: "statfs64", + 269: "fstatfs64", + 270: "tgkill", + 271: "utimes", + 272: "fadvise64_64", + # 273: - + 274: "mbind", + 275: "get_mempolicy", + 276: "set_mempolicy", + 277: "mq_open", + 278: "mq_unlink", + 279: "mq_timedsend", + 280: "mq_timedreceive", + 281: "mq_notify", + 282: "mq_getsetattr", + 283: "kexec_load", + 284: "waitid", + # 285: - + 286: "add_key", + 287: "request_key", + 288: "keyctl", + 289: "ioprio_set", + 290: "ioprio_get", + 291: "inotify_init", + 292: "inotify_add_watch", + 293: "inotify_rm_watch", + 294: "migrate_pages", + 295: "openat", + 296: "mkdirat", + 297: "mknodat", + 298: "fchownat", + 299: "futimesat", + 300: "fstatat64", + 301: "unlinkat", + 302: "renameat", + 303: "linkat", + 304: "symlinkat", + 305: "readlinkat", + 306: "fchmodat", + 307: "faccessat", + 308: "pselect6", + 309: "ppoll", + 310: "unshare", + 311: "set_robust_list", + 312: "get_robust_list", + 313: "splice", + 314: "sync_file_range", + 315: "tee", + 316: "vmsplice", + 317: "move_pages", + 318: "getcpu", + 319: "epoll_pwait", +} + +SOCKET_SYSCALL_NAMES = set(("socketcall",)) diff -Nru python-ptrace-0.9.3/ptrace/syscall/linux/powerpc32.py python-ptrace-0.9.7/ptrace/syscall/linux/powerpc32.py --- python-ptrace-0.9.3/ptrace/syscall/linux/powerpc32.py 1970-01-01 01:00:00.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/linux/powerpc32.py 2020-08-10 22:45:22.000000000 +0200 @@ -0,0 +1,439 @@ +# From the kernel sources, arch/powerpc/kernel/syscalls/syscall.tbl + +SYSCALL_NAMES = { + 0: "restart_syscall", + 1: "exit", + 2: "fork", + 3: "read", + 4: "write", + 5: "open", + 6: "close", + 7: "waitpid", + 8: "creat", + 9: "link", + 10: "unlink", + 11: "execve", + 12: "chdir", + 13: "time", + 14: "mknod", + 15: "chmod", + 16: "lchown", + 17: "break", + 18: "oldstat", + 19: "lseek", + 20: "getpid", + 21: "mount", + 22: "umount", + 23: "setuid", + 24: "getuid", + 25: "stime", + 26: "ptrace", + 27: "alarm", + 28: "oldfstat", + 29: "pause", + 30: "utime", + 31: "stty", + 32: "gtty", + 33: "access", + 34: "nice", + 35: "ftime", + 36: "sync", + 37: "kill", + 38: "rename", + 39: "mkdir", + 40: "rmdir", + 41: "dup", + 42: "pipe", + 43: "times", + 44: "prof", + 45: "brk", + 46: "setgid", + 47: "getgid", + 48: "signal", + 49: "geteuid", + 50: "getegid", + 51: "acct", + 52: "umount2", + 53: "lock", + 54: "ioctl", + 55: "fcntl", + 56: "mpx", + 57: "setpgid", + 58: "ulimit", + 59: "oldolduname", + 60: "umask", + 61: "chroot", + 62: "ustat", + 63: "dup2", + 64: "getppid", + 65: "getpgrp", + 66: "setsid", + 67: "sigaction", + 68: "sgetmask", + 69: "ssetmask", + 70: "setreuid", + 71: "setregid", + 72: "sigsuspend", + 73: "sigpending", + 74: "sethostname", + 75: "setrlimit", + 76: "getrlimit", + 77: "getrusage", + 78: "gettimeofday", + 79: "settimeofday", + 80: "getgroups", + 81: "setgroups", + 82: "select", + 83: "symlink", + 84: "oldlstat", + 85: "readlink", + 86: "uselib", + 87: "swapon", + 88: "reboot", + 89: "readdir", + 90: "mmap", + 91: "munmap", + 92: "truncate", + 93: "ftruncate", + 94: "fchmod", + 95: "fchown", + 96: "getpriority", + 97: "setpriority", + 98: "profil", + 99: "statfs", + 100: "fstatfs", + 101: "ioperm", + 102: "socketcall", + 103: "syslog", + 104: "setitimer", + 105: "getitimer", + 106: "stat", + 107: "lstat", + 108: "fstat", + 109: "olduname", + 110: "iopl", + 111: "vhangup", + 112: "idle", + 113: "vm86", + 114: "wait4", + 115: "swapoff", + 116: "sysinfo", + 117: "ipc", + 118: "fsync", + 119: "sigreturn", + 120: "clone", + 121: "setdomainname", + 122: "uname", + 123: "modify_ldt", + 124: "adjtimex", + 125: "mprotect", + 126: "sigprocmask", + 127: "create_module", + 128: "init_module", + 129: "delete_module", + 130: "get_kernel_syms", + 131: "quotactl", + 132: "getpgid", + 133: "fchdir", + 134: "bdflush", + 135: "sysfs", + 136: "personality", + 137: "afs_syscall", + 138: "setfsuid", + 139: "setfsgid", + 140: "_llseek", + 141: "getdents", + 142: "_newselect", + 143: "flock", + 144: "msync", + 145: "readv", + 146: "writev", + 147: "getsid", + 148: "fdatasync", + 149: "_sysctl", + 150: "mlock", + 151: "munlock", + 152: "mlockall", + 153: "munlockall", + 154: "sched_setparam", + 155: "sched_getparam", + 156: "sched_setscheduler", + 157: "sched_getscheduler", + 158: "sched_yield", + 159: "sched_get_priority_max", + 160: "sched_get_priority_min", + 161: "sched_rr_get_interval", + 162: "nanosleep", + 163: "mremap", + 164: "setresuid", + 165: "getresuid", + 166: "query_module", + 167: "poll", + 168: "nfsservctl", + 169: "setresgid", + 170: "getresgid", + 171: "prctl", + 172: "rt_sigreturn", + 173: "rt_sigaction", + 174: "rt_sigprocmask", + 175: "rt_sigpending", + 176: "rt_sigtimedwait", + 177: "", + 178: "", + 179: "pread64", + 180: "pwrite64", + 181: "chown", + 182: "getcwd", + 183: "capget", + 184: "capset", + 185: "sigaltstack", + 186: "sendfile", + 187: "getpmsg", + 188: "", + 189: "vfork", + 190: "ugetrlimit", + 191: "readahead", + 192: "mmap2", + 193: "truncate64", + 194: "ftruncate64", + 195: "stat64", + 196: "lstat64", + 197: "fstat64", + 198: "", + 199: "", + 200: "", + 201: "", + 202: "getdents64", + 203: "pivot_root", + 204: "fcntl64", + 205: "madvise", + 206: "mincore", + 207: "gettid", + 208: "tkill", + 209: "setxattr", + 210: "lsetxattr", + 211: "fsetxattr", + 212: "getxattr", + 213: "lgetxattr", + 214: "fgetxattr", + 215: "listxattr", + 216: "llistxattr", + 217: "flistxattr", + 218: "removexattr", + 219: "lremovexattr", + 220: "fremovexattr", + 221: "futex", + 222: "sched_setaffinity", + 223: "sched_getaffinity", + 225: "tuxcall", + 226: "sendfile64", + 227: "io_setup", + 228: "io_destroy", + 229: "io_getevents", + 230: "io_submit", + 231: "io_cancel", + 232: "set_tid_address", + 233: "fadvise64", + 234: "exit_group", + 235: "lookup_dcookie", + 236: "epoll_create", + 237: "epoll_ctl", + 238: "epoll_wait", + 239: "remap_file_pages", + 240: "timer_create", + 241: "timer_settime", + 242: "timer_gettime", + 243: "timer_getoverrun", + 244: "timer_delete", + 245: "clock_settime", + 246: "clock_gettime", + 247: "clock_getres", + 248: "clock_nanosleep", + 249: "swapcontext", + 250: "tgkill", + 251: "utimes", + 252: "statfs64", + 253: "fstatfs64", + 254: "fadvise64_64", + 255: "rtas", + 256: "sys_debug_setcontext", + 258: "migrate_pages", + 259: "mbind", + 260: "get_mempolicy", + 261: "set_mempolicy", + 262: "mq_open", + 263: "mq_unlink", + 264: "mq_timedsend", + 265: "mq_timedreceive", + 266: "mq_notify", + 267: "mq_getsetattr", + 268: "kexec_load", + 269: "add_key", + 270: "request_key", + 271: "keyctl", + 272: "waitid", + 273: "ioprio_set", + 274: "ioprio_get", + 275: "inotify_init", + 276: "inotify_add_watch", + 277: "inotify_rm_watch", + 280: "pselect6", + 281: "ppoll", + 282: "unshare", + 283: "splice", + 284: "tee", + 285: "vmsplice", + 286: "openat", + 287: "mkdirat", + 288: "mknodat", + 289: "fchownat", + 290: "futimesat", + 291: "fstatat64", + 292: "unlinkat", + 293: "renameat", + 294: "linkat", + 295: "symlinkat", + 296: "readlinkat", + 297: "fchmodat", + 298: "faccessat", + 299: "get_robust_list", + 300: "set_robust_list", + 301: "move_pages", + 302: "getcpu", + 303: "epoll_pwait", + 304: "utimensat", + 305: "signalfd", + 306: "timerfd_create", + 307: "eventfd", + 308: "sync_file_range2", + 309: "fallocate", + 310: "subpage_prot", + 311: "timerfd_settime", + 312: "timerfd_gettime", + 313: "signalfd4", + 314: "eventfd2", + 315: "epoll_create1", + 316: "dup3", + 317: "pipe2", + 318: "inotify_init1", + 319: "perf_event_open", + 320: "preadv", + 321: "pwritev", + 322: "rt_tgsigqueueinfo", + 323: "fanotify_init", + 324: "fanotify_mark", + 325: "prlimit64", + 326: "socket", + 327: "bind", + 328: "connect", + 329: "listen", + 330: "accept", + 331: "getsockname", + 332: "getpeername", + 333: "socketpair", + 334: "send", + 335: "sendto", + 336: "recv", + 337: "recvfrom", + 338: "shutdown", + 339: "setsockopt", + 340: "getsockopt", + 341: "sendmsg", + 342: "recvmsg", + 343: "recvmmsg", + 344: "accept4", + 345: "name_to_handle_at", + 346: "open_by_handle_at", + 347: "clock_adjtime", + 348: "syncfs", + 349: "sendmmsg", + 350: "setns", + 351: "process_vm_readv", + 352: "process_vm_writev", + 353: "finit_module", + 354: "kcmp", + 355: "sched_setattr", + 356: "sched_getattr", + 357: "renameat2", + 358: "seccomp", + 359: "getrandom", + 360: "memfd_create", + 361: "bpf", + 362: "execveat", + 363: "switch_endian", + 364: "userfaultfd", + 365: "membarrier", + 378: "mlock2", + 379: "copy_file_range", + 380: "preadv2", + 381: "pwritev2", + 382: "kexec_file_load", + 383: "statx", + 384: "pkey_alloc", + 385: "pkey_free", + 386: "pkey_mprotect", + 387: "rseq", + 388: "io_pgetevents", + 393: "semget", + 394: "semctl", + 395: "shmget", + 396: "shmctl", + 397: "shmat", + 398: "shmdt", + 399: "msgget", + 400: "msgsnd", + 401: "msgrcv", + 402: "msgctl", + 403: "clock_gettime64", + 404: "clock_settime64", + 405: "clock_adjtime64", + 406: "clock_getres_time64", + 407: "clock_nanosleep_time64", + 408: "timer_gettime64", + 409: "timer_settime64", + 410: "timerfd_gettime64", + 411: "timerfd_settime64", + 412: "utimensat_time64", + 413: "pselect6_time64", + 414: "ppoll_time64", + 416: "io_pgetevents_time64", + 417: "recvmmsg_time64", + 418: "mq_timedsend_time64", + 419: "mq_timedreceive_time64", + 420: "semtimedop_time64", + 421: "rt_sigtimedwait_time64", + 422: "futex_time64", + 423: "sched_rr_get_interval_time64", + 424: "pidfd_send_signal", + 425: "io_uring_setup", + 426: "io_uring_enter", + 427: "io_uring_register", + 428: "open_tree", + 429: "move_mount", + 430: "fsopen", + 431: "fsconfig", + 432: "fsmount", + 433: "fspick", + 434: "pidfd_open", + 435: "clone3", + 437: "openat2", + 438: "pidfd_getfd" +} + +SOCKET_SYSCALL_NAMES = set(( + "socket", + "socketpair", + "connect", + "sendto", + "recvfrom", + "sendmsg", + "recvmsg", + "bind", + "listen", + "accept", + "getsockname", + "getpeername", + "getsockopt", + "setsockopt", + "shutdown", +)) diff -Nru python-ptrace-0.9.3/ptrace/syscall/linux/powerpc64.py python-ptrace-0.9.7/ptrace/syscall/linux/powerpc64.py --- python-ptrace-0.9.3/ptrace/syscall/linux/powerpc64.py 1970-01-01 01:00:00.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/linux/powerpc64.py 2020-08-10 22:45:22.000000000 +0200 @@ -0,0 +1,411 @@ +# From the kernel sources, arch/powerpc/kernel/syscalls/syscall.tbl + +SYSCALL_NAMES = { + 0: "restart_syscall", + 1: "exit", + 2: "fork", + 3: "read", + 4: "write", + 5: "open", + 6: "close", + 7: "waitpid", + 8: "creat", + 9: "link", + 10: "unlink", + 11: "execve", + 12: "chdir", + 13: "time", + 14: "mknod", + 15: "chmod", + 16: "lchown", + 17: "break", + 18: "oldstat", + 19: "lseek", + 20: "getpid", + 21: "mount", + 22: "umount", + 23: "setuid", + 24: "getuid", + 25: "stime", + 26: "ptrace", + 27: "alarm", + 28: "oldfstat", + 29: "pause", + 30: "utime", + 31: "stty", + 32: "gtty", + 33: "access", + 34: "nice", + 35: "ftime", + 36: "sync", + 37: "kill", + 38: "rename", + 39: "mkdir", + 40: "rmdir", + 41: "dup", + 42: "pipe", + 43: "times", + 44: "prof", + 45: "brk", + 46: "setgid", + 47: "getgid", + 48: "signal", + 49: "geteuid", + 50: "getegid", + 51: "acct", + 52: "umount2", + 53: "lock", + 54: "ioctl", + 55: "fcntl", + 56: "mpx", + 57: "setpgid", + 58: "ulimit", + 59: "oldolduname", + 60: "umask", + 61: "chroot", + 62: "ustat", + 63: "dup2", + 64: "getppid", + 65: "getpgrp", + 66: "setsid", + 67: "sigaction", + 68: "sgetmask", + 69: "ssetmask", + 70: "setreuid", + 71: "setregid", + 72: "sigsuspend", + 73: "sigpending", + 74: "sethostname", + 75: "setrlimit", + 76: "getrlimit", + 77: "getrusage", + 78: "gettimeofday", + 79: "settimeofday", + 80: "getgroups", + 81: "setgroups", + 82: "select", + 83: "symlink", + 84: "oldlstat", + 85: "readlink", + 86: "uselib", + 87: "swapon", + 88: "reboot", + 89: "readdir", + 90: "mmap", + 91: "munmap", + 92: "truncate", + 93: "ftruncate", + 94: "fchmod", + 95: "fchown", + 96: "getpriority", + 97: "setpriority", + 98: "profil", + 99: "statfs", + 100: "fstatfs", + 101: "ioperm", + 102: "socketcall", + 103: "syslog", + 104: "setitimer", + 105: "getitimer", + 106: "stat", + 107: "lstat", + 108: "fstat", + 109: "olduname", + 110: "iopl", + 111: "vhangup", + 112: "idle", + 113: "vm86", + 114: "wait4", + 115: "swapoff", + 116: "sysinfo", + 117: "ipc", + 118: "fsync", + 119: "sigreturn", + 120: "clone", + 121: "setdomainname", + 122: "uname", + 123: "modify_ldt", + 124: "adjtimex", + 125: "mprotect", + 126: "sigprocmask", + 127: "create_module", + 128: "init_module", + 129: "delete_module", + 130: "get_kernel_syms", + 131: "quotactl", + 132: "getpgid", + 133: "fchdir", + 134: "bdflush", + 135: "sysfs", + 136: "personality", + 137: "afs_syscall", + 138: "setfsuid", + 139: "setfsgid", + 140: "_llseek", + 141: "getdents", + 142: "_newselect", + 143: "flock", + 144: "msync", + 145: "readv", + 146: "writev", + 147: "getsid", + 148: "fdatasync", + 149: "_sysctl", + 150: "mlock", + 151: "munlock", + 152: "mlockall", + 153: "munlockall", + 154: "sched_setparam", + 155: "sched_getparam", + 156: "sched_setscheduler", + 157: "sched_getscheduler", + 158: "sched_yield", + 159: "sched_get_priority_max", + 160: "sched_get_priority_min", + 161: "sched_rr_get_interval", + 162: "nanosleep", + 163: "mremap", + 164: "setresuid", + 165: "getresuid", + 166: "query_module", + 167: "poll", + 168: "nfsservctl", + 169: "setresgid", + 170: "getresgid", + 171: "prctl", + 172: "rt_sigreturn", + 173: "rt_sigaction", + 174: "rt_sigprocmask", + 175: "rt_sigpending", + 176: "rt_sigtimedwait", + 177: "rt_sigqueueinfo", + 178: "rt_sigsuspend", + 179: "pread64", + 180: "pwrite64", + 181: "chown", + 182: "getcwd", + 183: "capget", + 184: "capset", + 185: "sigaltstack", + 186: "sendfile", + 187: "getpmsg", + 188: "putpmsg", + 189: "vfork", + 190: "ugetrlimit", + 191: "readahead", + 198: "pciconfig_read", + 199: "pciconfig_write", + 200: "pciconfig_iobase", + 201: "multiplexer", + 202: "getdents64", + 203: "pivot_root", + 205: "madvise", + 206: "mincore", + 207: "gettid", + 208: "tkill", + 209: "setxattr", + 210: "lsetxattr", + 211: "fsetxattr", + 212: "getxattr", + 213: "lgetxattr", + 214: "fgetxattr", + 215: "listxattr", + 216: "llistxattr", + 217: "flistxattr", + 218: "removexattr", + 219: "lremovexattr", + 220: "fremovexattr", + 221: "futex", + 222: "sched_setaffinity", + 223: "sched_getaffinity", + 225: "tuxcall", + 227: "io_setup", + 228: "io_destroy", + 229: "io_getevents", + 230: "io_submit", + 231: "io_cancel", + 232: "set_tid_address", + 233: "fadvise64", + 234: "exit_group", + 235: "lookup_dcookie", + 236: "epoll_create", + 237: "epoll_ctl", + 238: "epoll_wait", + 239: "remap_file_pages", + 240: "timer_create", + 241: "timer_settime", + 242: "timer_gettime", + 243: "timer_getoverrun", + 244: "timer_delete", + 245: "clock_settime", + 246: "clock_gettime", + 247: "clock_getres", + 248: "clock_nanosleep", + 249: "swapcontext", + 250: "tgkill", + 251: "utimes", + 252: "statfs64", + 253: "fstatfs64", + 255: "rtas", + 256: "sys_debug_setcontext", + 258: "migrate_pages", + 259: "mbind", + 260: "get_mempolicy", + 261: "set_mempolicy", + 262: "mq_open", + 263: "mq_unlink", + 264: "mq_timedsend", + 265: "mq_timedreceive", + 266: "mq_notify", + 267: "mq_getsetattr", + 268: "kexec_load", + 269: "add_key", + 270: "request_key", + 271: "keyctl", + 272: "waitid", + 273: "ioprio_set", + 274: "ioprio_get", + 275: "inotify_init", + 276: "inotify_add_watch", + 277: "inotify_rm_watch", + 280: "pselect6", + 281: "ppoll", + 282: "unshare", + 283: "splice", + 284: "tee", + 285: "vmsplice", + 286: "openat", + 287: "mkdirat", + 288: "mknodat", + 289: "fchownat", + 290: "futimesat", + 291: "newfstatat", + 292: "unlinkat", + 293: "renameat", + 294: "linkat", + 295: "symlinkat", + 296: "readlinkat", + 297: "fchmodat", + 298: "faccessat", + 299: "get_robust_list", + 300: "set_robust_list", + 301: "move_pages", + 302: "getcpu", + 303: "epoll_pwait", + 304: "utimensat", + 305: "signalfd", + 306: "timerfd_create", + 307: "eventfd", + 308: "sync_file_range2", + 309: "fallocate", + 310: "subpage_prot", + 311: "timerfd_settime", + 312: "timerfd_gettime", + 313: "signalfd4", + 314: "eventfd2", + 315: "epoll_create1", + 316: "dup3", + 317: "pipe2", + 318: "inotify_init1", + 319: "perf_event_open", + 320: "preadv", + 321: "pwritev", + 322: "rt_tgsigqueueinfo", + 323: "fanotify_init", + 324: "fanotify_mark", + 325: "prlimit64", + 326: "socket", + 327: "bind", + 328: "connect", + 329: "listen", + 330: "accept", + 331: "getsockname", + 332: "getpeername", + 333: "socketpair", + 334: "send", + 335: "sendto", + 336: "recv", + 337: "recvfrom", + 338: "shutdown", + 339: "setsockopt", + 340: "getsockopt", + 341: "sendmsg", + 342: "recvmsg", + 343: "recvmmsg", + 344: "accept4", + 345: "name_to_handle_at", + 346: "open_by_handle_at", + 347: "clock_adjtime", + 348: "syncfs", + 349: "sendmmsg", + 350: "setns", + 351: "process_vm_readv", + 352: "process_vm_writev", + 353: "finit_module", + 354: "kcmp", + 355: "sched_setattr", + 356: "sched_getattr", + 357: "renameat2", + 358: "seccomp", + 359: "getrandom", + 360: "memfd_create", + 361: "bpf", + 362: "execveat", + 363: "switch_endian", + 364: "userfaultfd", + 365: "membarrier", + 378: "mlock2", + 379: "copy_file_range", + 380: "preadv2", + 381: "pwritev2", + 382: "kexec_file_load", + 383: "statx", + 384: "pkey_alloc", + 385: "pkey_free", + 386: "pkey_mprotect", + 387: "rseq", + 388: "io_pgetevents", + 392: "semtimedop", + 393: "semget", + 394: "semctl", + 395: "shmget", + 396: "shmctl", + 397: "shmat", + 398: "shmdt", + 399: "msgget", + 400: "msgsnd", + 401: "msgrcv", + 402: "msgctl", + 424: "pidfd_send_signal", + 425: "io_uring_setup", + 426: "io_uring_enter", + 427: "io_uring_register", + 428: "open_tree", + 429: "move_mount", + 430: "fsopen", + 431: "fsconfig", + 432: "fsmount", + 433: "fspick", + 434: "pidfd_open", + 435: "clone3", + 437: "openat2", + 438: "pidfd_getfd" +} + +SOCKET_SYSCALL_NAMES = set(( + "socket", + "socketpair", + "connect", + "sendto", + "recvfrom", + "sendmsg", + "recvmsg", + "bind", + "listen", + "accept", + "getsockname", + "getpeername", + "getsockopt", + "setsockopt", + "shutdown", +)) diff -Nru python-ptrace-0.9.3/ptrace/syscall/linux/x86_64.py python-ptrace-0.9.7/ptrace/syscall/linux/x86_64.py --- python-ptrace-0.9.3/ptrace/syscall/linux/x86_64.py 1970-01-01 01:00:00.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/linux/x86_64.py 2020-08-10 22:45:22.000000000 +0200 @@ -0,0 +1,297 @@ +# Linux kernel 2.6.23 on Intel Core2 Duo E6400 +SYSCALL_NAMES = { + 0: "read", + 1: "write", + 2: "open", + 3: "close", + 4: "stat", + 5: "fstat", + 6: "lstat", + 7: "poll", + 8: "lseek", + 9: "mmap", + 10: "mprotect", + 11: "munmap", + 12: "brk", + 13: "rt_sigaction", + 14: "rt_sigprocmask", + 15: "rt_sigreturn", + 16: "ioctl", + 17: "pread64", + 18: "pwrite64", + 19: "readv", + 20: "writev", + 21: "access", + 22: "pipe", + 23: "select", + 24: "sched_yield", + 25: "mremap", + 26: "msync", + 27: "mincore", + 28: "madvise", + 29: "shmget", + 30: "shmat", + 31: "shmctl", + 32: "dup", + 33: "dup2", + 34: "pause", + 35: "nanosleep", + 36: "getitimer", + 37: "alarm", + 38: "setitimer", + 39: "getpid", + 40: "sendfile", + 41: "socket", + 42: "connect", + 43: "accept", + 44: "sendto", + 45: "recvfrom", + 46: "sendmsg", + 47: "recvmsg", + 48: "shutdown", + 49: "bind", + 50: "listen", + 51: "getsockname", + 52: "getpeername", + 53: "socketpair", + 54: "setsockopt", + 55: "getsockopt", + 56: "clone", + 57: "fork", + 58: "vfork", + 59: "execve", + 60: "exit", + 61: "wait4", + 62: "kill", + 63: "uname", + 64: "semget", + 65: "semop", + 66: "semctl", + 67: "shmdt", + 68: "msgget", + 69: "msgsnd", + 70: "msgrcv", + 71: "msgctl", + 72: "fcntl", + 73: "flock", + 74: "fsync", + 75: "fdatasync", + 76: "truncate", + 77: "ftruncate", + 78: "getdents", + 79: "getcwd", + 80: "chdir", + 81: "fchdir", + 82: "rename", + 83: "mkdir", + 84: "rmdir", + 85: "creat", + 86: "link", + 87: "unlink", + 88: "symlink", + 89: "readlink", + 90: "chmod", + 91: "fchmod", + 92: "chown", + 93: "fchown", + 94: "lchown", + 95: "umask", + 96: "gettimeofday", + 97: "getrlimit", + 98: "getrusage", + 99: "sysinfo", + 100: "times", + 101: "ptrace", + 102: "getuid", + 103: "syslog", + 104: "getgid", + 105: "setuid", + 106: "setgid", + 107: "geteuid", + 108: "getegid", + 109: "setpgid", + 110: "getppid", + 111: "getpgrp", + 112: "setsid", + 113: "setreuid", + 114: "setregid", + 115: "getgroups", + 116: "setgroups", + 117: "setresuid", + 118: "getresuid", + 119: "setresgid", + 120: "getresgid", + 121: "getpgid", + 122: "setfsuid", + 123: "setfsgid", + 124: "getsid", + 125: "capget", + 126: "capset", + 127: "rt_sigpending", + 128: "rt_sigtimedwait", + 129: "rt_sigqueueinfo", + 130: "rt_sigsuspend", + 131: "sigaltstack", + 132: "utime", + 133: "mknod", + 134: "uselib", + 135: "personality", + 136: "ustat", + 137: "statfs", + 138: "fstatfs", + 139: "sysfs", + 140: "getpriority", + 141: "setpriority", + 142: "sched_setparam", + 143: "sched_getparam", + 144: "sched_setscheduler", + 145: "sched_getscheduler", + 146: "sched_get_priority_max", + 147: "sched_get_priority_min", + 148: "sched_rr_get_interval", + 149: "mlock", + 150: "munlock", + 151: "mlockall", + 152: "munlockall", + 153: "vhangup", + 154: "modify_ldt", + 155: "pivot_root", + 156: "_sysctl", + 157: "prctl", + 158: "arch_prctl", + 159: "adjtimex", + 160: "setrlimit", + 161: "chroot", + 162: "sync", + 163: "acct", + 164: "settimeofday", + 165: "mount", + 166: "umount2", + 167: "swapon", + 168: "swapoff", + 169: "reboot", + 170: "sethostname", + 171: "setdomainname", + 172: "iopl", + 173: "ioperm", + 174: "create_module", + 175: "init_module", + 176: "delete_module", + 177: "get_kernel_syms", + 178: "query_module", + 179: "quotactl", + 180: "nfsservctl", + 181: "getpmsg", + 182: "putpmsg", + 183: "afs_syscall", + 184: "tuxcall", + 185: "security", + 186: "gettid", + 187: "readahead", + 188: "setxattr", + 189: "lsetxattr", + 190: "fsetxattr", + 191: "getxattr", + 192: "lgetxattr", + 193: "fgetxattr", + 194: "listxattr", + 195: "llistxattr", + 196: "flistxattr", + 197: "removexattr", + 198: "lremovexattr", + 199: "fremovexattr", + 200: "tkill", + 201: "time", + 202: "futex", + 203: "sched_setaffinity", + 204: "sched_getaffinity", + 205: "set_thread_area", + 206: "io_setup", + 207: "io_destroy", + 208: "io_getevents", + 209: "io_submit", + 210: "io_cancel", + 211: "get_thread_area", + 212: "lookup_dcookie", + 213: "epoll_create", + 214: "epoll_ctl_old", + 215: "epoll_wait_old", + 216: "remap_file_pages", + 217: "getdents64", + 218: "set_tid_address", + 219: "restart_syscall", + 220: "semtimedop", + 221: "fadvise64", + 222: "timer_create", + 223: "timer_settime", + 224: "timer_gettime", + 225: "timer_getoverrun", + 226: "timer_delete", + 227: "clock_settime", + 228: "clock_gettime", + 229: "clock_getres", + 230: "clock_nanosleep", + 231: "exit_group", + 232: "epoll_wait", + 233: "epoll_ctl", + 234: "tgkill", + 235: "utimes", + 236: "vserver", + 237: "mbind", + 238: "set_mempolicy", + 239: "get_mempolicy", + 240: "mq_open", + 241: "mq_unlink", + 242: "mq_timedsend", + 243: "mq_timedreceive", + 244: "mq_notify", + 245: "mq_getsetattr", + 246: "kexec_load", + 247: "waitid", + 248: "add_key", + 249: "request_key", + 250: "keyctl", + 251: "ioprio_set", + 252: "ioprio_get", + 253: "inotify_init", + 254: "inotify_add_watch", + 255: "inotify_rm_watch", + 256: "migrate_pages", + 257: "openat", + 258: "mkdirat", + 259: "mknodat", + 260: "fchownat", + 261: "futimesat", + 262: "newfstatat", + 263: "unlinkat", + 264: "renameat", + 265: "linkat", + 266: "symlinkat", + 267: "readlinkat", + 268: "fchmodat", + 269: "faccessat", + 270: "pselect6", + 271: "ppoll", + 272: "unshare", + 273: "set_robust_list", + 274: "get_robust_list", + 275: "splice", + 276: "tee", + 277: "sync_file_range", + 278: "vmsplice", + 279: "move_pages", + 280: "utimensat", + 281: "epoll_pwait", + 282: "signalfd", + 283: "timerfd", + 284: "eventfd", + 285: "fallocate", +} + +SOCKET_SYSCALL_NAMES = set(( + "socket", "socketpair", "connect", + "sendto", "recvfrom", "sendmsg", "recvmsg", + "bind", "listen", "accept", + "getsockname", "getpeername", "getsockopt", "setsockopt", + "shutdown", +)) diff -Nru python-ptrace-0.9.3/ptrace/syscall/linux_syscall32.py python-ptrace-0.9.7/ptrace/syscall/linux_syscall32.py --- python-ptrace-0.9.3/ptrace/syscall/linux_syscall32.py 2017-02-10 12:38:49.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/linux_syscall32.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,329 +0,0 @@ -# Linux kernel syscall list from Linux 2.6.21 for i386 -# -# List extracted from Linux kernel source code, see: -# arch/i386/kernel/syscall_table.S -SYSCALL_NAMES = { - 0: "restart_syscall", - 1: "exit", - 2: "fork", - 3: "read", - 4: "write", - 5: "open", - 6: "close", - 7: "waitpid", - 8: "creat", - 9: "link", - 10: "unlink", - 11: "execve", - 12: "chdir", - 13: "time", - 14: "mknod", - 15: "chmod", - 16: "lchown16", - # 17: - - 18: "stat", - 19: "lseek", - 20: "getpid", - 21: "mount", - 22: "oldumount", - 23: "setuid16", - 24: "getuid16", - 25: "stime", - 26: "ptrace", - 27: "alarm", - 28: "fstat", - 29: "pause", - 30: "utime", - # 31: - - # 32: - - 33: "access", - 34: "nice", - # 35: - - 36: "sync", - 37: "kill", - 38: "rename", - 39: "mkdir", - 40: "rmdir", - 41: "dup", - 42: "pipe", - 43: "times", - # 44: - - 45: "brk", - 46: "setgid16", - 47: "getgid16", - 48: "signal", - 49: "geteuid16", - 50: "getegid16", - 51: "acct", - 52: "umount", - # 53: - - 54: "ioctl", - 55: "fcntl", - # 56: - - 57: "setpgid", - # 58: - - 59: "oldolduname", - 60: "umask", - 61: "chroot", - 62: "ustat", - 63: "dup2", - 64: "getppid", - 65: "getpgrp", - 66: "setsid", - 67: "sigaction", - 68: "sgetmask", - 69: "ssetmask", - 70: "setreuid16", - 71: "setregid16", - 72: "sigsuspend", - 73: "sigpending", - 74: "sethostname", - 75: "setrlimit", - 76: "old_getrlimit", - 77: "getrusage", - 78: "gettimeofday", - 79: "settimeofday", - 80: "getgroups16", - 81: "setgroups16", - 82: "old_select", - 83: "symlink", - 84: "lstat", - 85: "readlink", - 86: "uselib", - 87: "swapon", - 88: "reboot", - 89: "old_readdir", - 90: "old_mmap", - 91: "munmap", - 92: "truncate", - 93: "ftruncate", - 94: "fchmod", - 95: "fchown16", - 96: "getpriority", - 97: "setpriority", - # 98: - - 99: "statfs", - 100: "fstatfs", - 101: "ioperm", - 102: "socketcall", - 103: "syslog", - 104: "setitimer", - 105: "getitimer", - 106: "newstat", - 107: "newlstat", - 108: "newfstat", - 109: "olduname", - 110: "iopl", - 111: "vhangup", - # 112: old "idle" - 113: "vm86old", - 114: "wait4", - 115: "swapoff", - 116: "sysinfo", - 117: "ipc", - 118: "fsync", - 119: "sigreturn", - 120: "clone", - 121: "setdomainname", - 122: "uname", - 123: "modify_ldt", - 124: "adjtimex", - 125: "mprotect", - 126: "sigprocmask", - # 127: old "create_module" - 128: "init_module", - 129: "delete_module", - # 130: old "get_kernel_syms" - 131: "quotactl", - 132: "getpgid", - 133: "fchdir", - 134: "bdflush", - 135: "sysfs", - 136: "personality", - # 137: reserved for afs_syscall - 138: "setfsuid16", - 139: "setfsgid16", - 140: "llseek", - 141: "getdents", - 142: "select", - 143: "flock", - 144: "msync", - 145: "readv", - 146: "writev", - 147: "getsid", - 148: "fdatasync", - 149: "sysctl", - 150: "mlock", - 151: "munlock", - 152: "mlockall", - 153: "munlockall", - 154: "sched_setparam", - 155: "sched_getparam", - 156: "sched_setscheduler", - 157: "sched_getscheduler", - 158: "sched_yield", - 159: "sched_get_priority_max", - 160: "sched_get_priority_min", - 161: "sched_rr_get_interval", - 162: "nanosleep", - 163: "mremap", - 164: "setresuid16", - 165: "getresuid16", - 166: "vm86", - # 167: old "query_module" - 168: "poll", - 169: "nfsservctl", - 170: "setresgid16", - 171: "getresgid16", - 172: "prctl", - 173: "rt_sigreturn", - 174: "rt_sigaction", - 175: "rt_sigprocmask", - 176: "rt_sigpending", - 177: "rt_sigtimedwait", - 178: "rt_sigqueueinfo", - 179: "rt_sigsuspend", - 180: "pread64", - 181: "pwrite64", - 182: "chown16", - 183: "getcwd", - 184: "capget", - 185: "capset", - 186: "sigaltstack", - 187: "sendfile", - # 188: (reserved) - # 189: (reserved) - 190: "vfork", - 191: "getrlimit", - 192: "mmap2", - 193: "truncate64", - 194: "ftruncate64", - 195: "stat64", - 196: "lstat64", - 197: "fstat64", - 198: "lchown", - 199: "getuid", - 200: "getgid", - 201: "geteuid", - 202: "getegid", - 203: "setreuid", - 204: "setregid", - 205: "getgroups", - 206: "setgroups", - 207: "fchown", - 208: "setresuid", - 209: "getresuid", - 210: "setresgid", - 211: "getresgid", - 212: "chown", - 213: "setuid", - 214: "setgid", - 215: "setfsuid", - 216: "setfsgid", - # ------------------------------- - 217: "pivot_root", - 218: "mincore", - 219: "madvise", - 220: "getdents64", - 221: "fcntl64", - # 222: - - # 223: - - 224: "gettid", - 225: "readahead", - 226: "setxattr", - 227: "lsetxattr", - 228: "fsetxattr", - 229: "getxattr", - 230: "lgetxattr", - 231: "fgetxattr", - 232: "listxattr", - 233: "llistxattr", - 234: "flistxattr", - 235: "removexattr", - 236: "lremovexattr", - 237: "fremovexattr", - 238: "tkill", - 239: "sendfile64", - 240: "futex", - 241: "sched_setaffinity", - 242: "sched_getaffinity", - 243: "set_thread_area", - 244: "get_thread_area", - 245: "io_setup", - 246: "io_destroy", - 247: "io_getevents", - 248: "io_submit", - 249: "io_cancel", - 250: "fadvise64", - # 251: - - 252: "exit_group", - 253: "lookup_dcookie", - 254: "epoll_create", - 255: "epoll_ctl", - 256: "epoll_wait", - 257: "remap_file_pages", - 258: "set_tid_address", - 259: "timer_create", - 260: "timer_settime", - 261: "timer_gettime", - 262: "timer_getoverrun", - 263: "timer_delete", - 264: "clock_settime", - 265: "clock_gettime", - 266: "clock_getres", - 267: "clock_nanosleep", - 268: "statfs64", - 269: "fstatfs64", - 270: "tgkill", - 271: "utimes", - 272: "fadvise64_64", - # 273: - - 274: "mbind", - 275: "get_mempolicy", - 276: "set_mempolicy", - 277: "mq_open", - 278: "mq_unlink", - 279: "mq_timedsend", - 280: "mq_timedreceive", - 281: "mq_notify", - 282: "mq_getsetattr", - 283: "kexec_load", - 284: "waitid", - # 285: - - 286: "add_key", - 287: "request_key", - 288: "keyctl", - 289: "ioprio_set", - 290: "ioprio_get", - 291: "inotify_init", - 292: "inotify_add_watch", - 293: "inotify_rm_watch", - 294: "migrate_pages", - 295: "openat", - 296: "mkdirat", - 297: "mknodat", - 298: "fchownat", - 299: "futimesat", - 300: "fstatat64", - 301: "unlinkat", - 302: "renameat", - 303: "linkat", - 304: "symlinkat", - 305: "readlinkat", - 306: "fchmodat", - 307: "faccessat", - 308: "pselect6", - 309: "ppoll", - 310: "unshare", - 311: "set_robust_list", - 312: "get_robust_list", - 313: "splice", - 314: "sync_file_range", - 315: "tee", - 316: "vmsplice", - 317: "move_pages", - 318: "getcpu", - 319: "epoll_pwait", -} - -SOCKET_SYSCALL_NAMES = set(("socketcall",)) diff -Nru python-ptrace-0.9.3/ptrace/syscall/linux_syscall64.py python-ptrace-0.9.7/ptrace/syscall/linux_syscall64.py --- python-ptrace-0.9.3/ptrace/syscall/linux_syscall64.py 2017-02-10 12:38:50.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/linux_syscall64.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,297 +0,0 @@ -# Linux kernel 2.6.23 on Intel Core2 Duo E6400 -SYSCALL_NAMES = { - 0: "read", - 1: "write", - 2: "open", - 3: "close", - 4: "stat", - 5: "fstat", - 6: "lstat", - 7: "poll", - 8: "lseek", - 9: "mmap", - 10: "mprotect", - 11: "munmap", - 12: "brk", - 13: "rt_sigaction", - 14: "rt_sigprocmask", - 15: "rt_sigreturn", - 16: "ioctl", - 17: "pread64", - 18: "pwrite64", - 19: "readv", - 20: "writev", - 21: "access", - 22: "pipe", - 23: "select", - 24: "sched_yield", - 25: "mremap", - 26: "msync", - 27: "mincore", - 28: "madvise", - 29: "shmget", - 30: "shmat", - 31: "shmctl", - 32: "dup", - 33: "dup2", - 34: "pause", - 35: "nanosleep", - 36: "getitimer", - 37: "alarm", - 38: "setitimer", - 39: "getpid", - 40: "sendfile", - 41: "socket", - 42: "connect", - 43: "accept", - 44: "sendto", - 45: "recvfrom", - 46: "sendmsg", - 47: "recvmsg", - 48: "shutdown", - 49: "bind", - 50: "listen", - 51: "getsockname", - 52: "getpeername", - 53: "socketpair", - 54: "setsockopt", - 55: "getsockopt", - 56: "clone", - 57: "fork", - 58: "vfork", - 59: "execve", - 60: "exit", - 61: "wait4", - 62: "kill", - 63: "uname", - 64: "semget", - 65: "semop", - 66: "semctl", - 67: "shmdt", - 68: "msgget", - 69: "msgsnd", - 70: "msgrcv", - 71: "msgctl", - 72: "fcntl", - 73: "flock", - 74: "fsync", - 75: "fdatasync", - 76: "truncate", - 77: "ftruncate", - 78: "getdents", - 79: "getcwd", - 80: "chdir", - 81: "fchdir", - 82: "rename", - 83: "mkdir", - 84: "rmdir", - 85: "creat", - 86: "link", - 87: "unlink", - 88: "symlink", - 89: "readlink", - 90: "chmod", - 91: "fchmod", - 92: "chown", - 93: "fchown", - 94: "lchown", - 95: "umask", - 96: "gettimeofday", - 97: "getrlimit", - 98: "getrusage", - 99: "sysinfo", - 100: "times", - 101: "ptrace", - 102: "getuid", - 103: "syslog", - 104: "getgid", - 105: "setuid", - 106: "setgid", - 107: "geteuid", - 108: "getegid", - 109: "setpgid", - 110: "getppid", - 111: "getpgrp", - 112: "setsid", - 113: "setreuid", - 114: "setregid", - 115: "getgroups", - 116: "setgroups", - 117: "setresuid", - 118: "getresuid", - 119: "setresgid", - 120: "getresgid", - 121: "getpgid", - 122: "setfsuid", - 123: "setfsgid", - 124: "getsid", - 125: "capget", - 126: "capset", - 127: "rt_sigpending", - 128: "rt_sigtimedwait", - 129: "rt_sigqueueinfo", - 130: "rt_sigsuspend", - 131: "sigaltstack", - 132: "utime", - 133: "mknod", - 134: "uselib", - 135: "personality", - 136: "ustat", - 137: "statfs", - 138: "fstatfs", - 139: "sysfs", - 140: "getpriority", - 141: "setpriority", - 142: "sched_setparam", - 143: "sched_getparam", - 144: "sched_setscheduler", - 145: "sched_getscheduler", - 146: "sched_get_priority_max", - 147: "sched_get_priority_min", - 148: "sched_rr_get_interval", - 149: "mlock", - 150: "munlock", - 151: "mlockall", - 152: "munlockall", - 153: "vhangup", - 154: "modify_ldt", - 155: "pivot_root", - 156: "_sysctl", - 157: "prctl", - 158: "arch_prctl", - 159: "adjtimex", - 160: "setrlimit", - 161: "chroot", - 162: "sync", - 163: "acct", - 164: "settimeofday", - 165: "mount", - 166: "umount2", - 167: "swapon", - 168: "swapoff", - 169: "reboot", - 170: "sethostname", - 171: "setdomainname", - 172: "iopl", - 173: "ioperm", - 174: "create_module", - 175: "init_module", - 176: "delete_module", - 177: "get_kernel_syms", - 178: "query_module", - 179: "quotactl", - 180: "nfsservctl", - 181: "getpmsg", - 182: "putpmsg", - 183: "afs_syscall", - 184: "tuxcall", - 185: "security", - 186: "gettid", - 187: "readahead", - 188: "setxattr", - 189: "lsetxattr", - 190: "fsetxattr", - 191: "getxattr", - 192: "lgetxattr", - 193: "fgetxattr", - 194: "listxattr", - 195: "llistxattr", - 196: "flistxattr", - 197: "removexattr", - 198: "lremovexattr", - 199: "fremovexattr", - 200: "tkill", - 201: "time", - 202: "futex", - 203: "sched_setaffinity", - 204: "sched_getaffinity", - 205: "set_thread_area", - 206: "io_setup", - 207: "io_destroy", - 208: "io_getevents", - 209: "io_submit", - 210: "io_cancel", - 211: "get_thread_area", - 212: "lookup_dcookie", - 213: "epoll_create", - 214: "epoll_ctl_old", - 215: "epoll_wait_old", - 216: "remap_file_pages", - 217: "getdents64", - 218: "set_tid_address", - 219: "restart_syscall", - 220: "semtimedop", - 221: "fadvise64", - 222: "timer_create", - 223: "timer_settime", - 224: "timer_gettime", - 225: "timer_getoverrun", - 226: "timer_delete", - 227: "clock_settime", - 228: "clock_gettime", - 229: "clock_getres", - 230: "clock_nanosleep", - 231: "exit_group", - 232: "epoll_wait", - 233: "epoll_ctl", - 234: "tgkill", - 235: "utimes", - 236: "vserver", - 237: "mbind", - 238: "set_mempolicy", - 239: "get_mempolicy", - 240: "mq_open", - 241: "mq_unlink", - 242: "mq_timedsend", - 243: "mq_timedreceive", - 244: "mq_notify", - 245: "mq_getsetattr", - 246: "kexec_load", - 247: "waitid", - 248: "add_key", - 249: "request_key", - 250: "keyctl", - 251: "ioprio_set", - 252: "ioprio_get", - 253: "inotify_init", - 254: "inotify_add_watch", - 255: "inotify_rm_watch", - 256: "migrate_pages", - 257: "openat", - 258: "mkdirat", - 259: "mknodat", - 260: "fchownat", - 261: "futimesat", - 262: "newfstatat", - 263: "unlinkat", - 264: "renameat", - 265: "linkat", - 266: "symlinkat", - 267: "readlinkat", - 268: "fchmodat", - 269: "faccessat", - 270: "pselect6", - 271: "ppoll", - 272: "unshare", - 273: "set_robust_list", - 274: "get_robust_list", - 275: "splice", - 276: "tee", - 277: "sync_file_range", - 278: "vmsplice", - 279: "move_pages", - 280: "utimensat", - 281: "epoll_pwait", - 282: "signalfd", - 283: "timerfd", - 284: "eventfd", - 285: "fallocate", -} - -SOCKET_SYSCALL_NAMES = set(( - "socket", "socketpair", "connect", - "sendto", "recvfrom", "sendmsg", "recvmsg", - "bind", "listen", "accept", - "getsockname", "getpeername", "getsockopt", "setsockopt", - "shutdown", -)) diff -Nru python-ptrace-0.9.3/ptrace/syscall/names.py python-ptrace-0.9.7/ptrace/syscall/names.py --- python-ptrace-0.9.3/ptrace/syscall/names.py 2017-02-10 12:38:50.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/names.py 2020-08-10 22:45:22.000000000 +0200 @@ -1,10 +1,17 @@ -from ptrace.cpu_info import CPU_64BITS +from ptrace.cpu_info import CPU_X86_64, CPU_I386, CPU_PPC64, CPU_PPC32 from ptrace.os_tools import RUNNING_LINUX, RUNNING_FREEBSD if RUNNING_LINUX: - if CPU_64BITS: - from ptrace.syscall.linux_syscall64 import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES + if CPU_X86_64: + from ptrace.syscall.linux.x86_64 import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES + elif CPU_I386: + from ptrace.syscall.linux.i386 import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES + elif CPU_PPC64: + from ptrace.syscall.linux.powerpc64 import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES + elif CPU_PPC32: + from ptrace.syscall.linux.powerpc32 import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES else: - from ptrace.syscall.linux_syscall32 import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES + raise NotImplementedError("Unsupported CPU architecture") + elif RUNNING_FREEBSD: from ptrace.syscall.freebsd_syscall import SYSCALL_NAMES, SOCKET_SYSCALL_NAMES else: diff -Nru python-ptrace-0.9.3/ptrace/syscall/posix_arg.py python-ptrace-0.9.7/ptrace/syscall/posix_arg.py --- python-ptrace-0.9.3/ptrace/syscall/posix_arg.py 2017-02-10 12:41:08.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/posix_arg.py 2020-08-10 22:45:22.000000000 +0200 @@ -1,5 +1,6 @@ from ptrace.tools import readBits, formatBits from ptrace.signames import signalName +from ptrace.ctypes_tools import uint2int # From /usr/include/bits/mman.h (Ubuntu Feisty, i386) MMAP_PROT_BITMASK = ( @@ -28,7 +29,7 @@ # From /usr/include/bits/fcntl.h (Ubuntu Feisty, i386) -OPEN_MODE_BITMASK = [ +OPEN_FLAGS_BITMASK = [ (0o1, "O_WRONLY"), (0o2, "O_RDWR"), (0o100, "O_CREAT"), @@ -50,9 +51,9 @@ ] -def formatOpenMode(argument): +def formatOpenFlags(argument): value = argument.value - flags = readBits(int(value), OPEN_MODE_BITMASK) + flags = readBits(int(value), OPEN_FLAGS_BITMASK) # Add default access mode if neither of the others are present. if not flags or flags[0] not in ("O_WRONLY", "O_RDWR"): @@ -64,6 +65,31 @@ return text +OPEN_MODE_BITMASK = [ + (0o0400, "S_IRUSR"), + (0o0200, "S_IWUSR"), + (0o0100, "S_IXUSR"), + (0o0040, "S_IRGRP"), + (0o0020, "S_IWGRP"), + (0o0010, "S_IXGRP"), + (0o0004, "S_IROTH"), + (0o0002, "S_IWOTH"), + (0o0001, "S_IXOTH"), +] + + +def formatOpenMode(argument): + value = argument.value + flags = readBits(int(value), OPEN_MODE_BITMASK) + + text = "|".join(flags) + + # Overwrite text, add it depending on verbosity later + if value: + text = "%s" % oct(argument.value) + return text + + CLONE_FLAGS_BITMASK = ( (0x00000100, "CLONE_VM"), (0x00000200, "CLONE_FS"), @@ -103,5 +129,6 @@ AT_FDCWD = -100 -def formatDirFd(value): +def formatDirFd(argument): + value = uint2int(argument.value) return "AT_FDCWD" if value == AT_FDCWD else str(value) diff -Nru python-ptrace-0.9.3/ptrace/syscall/prototypes.py python-ptrace-0.9.7/ptrace/syscall/prototypes.py --- python-ptrace-0.9.3/ptrace/syscall/prototypes.py 2017-02-10 12:38:50.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/prototypes.py 2020-08-10 22:45:22.000000000 +0200 @@ -20,8 +20,6 @@ FILENAME_ARGUMENTS = set( ("filename", "pathname", "path", "oldname", "newname", "old", "new")) -DIRFD_ARGUMENTS = set(("dirfd", "olddirfd", "newdirfd")) - SYSCALL_PROTOTYPES = { "accept": ("long", ( ("int", "sockfd"), @@ -859,7 +857,7 @@ ("size_t", "len"), )), "name_to_handle_at": ("long", ( - ("int", "dfd"), + ("int", "dirfd"), ("const char *", "name"), ("struct file_handle *", "handle"), ("int *", "mnt_id"), @@ -922,12 +920,12 @@ ("umode_t", "mode"), )), "open_by_handle_at": ("long", ( - ("int", "mountdirfd"), + ("int", "mount_fd"), ("struct file_handle *", "handle"), ("int", "flags"), )), "openat": ("long", ( - ("int", "dfd"), + ("int", "dirfd"), ("const char *", "filename"), ("int", "flags"), ("umode_t", "mode"), @@ -1250,11 +1248,11 @@ ("const char *", "uargs"), )), "select": ("long", ( - ("int", "n"), - ("fd_set *", "inp"), - ("fd_set *", "outp"), - ("fd_set *", "exp"), - ("struct timeval *", "tvp"), + ("int", "nfds"), + ("fd_set *", "readfds"), + ("fd_set *", "writefds"), + ("fd_set *", "errorfds"), + ("struct timeval *", "timeout"), )), "semctl": ("long", ( ("int", "semid"), diff -Nru python-ptrace-0.9.3/ptrace/syscall/ptrace_syscall.py python-ptrace-0.9.7/ptrace/syscall/ptrace_syscall.py --- python-ptrace-0.9.3/ptrace/syscall/ptrace_syscall.py 2017-02-10 12:38:51.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/ptrace_syscall.py 2020-08-10 22:45:22.000000000 +0200 @@ -37,7 +37,7 @@ raise NotImplementedError("Unsupported CPU architecture") PREFORMAT_ARGUMENTS = { - "select": (2, 3, 4), + "select": (1, 2, 3), "execve": (0, 1, 2), "clone": (0, 1), } diff -Nru python-ptrace-0.9.3/ptrace/syscall/syscall_argument.py python-ptrace-0.9.7/ptrace/syscall/syscall_argument.py --- python-ptrace-0.9.3/ptrace/syscall/syscall_argument.py 2017-02-10 12:38:49.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/syscall/syscall_argument.py 2020-08-10 22:45:22.000000000 +0200 @@ -6,16 +6,16 @@ from logging import getLogger, INFO from ptrace.func_arg import FunctionArgument from ptrace.syscall.posix_arg import ( - formatMmapProt, formatAccessMode, formatOpenMode, formatCloneFlags, formatDirFd) + formatMmapProt, formatAccessMode, formatOpenFlags, formatCloneFlags, formatDirFd, formatOpenMode) from ptrace.func_call import FunctionCall from ptrace.syscall.socketcall import (setupSocketCall, formatOptVal, formatSockaddr, formatSockaddrInStruct, formatSockaddrIn6Struct) from ptrace.syscall.socketcall_constants import SOCKETCALL import os import re -from ptrace import six + from ptrace.os_tools import RUNNING_LINUX, RUNNING_FREEBSD -from ptrace.syscall import FILENAME_ARGUMENTS, DIRFD_ARGUMENTS +from ptrace.syscall import FILENAME_ARGUMENTS from ptrace.syscall.socketcall_constants import formatSocketType if RUNNING_LINUX: from ptrace.syscall.linux_struct import ( @@ -26,6 +26,7 @@ else: SYSCALL_ARG_DICT = {} + KNOWN_STRUCTS = [] if RUNNING_LINUX: KNOWN_STRUCTS.extend( @@ -35,8 +36,9 @@ ARGUMENT_CALLBACK = { # Prototype: callback(argument) -> str "access": {"mode": formatAccessMode}, - "open": {"flags": formatOpenMode, "mode": formatOpenMode}, - "openat": {"flags": formatOpenMode, "mode": formatOpenMode}, + "open": {"flags": formatOpenFlags, "mode": formatOpenMode}, + "openat": {"dirfd": formatDirFd, "flags": formatOpenFlags, "mode": formatOpenMode}, + "name_to_handle_at": {"dirfd": formatDirFd}, "mmap": {"prot": formatMmapProt}, "mmap2": {"prot": formatMmapProt}, "clone": {"flags": formatCloneFlags}, @@ -63,7 +65,7 @@ def iterBits(data): for char in data: - byte = ord(char) + byte = ord(chr(char)) for index in range(8): yield ((byte >> index) & 1) == 1 @@ -112,8 +114,6 @@ return self.readString(value, length) if name == "signum": return signalName(value) - if name in DIRFD_ARGUMENTS and argtype == "int": - return formatDirFd(uint2int(value)) # Remove "const " prefix if argtype.startswith("const "): @@ -125,7 +125,8 @@ # Format depending on the type if argtype.endswith("*"): try: - text = self.formatValuePointer(argtype[:-1]) + # Strip in case there is a space between the name and '*' + text = self.formatValuePointer(argtype[:-1].strip()) if text: return text except PTRACE_ERRORS as err: @@ -134,7 +135,7 @@ return formatAddress(self.value) # Array like "int[2]" - match = re.match("(.*)\[([0-9])+\]", argtype) + match = re.match(r"(.*)\[([0-9])+\]", argtype) if match: basetype = match.group(1) count = int(match.group(2)) @@ -173,8 +174,10 @@ struct = KNOWN_STRUCTS[argtype] return self.readStruct(address, struct) if RUNNING_LINUX and argtype == "fd_set": - fd_set = self.readBits(address, FD_SETSIZE) - return self.formatPointer("<fdset=(%s)>" % fd_set, address) + # The function is either select or pselect, so arg[0] is nfds + nfds = self.function.arguments[0].value + fd_set = filter(lambda x: int(x) < nfds, self.readBits(address, FD_SETSIZE)) + return self.formatPointer("[%s]" % " ".join(fd_set), address) syscall = self.function.name if syscall == "rt_sigprocmask" and argtype == "sigset_t": @@ -184,24 +187,21 @@ key += 1 return signalName(key) fd_set = self.readBits(address, size, format=formatter) - return self.formatPointer("<sigset=(%s)>" % fd_set, address) + return self.formatPointer("<sigset=(%s)>" % " ".join(fd_set), address) return None def readBits(self, address, count, format=str): bytes = self.function.process.readBytes(address, count // 8) fd_set = [format(index) for index, bit in enumerate(iterBits(bytes)) if bit] - return ", ".join(fd_set) + return fd_set def readCString(self, address): if address: max_size = self.options.string_max_length data, truncated = self.function.process.readCString( address, max_size) - if six.PY3: - text = os.fsdecode(data) - else: - text = data + text = os.fsdecode(data) text = repr(text) if truncated: text += "..." @@ -215,10 +215,7 @@ truncated = (max_len < size) size = min(size, max_len) data = self.function.process.readBytes(address, size) - if six.PY3: - text = os.fsdecode(data) - else: - text = data + text = os.fsdecode(data) text = repr(text) if truncated: text += "..." diff -Nru python-ptrace-0.9.3/ptrace/version.py python-ptrace-0.9.7/ptrace/version.py --- python-ptrace-0.9.3/ptrace/version.py 2017-02-12 19:08:34.000000000 +0100 +++ python-ptrace-0.9.7/ptrace/version.py 2020-08-10 22:45:22.000000000 +0200 @@ -1,4 +1,5 @@ PACKAGE = "python-ptrace" -VERSION = "0.9.3" +VERSION = (0, 9, 7) +__version__ = '.'.join(map(str, VERSION)) WEBSITE = "http://python-ptrace.readthedocs.io/" LICENSE = "GNU GPL v2" diff -Nru python-ptrace-0.9.3/pyflakes.sh python-ptrace-0.9.7/pyflakes.sh --- python-ptrace-0.9.3/pyflakes.sh 2017-02-10 12:22:40.000000000 +0100 +++ python-ptrace-0.9.7/pyflakes.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -pyflakes $(find -name "*.py")|grep -v "redefinition of unused"|grep -v "__init__.*imported but unused" diff -Nru python-ptrace-0.9.3/python_ptrace.egg-info/PKG-INFO python-ptrace-0.9.7/python_ptrace.egg-info/PKG-INFO --- python-ptrace-0.9.3/python_ptrace.egg-info/PKG-INFO 2017-09-19 11:03:19.000000000 +0200 +++ python-ptrace-0.9.7/python_ptrace.egg-info/PKG-INFO 2020-08-10 23:30:05.000000000 +0200 @@ -1,13 +1,12 @@ Metadata-Version: 1.1 Name: python-ptrace -Version: 0.9.3 +Version: 0.9.7 Summary: python binding of ptrace Home-page: http://python-ptrace.readthedocs.io/ Author: Victor Stinner Author-email: UNKNOWN License: GNU GPL v2 Download-URL: http://python-ptrace.readthedocs.io/ -Description-Content-Type: UNKNOWN Description: ============= python-ptrace ============= @@ -16,9 +15,9 @@ :alt: Latest release on the Python Cheeseshop (PyPI) :target: https://pypi.python.org/pypi/python-ptrace - .. image:: https://travis-ci.org/haypo/python-ptrace.svg?branch=master + .. image:: https://travis-ci.com/vstinner/python-ptrace.svg?branch=master :alt: Build status of python-ptrace on Travis CI - :target: https://travis-ci.org/haypo/python-ptrace + :target: https://travis-ci.com/github/vstinner/python-ptrace python-ptrace is a debugger using ptrace (Linux, BSD and Darwin system call to trace processes) written in Python. @@ -26,12 +25,12 @@ * `python-ptrace documentation <http://python-ptrace.readthedocs.io/>`_ * `python-ptrace at GitHub - <https://github.com/haypo/python-ptrace>`_ + <https://github.com/vstinner/python-ptrace>`_ * `python-ptrace at the Python Cheeseshop (PyPI) <https://pypi.python.org/pypi/python-ptrace>`_ python-ptrace is an opensource project written in Python under GNU GPLv2 - license. + license. It supports Python 3.6 and newer. Platform: UNKNOWN Classifier: Intended Audience :: Developers diff -Nru python-ptrace-0.9.3/python_ptrace.egg-info/SOURCES.txt python-ptrace-0.9.7/python_ptrace.egg-info/SOURCES.txt --- python-ptrace-0.9.3/python_ptrace.egg-info/SOURCES.txt 2017-09-19 11:03:19.000000000 +0200 +++ python-ptrace-0.9.7/python_ptrace.egg-info/SOURCES.txt 2020-08-10 23:30:05.000000000 +0200 @@ -1,9 +1,10 @@ COPYING MANIFEST.in README.rst +SYSCALL_PROTOTYPES.codegen.py gdb.py -pyflakes.sh runtests.py +setup.cfg setup.py setup_cptrace.py strace.py @@ -44,7 +45,6 @@ ptrace/profiler.py ptrace/pydistorm.py ptrace/signames.py -ptrace/six.py ptrace/terminal.py ptrace/tools.py ptrace/version.py @@ -73,8 +73,6 @@ ptrace/syscall/freebsd_syscall.py ptrace/syscall/linux_constants.py ptrace/syscall/linux_struct.py -ptrace/syscall/linux_syscall32.py -ptrace/syscall/linux_syscall64.py ptrace/syscall/names.py ptrace/syscall/posix_arg.py ptrace/syscall/posix_constants.py @@ -84,6 +82,11 @@ ptrace/syscall/socketcall_constants.py ptrace/syscall/socketcall_struct.py ptrace/syscall/syscall_argument.py +ptrace/syscall/linux/__init__.py +ptrace/syscall/linux/i386.py +ptrace/syscall/linux/powerpc32.py +ptrace/syscall/linux/powerpc64.py +ptrace/syscall/linux/x86_64.py python_ptrace.egg-info/PKG-INFO python_ptrace.egg-info/SOURCES.txt python_ptrace.egg-info/dependency_links.txt diff -Nru python-ptrace-0.9.3/README.rst python-ptrace-0.9.7/README.rst --- python-ptrace-0.9.3/README.rst 2017-02-10 12:22:40.000000000 +0100 +++ python-ptrace-0.9.7/README.rst 2020-08-10 23:09:18.000000000 +0200 @@ -6,9 +6,9 @@ :alt: Latest release on the Python Cheeseshop (PyPI) :target: https://pypi.python.org/pypi/python-ptrace -.. image:: https://travis-ci.org/haypo/python-ptrace.svg?branch=master +.. image:: https://travis-ci.com/vstinner/python-ptrace.svg?branch=master :alt: Build status of python-ptrace on Travis CI - :target: https://travis-ci.org/haypo/python-ptrace + :target: https://travis-ci.com/github/vstinner/python-ptrace python-ptrace is a debugger using ptrace (Linux, BSD and Darwin system call to trace processes) written in Python. @@ -16,9 +16,9 @@ * `python-ptrace documentation <http://python-ptrace.readthedocs.io/>`_ * `python-ptrace at GitHub - <https://github.com/haypo/python-ptrace>`_ + <https://github.com/vstinner/python-ptrace>`_ * `python-ptrace at the Python Cheeseshop (PyPI) <https://pypi.python.org/pypi/python-ptrace>`_ python-ptrace is an opensource project written in Python under GNU GPLv2 -license. +license. It supports Python 3.6 and newer. diff -Nru python-ptrace-0.9.3/runtests.py python-ptrace-0.9.7/runtests.py --- python-ptrace-0.9.3/runtests.py 2017-02-10 12:38:49.000000000 +0100 +++ python-ptrace-0.9.7/runtests.py 2020-08-10 22:45:22.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """Run Tulip unittests. Usage: @@ -20,10 +20,10 @@ # Originally written by Beech Horn (for NDB). -from __future__ import print_function -import optparse import gc +import importlib.machinery import logging +import optparse import os import re import sys @@ -32,8 +32,6 @@ import coverage except ImportError: coverage = None -if sys.version_info < (3,): - sys.exc_clear() try: import unittest @@ -73,17 +71,9 @@ help='optional regex patterns to match test ids (default all tests)') -if sys.version_info >= (3, 3): - import importlib.machinery - - def load_module(modname, sourcefile): - loader = importlib.machinery.SourceFileLoader(modname, sourcefile) - return loader.load_module() -else: - import imp - - def load_module(modname, sourcefile): - return imp.load_source(modname, sourcefile) +def load_module(modname, sourcefile): + loader = importlib.machinery.SourceFileLoader(modname, sourcefile) + return loader.load_module() def load_modules(basedir, suffix='.py'): @@ -103,9 +93,9 @@ if os.path.isdir(path): files.extend(list_dir('{0}{1}.'.format(prefix, name), path)) else: - if (name != '__init__.py' and - name.endswith(suffix) and - not name.startswith(('.', '_'))): + if (name != '__init__.py' + and name.endswith(suffix) + and not name.startswith(('.', '_'))): files.append(('{0}{1}'.format(prefix, name[:-3]), path)) return files diff -Nru python-ptrace-0.9.3/setup.cfg python-ptrace-0.9.7/setup.cfg --- python-ptrace-0.9.3/setup.cfg 2017-09-19 11:03:19.000000000 +0200 +++ python-ptrace-0.9.7/setup.cfg 2020-08-10 23:30:05.305909400 +0200 @@ -1,3 +1,6 @@ +[bdist_wheel] +universal = 1 + [egg_info] tag_build = tag_date = 0 diff -Nru python-ptrace-0.9.3/setup.py python-ptrace-0.9.7/setup.py --- python-ptrace-0.9.3/setup.py 2017-09-19 11:03:08.000000000 +0200 +++ python-ptrace-0.9.7/setup.py 2020-08-10 23:12:08.000000000 +0200 @@ -5,20 +5,21 @@ # - git pull --rebase # check that there is no incoming changesets # - check version in ptrace/version.py and doc/conf.py # - set release date in doc/changelog.rst -# - check that "python setup.py sdist" contains all files tracked by +# - check that "python3 setup.py sdist" contains all files tracked by # the SCM (Git): update MANIFEST.in if needed # - git commit -a -m "prepare release VERSION" -# - run tests, type: tox +# - Remove untracked files/dirs: git clean -fdx +# - run tests, type: tox --parallel auto # - git push # - check Travis status: -# https://travis-ci.org/haypo/python-ptrace +# https://travis-ci.com/github/vstinner/python-ptrace # # Release a new version: # -# - git tag python-ptrace-VERSION -# - git push --tags -# - git clean -fdx # WARNING: Remove all untracked files! +# - git tag VERSION +# - Remove untracked files/dirs: git clean -fdx # - python3 setup.py sdist bdist_wheel +# - git push --tags # - twine upload dist/* # # After the release: @@ -27,8 +28,6 @@ # - git commit -a -m "post-release" # - git push -from __future__ import with_statement - from imp import load_source from os import path try: @@ -38,7 +37,7 @@ from distutils.core import setup -MODULES = ["ptrace", "ptrace.binding", "ptrace.syscall", "ptrace.debugger"] +MODULES = ["ptrace", "ptrace.binding", "ptrace.syscall", "ptrace.syscall.linux", "ptrace.debugger"] SCRIPTS = ("strace.py", "gdb.py") @@ -63,7 +62,7 @@ install_options = { "name": ptrace.PACKAGE, - "version": ptrace.VERSION, + "version": ptrace.__version__, "url": ptrace.WEBSITE, "download_url": ptrace.WEBSITE, "author": "Victor Stinner", diff -Nru python-ptrace-0.9.3/strace.py python-ptrace-0.9.7/strace.py --- python-ptrace-0.9.3/strace.py 2017-02-10 12:41:08.000000000 +0100 +++ python-ptrace-0.9.7/strace.py 2020-08-10 22:45:22.000000000 +0200 @@ -1,5 +1,4 @@ #!/usr/bin/env python -from __future__ import print_function from ptrace import PtraceError from ptrace.debugger import (PtraceDebugger, Application, ProcessExit, ProcessSignal, NewProcessEvent, ProcessExecution) diff -Nru python-ptrace-0.9.3/SYSCALL_PROTOTYPES.codegen.py python-ptrace-0.9.7/SYSCALL_PROTOTYPES.codegen.py --- python-ptrace-0.9.3/SYSCALL_PROTOTYPES.codegen.py 1970-01-01 01:00:00.000000000 +0100 +++ python-ptrace-0.9.7/SYSCALL_PROTOTYPES.codegen.py 2020-07-26 20:51:25.000000000 +0200 @@ -0,0 +1,44 @@ +#!/usr/bin/env python + +""" +Generates the SYSCALL_PROTOTYPES dictionary from the Linux kernel source +and prints out Python code representing it. +""" + +import urllib2 +import re + +url = "https://raw.githubusercontent.com/torvalds/linux/master/include/linux/syscalls.h" +source = urllib2.urlopen(url).read() + +p1 = re.compile(r"^asmlinkage long sys(?:32)?_(.*?)\((.*?)\)", + re.MULTILINE | re.DOTALL) +p2 = re.compile(r"^(.*?)([^ *]+)$") + +SYSCALL_PROTOTYPES = {} + +for m1 in p1.finditer(source): + call_name = m1.group(1) + args = m1.group(2) + args = args.replace("__user", "") + args = " ".join(args.split()) + args_tuple = () + if args != "void": + for arg in args.split(","): + if arg.endswith(("*", "long", "int", "size_t")): + arg_type = arg.strip() + arg_name = "" + else: + m2 = p2.match(arg) + arg_type = m2.group(1).strip() + arg_name = m2.group(2).strip() + args_tuple += ((arg_type, arg_name),) + SYSCALL_PROTOTYPES[call_name] = ("long", args_tuple) + +for call_name in sorted(SYSCALL_PROTOTYPES): + signature = SYSCALL_PROTOTYPES[call_name] + args_tuple = signature[1] + print('"%s": ("%s", (' % (call_name, signature[0])) + for arg in args_tuple: + print((' ("%s", "%s"),' % (arg[0], arg[1]))) + print(')),') diff -Nru python-ptrace-0.9.3/tests/test_gdb.py python-ptrace-0.9.7/tests/test_gdb.py --- python-ptrace-0.9.3/tests/test_gdb.py 2017-02-10 12:41:08.000000000 +0100 +++ python-ptrace-0.9.7/tests/test_gdb.py 2020-08-10 22:45:22.000000000 +0200 @@ -4,7 +4,6 @@ import subprocess import sys import unittest -from ptrace import six GDB = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', 'gdb.py')) @@ -12,7 +11,7 @@ class TestGdb(unittest.TestCase): def run_command(self, command): - if isinstance(command, six.text_type): + if isinstance(command, str): command = command.encode('ascii') command = command + b'\n' args = [sys.executable, GDB, '--', sys.executable, '-c', 'pass'] diff -Nru python-ptrace-0.9.3/tests/test_strace.py python-ptrace-0.9.7/tests/test_strace.py --- python-ptrace-0.9.3/tests/test_strace.py 2017-09-18 17:14:16.000000000 +0200 +++ python-ptrace-0.9.7/tests/test_strace.py 2020-08-10 22:45:22.000000000 +0200 @@ -5,7 +5,7 @@ import sys import tempfile import unittest -from ptrace import six + STRACE = os.path.normpath(os.path.join( os.path.dirname(__file__), '..', 'strace.py')) @@ -51,15 +51,11 @@ match = pattern.search(stdout) self.assertTrue(match, stdout) expected = repr(cwd) - if six.PY3: - expected = os.fsencode(expected) + expected = os.fsencode(expected) self.assertEqual(match.group(1), expected) def test_open(self): - if six.PY3: - code = 'open(%a).close()' % __file__ - else: - code = 'open(%r).close()' % __file__ + code = 'open(%a).close()' % __file__ self.assert_syscall(code, br"^open(at)?\(.*test_strace\.pyc?', O_RDONLY(\|O_CLOEXEC)?") diff -Nru python-ptrace-0.9.3/tox.ini python-ptrace-0.9.7/tox.ini --- python-ptrace-0.9.3/tox.ini 2017-02-10 12:22:40.000000000 +0100 +++ python-ptrace-0.9.7/tox.ini 2020-08-10 22:45:22.000000000 +0200 @@ -1,13 +1,11 @@ [tox] -envlist = py2, py3, pep8 +envlist = py3, pep8 [testenv] +basepython = python3 commands= python test_doc.py - python runtests.py - -[testenv:py2] -basepython = python + python runtests.py -v [testenv:py3] basepython = python3
signature.asc
Description: PGP signature