google/pyringe — pull request #18 by silviot (2014-05-09 09:54:09+00:00)
Title: Explicitly tell gdb the python executable to use

Without this change I'm getting this on a system that has also python3 installed, when I try to attach() to a process:

Traceback (most recent call last):
File "", line 1, in
File ".../pyringe/repl.py", line 157, in Attach
self.inferior.Reinit(pid)
File ".../pyringe/inferior.py", line 464, in Reinit
self.__init__(pid, auto_symfile_loading)
File ".../pyringe/inferior.py", line 436, in __init__
self.StartGdb()
File ".../pyringe/inferior.py", line 483, in StartGdb
self._gdb.Attach(self.position)
File ".../pyringe/inferior.py", line 196, in
return lambda *args, **kwargs: self._Execute(name, *args, **kwargs)
File ".../pyringe/inferior.py", line 323, in _Execute
result_string = self._Recv(timeout)
File ".../pyringe/inferior.py", line 408, in _Recv
raise ProxyError(exc_text)
ProxyError: Traceback (most recent call last):
File ".../pyringe/payload/gdb_service.py", line 34, in
import libpython
File ".../pyringe/payload/libpython.py", line 58
Py_TPFLAGS_HEAPTYPE = (1L << 9)
^
SyntaxError: invalid syntax

Curiosly enough `/usr/bin/env python` gives a python 2.7, but still gdb would try to run py3k.
This change does not make pyringe work for me: I still have a consistent TimeoutError. But IMO it should not hurt.